Patch: HTTP/1.0 fix

Anthony Green green@redhat.com
Sat Sep 7 12:25:00 GMT 2002


Christophe Roux found this bug, among others, while debugging some servlets.
Ok for trunk?

What it the policy for the 3.2 branch now?  It would be nice to get this in
for other Tomcat users.

AG



2002-09-07  Anthony Green  <green@redhat.com>

	* gnu/gcj/protocol/http/Connection.java (connect): Replace \n with
	\r\n.  HTTP/1.0 defines the octet sequence CR LF as the
	end-of-line marker for all protocol elements except the
	Entity-Body.  From Christophe Roux.

Index: libjava/gnu/gcj/protocol/http/Connection.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/gcj/protocol/http/Connection.java,v
retrieving revision 1.7
diff -2 -c -p -r1.7 Connection.java
*** libjava/gnu/gcj/protocol/http/Connection.java	23 Aug 2002 04:54:03 -0000	1.7
--- libjava/gnu/gcj/protocol/http/Connection.java	7 Sep 2002 19:20:36 -0000
*************** class Connection extends HttpURLConnecti
*** 95,105 ****
  
      // Send request including any request properties that were set.
!     out.print(getRequestMethod() + " " + url.getFile() + " HTTP/1.0\n");
!     out.print("Host: " + url.getHost() + ":" + port + "\n");
      Enumeration reqKeys = requestProperties.keys();
      Enumeration reqVals = requestProperties.elements();
      while (reqKeys.hasMoreElements())
!       out.print(reqKeys.nextElement() + ": " + reqVals.nextElement() + "\n");
!     out.print("\n");
      out.flush();    
      getHttpHeaders();
--- 95,105 ----
  
      // Send request including any request properties that were set.
!     out.print(getRequestMethod() + " " + url.getFile() + " HTTP/1.0\r\n");
!     out.print("Host: " + url.getHost() + ":" + port + "\r\n");
      Enumeration reqKeys = requestProperties.keys();
      Enumeration reqVals = requestProperties.elements();
      while (reqKeys.hasMoreElements())
!       out.print(reqKeys.nextElement() + ": " + reqVals.nextElement() + "\r\n");
!     out.print("\r\n");
      out.flush();    
      getHttpHeaders();





More information about the Java-patches mailing list