Author: adrian.chadd
Date: Wed Jul  1 00:53:51 2009
New Revision: 14107

Modified:
    branches/LUSCA_HEAD/src/http.c

Log:
Issue 35 - attempt to clarify "no reply body should exist" excess data  
situations



Modified: branches/LUSCA_HEAD/src/http.c
==============================================================================
--- branches/LUSCA_HEAD/src/http.c      (original)
+++ branches/LUSCA_HEAD/src/http.c      Wed Jul  1 00:53:51 2009
@@ -834,7 +834,7 @@
                    while (end && (*end == '\r' || *end == ' ' || *end == '\t'))
                        end++;
                    if (httpState->chunk_size < 0 || badchunk || !end || (*end 
!= '\n'  
&& *end != ';')) {
-                       debug(11, 1) ("Invalid chunk header '%.*s'\n",  
strLen2(httpState->chunkhdr), strBuf2(httpState->chunkhdr));
+                       debug(11, 1) ("Invalid chunk header: URL %s: header 
'%.*s'\n",  
storeUrl(entry), strLen2(httpState->chunkhdr),  
strBuf2(httpState->chunkhdr));
                        fwdFail(httpState->fwd, errorCon(ERR_INVALID_RESP, 
HTTP_BAD_GATEWAY,  
httpState->fwd->request));
                        comm_close(fd);
                        return;
@@ -908,6 +908,23 @@
        if ((len < 0 && !ignoreErrno(errno)) || len == 0) {
            keep_alive = 0;
        }
+    }
+
+    /*
+     * The following bits of code attempt to describe two separate "excess  
data" instances.
+     * One is "We have reply body data for a reply which shouldn't have a  
reply body".
+     * The other is "We have more data for a reply than we should have."
+     *
+     * This almost certainly doesn't correctly log all of the cases  
correctly. It simply is
+     * a horrible attempt to make issues clearer in the logs. It should be  
revisited whenever
+     * someone gets the time/motivation to rewrite the HTTP server-side  
code.
+     */
+    if (len > 0 && httpState->chunk_size == 0) {
+       debug(11, 1) ("httpReadReply: Unexpected reply body data from  
\"%s %s\"\n",
+           orig_request->method->string,
+           storeUrl(entry));
+       comm_close(fd);
+       return;
      }
      if (len > 0) {
        debug(11, Config.onoff.relaxed_header_parser <= 0 || keep_alive ? 1 : 2)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to