302 response without location header throws exception
-----------------------------------------------------

                 Key: HTTPCLIENT-939
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-939
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient
    Affects Versions: 4.0.1
            Reporter: Nicolas Belisle


Hi, 

According to HTTP 1.1 Spec : 
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.3
"The temporary URI SHOULD be given by the Location field in the response. 
Unless the request method was HEAD, the entity of the response SHOULD contain a 
short hypertext note with a hyperlink to the new URI(s)."

Now, in "DefaultRedirectStrategy.getLocationURI()", there's a ProtocolException 
thrown if location header is null.  

if (locationHeader == null) {
    // got a redirect response, but no location header
    throw new ProtocolException(
        "Received redirect response " + response.getStatusLine()
       + " but no location header");
 }

The specs says "SHOULD" and not "MUST". ProtocolException "signals that an HTTP 
protocol violation has occurred", which is not exactly true.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to