--------------------- PatchSet 2734 Date: 2001/08/09 19:14:12 Author: adri Branch: newhttp Tag: (none) Log: Commit some comments outlining how the http request parser will work Members: src/modules/new_http_client/http_request.c:1.1.2.1->1.1.2.2 Index: squid/src/modules/new_http_client/http_request.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/modules/new_http_client/Attic/http_request.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid/src/modules/new_http_client/http_request.c 9 Aug 2001 18:58:13 -0000 1.1.2.1 +++ squid/src/modules/new_http_client/http_request.c 9 Aug 2001 19:14:12 -0000 1.1.2.2 @@ -5,9 +5,63 @@ +/* + * http_client_read_request - attempt to parse the buffer + * as a request + * + * To keep things simple for now, we either succeed or fail parsing + * the request line. A possible optimisation later on would be to + * keep track of which bits we've parsed (since a request might come + * in via seperate buffers, especially in a long URI) + * but for now I'm going to keep this simple. + * + * If we succeed in nabbing a request we upgrade the connection to + * the relevant type (CONNECT, REQUESTBODY, NORMAL) and then call + * its handler function to try parsing some more. + */ int http_client_read_request(int fd, http_client_conn_state_t *conn) { + + /* + * Note that during any of the below finds: + * - if we find a cr/lf/crlf character where one isn't being + * expected, then its a request error rather than a partial + * buffer + */ + + /* + * For now we assume the first character in the buffer is the + * start of the request. For pipelined requests this may or + * may not be true. + */ + + /* Find the first non-whitespace character in the buffer */ + /* This is the start of the request method */ + + /* Find the first whitespace character in the buffer */ + /* This is the end of the request method */ + + /* Find the next non-whitespace character in the buffer */ + /* This is the start of the URI */ + + /* Find the next whitespace character in the buffer */ + /* This is the end of the URI */ + + /* Find the next non-whitespace character in the buffer */ + /* This is the beginning of the version */ + + /* Find the next whitespace or cr/lf/crlf character in the buffer */ + /* This is the end of the version */ + + /* + * Find the next cr/lf/crlf character in the buffer (unless of course + * the previous find _hit_ a cr/lf/crlf!) - this is the end of the + * request line + */ + + /* At this stage we've got a request but we don't know if its valid */ + /* For now, succeed */ return 1; }