RFR: 8185898: setRequestProperty(key, null) results in HTTP header without colon in request

Michael McMahon michael.x.mcmahon at oracle.com
Wed Jul 31 11:09:19 UTC 2019


Hi Julia,

I will sponsor this for you.

Trivially, there are a couple of unnecessary blank lines inserted at the 
top of MessageHeader.java.
I think the @summary in the new test might be better just having the 
original bug synopsis in this case.
Otherwise, looks fine.

Thanks,
Michael.

On 31/07/2019, 11:56, Julia Boes wrote:
> Hi,
>
> Please find below a patch for:
>
> 8185898: setRequestProperty(key, null) results in HTTP header without 
> colon in request
>
> https://bugs.openjdk.java.net/browse/JDK-8185898
>
> According to RFC 2616 <https://tools.ietf.org/html/rfc2616#section-4>, 
> message headers of a HTTP message must adhere to the format:
>
> field-name ":" [ field-value ]
>
> Previously, the request line was handled like a message header and 
> MessageHeader::print would omit ":" for message headers with value == 
> null to account for the request line. However, this can result in a 
> regular message header missing the colon if its value is null. To fix 
> this, MessageHeader.requestLine was added, which is used only for the  
> status line of a request. Any use of MessageHeader.set(0) and 
> MessageHeader.prepend() in HttpURLConnection was replaced by 
> MessageHeader::setRequestLine.
>
> Webrev:
>
> http://cr.openjdk.java.net/~michaelm/jboes/8185898/webrev.1/ 
> <http://cr.openjdk.java.net/%7Emichaelm/jboes/8185898/webrev.1/>
>
>
> Cheers,
>
> Julia
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20190731/f6d8679d/attachment.html>


More information about the net-dev mailing list