From 42d9771ba0c2e3491025e24956c995a7db56372c Mon Sep 17 00:00:00 2001 From: Epoch Qwert Date: Sun, 11 Jan 2015 03:01:37 -0600 Subject: fuck if I know. I was just going to add the gateway. >_> --- src/libexec/httpd.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libexec/httpd.c b/src/libexec/httpd.c index 812e051..41339ae 100644 --- a/src/libexec/httpd.c +++ b/src/libexec/httpd.c @@ -5,6 +5,9 @@ #include #include #include +#include +#include +#include #define VHOST_ROOT "/var/www/vhosts" #define SITES_ROOT "/var/www/sites" @@ -26,8 +29,12 @@ int main(int argc,char *argv[]) { char *get_param; char line[getpagesize()]; fgets(line,sizeof(line)-1,stdin); -// syslog(LOG_INFO,"ADDRESS did a LINE"); -// syslog(LOG_WARNING,"httpd syslog test\n"); + struct sockaddr_in6 sa6; + unsigned int sl=sizeof(sa6); + char h[NI_MAXHOST]; + if(getpeername(0,(struct sockaddr *)&sa6,&sl) == -1) syslog(LOG_WARNING,"getpeername: %m"); + getnameinfo((struct sockaddr *)&sa6,sl,h,sizeof(h),0,0,NI_NUMERICHOST); + setenv("REMOTE_ADDR",h,1); if(!strchr(line,'\n')) { printf("HTTP/1.1 413 Entity Too Large\r\n"); standard_headers(); @@ -36,6 +43,7 @@ int main(int argc,char *argv[]) { return 0; } if(strchr(line,'\r')) *strchr(line,'\r')=0; + syslog(LOG_WARNING,"%s %s\n",h,line); method=strdup(line); if((page=strchr(method,' '))) { *page=0; -- cgit v1.2.3