diff --git a/quark.c b/quark.c index 0631248..dadc78e 100644 --- a/quark.c +++ b/quark.c @@ -24,6 +24,13 @@ char *argv0; #define MAXBUFLEN 1024 #define MIN(x,y) ((x) < (y) ? (x) : (y)) +#define HttpOk "200 OK" +#define HttpMoved "301 Moved Permanently" +#define HttpNotModified "304 Not Modified" +#define HttpUnauthorized "401 Unauthorized" +#define HttpNotFound "404 Not Found" +#define texthtml "text/html" + enum { GET = 4, HEAD = 5, @@ -39,13 +46,6 @@ typedef struct { int fd; } Request; -static const char HttpOk[] = "200 OK"; -static const char HttpMoved[] = "301 Moved Permanently"; -static const char HttpNotModified[] = "304 Not Modified"; -static const char HttpUnauthorized[] = "401 Unauthorized"; -static const char HttpNotFound[] = "404 Not Found"; -static const char texthtml[] = "text/html"; - enum { HEADER, CONTENTLEN, @@ -203,7 +203,7 @@ responsefile(void) { return; status = 404; if (req.type == GET) - writetext("\r\n404 Not Found\r\n"); + writetext("\r\n"HttpNotFound"\r\n"); } else { /* check if modified */ t = st.st_mtim.tv_sec; @@ -278,7 +278,7 @@ responsedir(void) { status = 301; reqbuf[len] = 0; if (req.type == GET) - writetext("\r\n301 Moved Permanently\r\n"); + writetext("\r\n"HttpMoved"\r\n"); return; } if (len + strlen(docindex) + 1 < MAXBUFLEN) @@ -332,7 +332,7 @@ responsecgi(void) { return; status = 404; if (req.type == GET) - writetext("\r\n404 Not Found\r\n"); + writetext("\r\n"HttpNotFound"\r\n"); } } @@ -348,7 +348,7 @@ response(void) { return; status = 401; if (req.type == GET) - writetext("\r\n401 Unauthorized\r\n"); + writetext("\r\n"HttpUnauthorized"\r\n"); return; } if (cgi_mode) {