David Daney writes: > @@ -438,30 +435,25 @@ public class Request > String message = line.substring(end + 1, len - 1); > // Read response headers > Headers responseHeaders = new Headers(); > - responseHeaders.parse(in); > + responseHeaders.parse(lis); > notifyHeaderHandlers(responseHeaders); > - // Construct response > - int codeClass = code / 100; > - Response ret = new Response(majorVersion, minorVersion, code, > - codeClass, message, responseHeaders); > + InputStream body = null; > + > switch (code) > { > + case 100: > case 204: > case 205: > case 304: > break; > default: > - // Does response body reader want body? > - boolean notify = (responseBodyReader != null); > - if (notify) > - { > - if (!responseBodyReader.accept(this, ret)) > - { > - notify = false; > - } > - } > - readResponseBody(ret, in, notify); > + body = createResponseBodyStream(responseHeaders, majorVersion, > + minorVersion, in); > } > + > + // Construct response > + Response ret = new Response(majorVersion, minorVersion, code, > + message, responseHeaders, body); > return ret; > }
This change breaks HTTP redirects in gcj Version 4.1. We send "GET /bugzilla HTTP/1.1\r\nHost: gcc.gnu.org\r\nUser-Agent: ELinks/0.10.3 (textmode; Linux; -)\r\nAccept: */*\r\nAccept-Encoding: gzip\r\nAccept-Language: en\r\nConnection: Keep-Alive\r\n\r\n" If we get a response like "HTTP/1.1 301 Moved Permanently\r\nDate: Fri, 20 Jan 2006 19:24:08 GMT\r\nContent-Length: 314\r\nContent-Type: text/html; charset=iso-8859-1\r\nServer: Apache/2.0.52 (Red Hat)\r\nLocation: http://gcc.gnu.org/bugzilla/\r\n\r\n<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n<html><head>\n<title>301 Moved Permanently</title>\n</head><body>\n<h1>Moved Permanently</h1>\n<p>The document has moved <a href="http://gcc.gnu.org/bugzilla/">here</a>.</p>\n<hr>\n<address>Apache/2.0.52 (Red Hat) Server at gcc.gnu.org Port 80</address>\n</body></html>\n" we read the first part, which is "HTTP/1.1 301 Moved Permanently\r". Before redirecting we need to purge the rest of this response. The previous code, which this patch removes, called readResponseBody() to do this. There is a full testcase for this at https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=178445 Andrew. _______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches