log_access() moved to log.c

This commit is contained in:
Sergey Lyubka committed 2013-11-23 10:31:24 +00:00
1 parent 71dd7a96c7
commit ebdf973af9
5 files changed
+119 -117

No files matched your search

+15
View File
@@ -9,3 +9,18 @@ static struct mg_connection *fc(struct mg_context *ctx) {
fake_connection.event.user_data = ctx->user_data;
return &fake_connection;
}
static void sockaddr_to_string(char *buf, size_t len,
const union usa *usa) {
buf[0] = '\0';
#if defined(USE_IPV6)
inet_ntop(usa->sa.sa_family, usa->sa.sa_family == AF_INET ?
(void *) &usa->sin.sin_addr :
(void *) &usa->sin6.sin6_addr, buf, len);
#elif defined(_WIN32)
// Only Windoze Vista (and newer) have inet_ntop()
strncpy(buf, inet_ntoa(usa->sin.sin_addr), len);
#else
inet_ntop(usa->sa.sa_family, (void *) &usa->sin.sin_addr, buf, len);
#endif
}