You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ma...@apache.org on 2002/07/22 18:26:03 UTC

cvs commit: apache-1.3/src/modules/proxy proxy_util.c

martin      2002/07/22 09:26:03

  Modified:    src/modules/proxy proxy_util.c
  Log:
  Tomcat with mod_jk2 sometimes omits the Reason-Phrase from the
  response line ("HTTP/1.1 200 \r\n"). It looks like RFC2616 allows this,
  but ap_getline() strips the trailing blank, and that lead to
  an error in ap_proxy_read_response_line() for proxy-requests to
  Tomcat+mod_jk2 servers. (It replaced the NIL after the "200" by
  a space, and so the resulting response line had an extra NL appended).
  Now the SP character which was deleted by ap_getline() is reappended,
  avoiding the erroneous '\0'->' ' change, and preserving RFC2616's
  requirement
       Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
       Reason-Phrase = *<TEXT, excluding CR, LF>
  (thus there is now always a SP after the Status-Code).
  
  Revision  Changes    Path
  1.126     +6 -0      apache-1.3/src/modules/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_util.c,v
  retrieving revision 1.125
  retrieving revision 1.126
  diff -u -r1.125 -r1.126
  --- proxy_util.c	18 Jun 2002 00:59:59 -0000	1.125
  +++ proxy_util.c	22 Jul 2002 16:26:03 -0000	1.126
  @@ -1607,6 +1607,12 @@
           }
           *backasswards = 0;
   
  +        /* there need not be a reason phrase in the response,
  +	 * and ap_getline() already deleted trailing whitespace.
  +	 * But RFC2616 requires a SP after the Status-Code. Add one:
  +	 */
  +	if (strlen(buffer) < sizeof("HTTP/1.x 200 ")-1)
  +	  buffer = ap_pstrcat(r->pool, buffer, " ", NULL);
           buffer[12] = '\0';
           r->status = atoi(&buffer[9]);
           buffer[12] = ' ';