summaryrefslogtreecommitdiff
path: root/src/libexec
diff options
context:
space:
mode:
authorepochqwert <epoch@hacking.allowed.org>2015-04-23 04:53:35 -0500
committerepochqwert <epoch@hacking.allowed.org>2015-04-23 04:53:35 -0500
commita36652959e52e8c810b7d2d76a283b2ae9718d96 (patch)
treea8c9712f7eb243d72bfdb492c0c14e630e78a03d /src/libexec
parent318b3220d191011bb9132efd4dbd5e6fb467b4e7 (diff)
downloadmisc-a36652959e52e8c810b7d2d76a283b2ae9718d96.tar.gz
misc-a36652959e52e8c810b7d2d76a283b2ae9718d96.zip
elapsedtime handles partial seconds better
unescape now handles multiple lines from stdin clump can now have an optional argument to specify input separator cuturl can now take compressed short options. (like: cuturl -dPs) filemon... I don't remember. just reformatted it looks like. ipconvert. looks like I added explainations before output. normalpath now uses getenv("PWD") instead of getcwd() so you can pick what you want to be the base for relative paths. urcdump... nothing I guess. probably a space or something dumb. httpd... more environment variables set for CGIs
Diffstat (limited to 'src/libexec')
-rw-r--r--src/libexec/httpd.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/libexec/httpd.c b/src/libexec/httpd.c
index f22e139..c2a5daf 100644
--- a/src/libexec/httpd.c
+++ b/src/libexec/httpd.c
@@ -64,11 +64,21 @@ int main(int argc,char *argv[]) {
struct sockaddr_in6 sa6;
unsigned int sl=sizeof(sa6);
char h[NI_MAXHOST];
+ char p[NI_MAXSERV];
openlog("httpd",LOG_PID,LOG_DAEMON);
+
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);
+ getnameinfo((struct sockaddr *)&sa6,sl,h,sizeof(h),p,sizeof(p),NI_NUMERICHOST|NI_NUMERICSERV);
setenv("REMOTE_ADDR",h,1);
+ setenv("REMOTE_PORT",p,1);
+
+ if(getsockname(0,(struct sockaddr *)&sa6,&sl) == -1)
+ syslog(LOG_WARNING,"getsockname: %m");
+ getnameinfo((struct sockaddr *)&sa6,sl,h,sizeof(h),p,sizeof(p),NI_NUMERICHOST|NI_NUMERICSERV);
+ setenv("SERVER_ADDR",h,1);
+ setenv("SERVER_PORT",p,1);
+
if(!strchr(line,'\n')) {
printf("HTTP/1.1 413 Entity Too Large\r\n");
standard_headers();
@@ -116,7 +126,7 @@ int main(int argc,char *argv[]) {
}
alarm(0);//no more timeout.
//
- syslog(LOG_WARNING,"%s: %s %s %s\n",h,getenv("HTTP_USER_AGENT"),page,get_param);
+ syslog(LOG_WARNING,"%s: %s %s %s %s\n",h,getenv("HTTP_HOST"),getenv("HTTP_USER_AGENT"),page,get_param);
//TODO: sanitize this.
if(chdir(VHOST_ROOT) == -1) {
printf("HTTP/1.1 500 Internal Server Error\r\n");
@@ -195,6 +205,8 @@ int main(int argc,char *argv[]) {
printf("HTTP/1.1 200 OK\r\n");
standard_headers();
fflush(stdout);
+ //what was this needed for? breaks ?page=ident if closed.
+ if(!strcmp(method,"GET")) close(STDIN_FILENO);
execv(name[0],name);
}
return 0;