diff options
author | Robert James Kaes <rjkaes@users.sourceforge.net> | 2001-12-20 04:48:32 +0000 |
---|---|---|
committer | Robert James Kaes <rjkaes@users.sourceforge.net> | 2001-12-20 04:48:32 +0000 |
commit | 93f0406b7e2af65aa416fffb1a8a2aaacdb0d10d (patch) | |
tree | c2c0e43b3669088946ed256eb37c597eb213c592 /src | |
parent | 7240af4333a6e5055a5d4e88964f3e14625800de (diff) |
Created the CHECK_CRLF() macro to handle the tests for the appropriate
control characters in a string.
Diffstat (limited to 'src')
-rw-r--r-- | src/reqs.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -1,4 +1,4 @@ -/* $Id: reqs.c,v 1.49 2001-12-19 20:40:23 rjkaes Exp $ +/* $Id: reqs.c,v 1.50 2001-12-20 04:48:32 rjkaes Exp $ * * This is where all the work in tinyproxy is actually done. Incoming * connections have a new thread created for them. The thread then @@ -66,6 +66,11 @@ #endif /* + * Codify the test for the carriage return and new line characters. + */ +#define CHECK_CRLF(header, len) ((len == 1 && header[0] == '\n') || (len == 2 && header[0] == '\r' && header[1] == '\n')) + +/* * Read in the first line from the client (the request line for HTTP * connections. The request line is allocated from the heap, but it must * be freed in another function. @@ -570,10 +575,8 @@ process_client_headers(struct conn_s *connptr) * If we receive a CR LF (or just a LF) on a line by itself, * the headers are finished. */ - if ((len == 1 && header[0] == '\n') - || (len == 2 && header[0] == '\r' && header[1] == '\n')) { + if (CHECK_CRLF(header, len)) break; - } /* * Don't send headers if there's already an error, or if @@ -716,8 +719,7 @@ process_server_headers(struct conn_s *connptr) return -1; } - if (header[0] == '\n' - || (header[0] == '\r' && header[1] == '\n')) + if (CHECK_CRLF(header, len)) break; safefree(header); |