aboutsummaryrefslogtreecommitdiffstats
path: root/src/libexec/httpd.c
diff options
context:
space:
mode:
authorEpoch Qwert <epoch@53flpnlls43fcguy.onion>2014-10-23 01:20:02 -0500
committerEpoch Qwert <epoch@53flpnlls43fcguy.onion>2014-10-23 01:20:02 -0500
commit8c542d83091f9ba5ccb095fad730651f8e6c1eef (patch)
treead26b5a7686d7b78888fa052226551255e3d8633 /src/libexec/httpd.c
parent12201178a5950eecd9537e642b1246011490b499 (diff)
downloadmisc-8c542d83091f9ba5ccb095fad730651f8e6c1eef.tar.gz
misc-8c542d83091f9ba5ccb095fad730651f8e6c1eef.zip
fixed gopherd's LFI and added excuting files.
httpd had flushing issues. realpath is new! does what it says. gives absolute path of a file. deddos, peerip, peerip.pl, were laying around elsewhere. gethostbyname got a new trick. can do decimal addresses among other things. hop0 is a shell script that gets what IP will be put on the source address of outgoing packets sent to $1. rtfs.
Diffstat (limited to 'src/libexec/httpd.c')
-rw-r--r--src/libexec/httpd.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/libexec/httpd.c b/src/libexec/httpd.c
index 4b14269..9da149f 100644
--- a/src/libexec/httpd.c
+++ b/src/libexec/httpd.c
@@ -2,13 +2,15 @@
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
+#include <syslog.h>
#define VHOST_ROOT "/var/www"
#define CGI "cgi-bin"
#define SERVER "epochttpd/2.0 (Unix)"
void standard_headers() {
- printf("Server: %s\n",SERVER);
+ printf("Server: %s\r\n",SERVER);
+ printf("Connection: close\r\n");
}
int main(int argc,char *argv[]) {
@@ -22,6 +24,8 @@ 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");
if(!strchr(line,'\n')) {
printf("HTTP/1.1 413 Entity Too Large\r\n");
standard_headers();
@@ -71,7 +75,7 @@ int main(int argc,char *argv[]) {
printf("Location: /%sindex.html\r\n\r\n",page);
return 0;
}
- if(fd=open(page,O_RDONLY) != -1) {//need to check that the file isn't a directory. :P
+ if((fd=open(page,O_RDONLY)) != -1) {//need to check that the file isn't a directory. :P
printf("HTTP/1.1 200 OK\r\n");
standard_headers();
name[0]="/usr/local/bin/mime-type";
@@ -92,8 +96,9 @@ int main(int argc,char *argv[]) {
wait(&s);
fflush(stdout);
printf("\r\n");
- while((n=read(fd,line,sizeof(line))) > 0) {
- write(1,line,n);
+ fflush(stdout);
+ while((n=read(fd,line,sizeof(line)-1)) > 0) {
+ write(STDOUT_FILENO,line,n);
}
} else {
printf("HTTP/1.1 404 Not Found\r\n");