hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 33041] New: - HttpParser fails to parse the cookie header that has a newline character in its value
Date Tue, 11 Jan 2005 12:06:19 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33041>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=33041

           Summary: HttpParser fails to parse the cookie header that has a
                    newline character in its value
           Product: HttpClient
           Version: 3.0 Final
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Commons HttpClient
        AssignedTo: httpclient-dev@jakarta.apache.org
        ReportedBy: skannan5@chn.cognizant.com
                CC: skannan5@chn.cognizant.com


The readRawLine() method of HttpParser.java parses the header assuming  that
only '/n' (LF) as the end of header message whereas the actual header delimiter
specified in the RFC 2616 for HTTP is '/r/n' (CRLF). (Ref:-
http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4)
If a header's value has a newline character in it, then parsing the header next
to the one that has newline will fail. This can be fixed with the following
change in the code of readRawLine method.

int prevch=-1;
while ((ch = inputStream.read()) >= 0) {
    buf.write(ch);
    if ((ch == '\n') && (prevch=='\r')) { // Check for CR before LF & then break
        break;
    }
    prevch=ch; // Store the previous character 
}

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Mime
View raw message