[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-986?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jonathan Moore updated HTTPCLIENT-986:
--------------------------------------

    Attachment: warning-handling.patch

Please find attached a patch that addresses this issue. I ended up creating a 
WarningValue class to parse the warning values in the multi-valued Warning 
header, because the grammar is fairly complex (quoted strings, etc.) and it 
didn't seem like Header#getElements() would work. This might actually be 
suitable for inclusion in httpcore, since it isn't cache-specific, but wanted 
to keep everything in one place for now.

This patch is contributed with the permission of my employer.


> cache module does not completely handle upstream Warning headers correctly
> --------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-986
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-986
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache
>    Affects Versions: 4.1 Alpha2
>            Reporter: Jonathan Moore
>         Attachments: warning-handling.patch
>
>
> There are a couple of MUST requirements from the RFC for Warning headers that 
> aren't correctly handled by the current implementation:
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.46
> 1. "However, if a cache successfully validates a cache entry, it SHOULD 
> remove any Warning headers previously attached to that entry except as 
> specified for specific Warning codes. It MUST then add any Warning headers 
> received in the validating response."
> 2. "If an implementation receives a message with a warning-value that 
> includes a warn-date, and that warn-date is different from the Date value in 
> the response, then that warning-value MUST be deleted from the message before 
> storing, forwarding, or using it. (This prevents bad consequences of naive 
> caching of Warning header fields.) If all of the warning-values are deleted 
> for this reason, the Warning header MUST be deleted as well." 

-- 
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