summaryrefslogtreecommitdiff
path: root/src/reqs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/reqs.c')
-rw-r--r--src/reqs.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/reqs.c b/src/reqs.c
index edf60e4..c7b7dcd 100644
--- a/src/reqs.c
+++ b/src/reqs.c
@@ -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);