File tree Expand file tree Collapse file tree 3 files changed +11
-12
lines changed Expand file tree Collapse file tree 3 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -65,8 +65,8 @@ void serve_forever(const char *PORT) {
6565 if (fork () == 0 ) {
6666 close (listenfd );
6767 respond (slot );
68- close (clients [slot ]);
69- clients [slot ] = -1 ;
68+ close (clients [slot ]);
69+ clients [slot ] = -1 ;
7070 exit (0 );
7171 } else {
7272 close (clients [slot ]);
@@ -226,6 +226,6 @@ void respond(int slot) {
226226 shutdown (STDOUT_FILENO , SHUT_WR );
227227 close (STDOUT_FILENO );
228228 }
229-
229+
230230 free (buf );
231231}
Original file line number Diff line number Diff line change 55#include <string.h>
66
77// Client request
8- extern char * method , // "GET" or "POST"
9- * uri , // "/index.html" things before '?'
10- * qs , // "a=1&b=2" things after '?'
11- * prot , // "HTTP/1.1"
12- * payload ; // for POST
8+ extern char * method , // "GET" or "POST"
9+ * uri , // "/index.html" things before '?'
10+ * qs , // "a=1&b=2" things after '?'
11+ * prot , // "HTTP/1.1"
12+ * payload ; // for POST
1313
1414extern int payload_size ;
1515
Original file line number Diff line number Diff line change 44#define CHUNK_SIZE 1024 // read 1024 bytes at a time
55
66// Public directory settings
7- #define PUBLIC_DIR "./public"
8- #define INDEX_HTML "/index.html"
7+ #define PUBLIC_DIR "./public"
8+ #define INDEX_HTML "/index.html"
99#define NOT_FOUND_HTML "/404.html"
1010
11-
1211int main (int c , char * * v ) {
1312 char * port = c == 1 ? "8000" : v [1 ];
1413 serve_forever (port );
@@ -18,7 +17,7 @@ int main(int c, char **v) {
1817int file_exists (const char * file_name ) {
1918 struct stat buffer ;
2019 int exists ;
21-
20+
2221 exists = (stat (file_name , & buffer ) == 0 );
2322
2423 return exists ;
You can’t perform that action at this time.
0 commit comments