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

Julia Boes julia.boes at oracle.com
Wed Jul 31 10:56:58 UTC 2019


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/


Cheers,

Julia

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20190731/8c46b0e5/attachment.html>


More information about the net-dev mailing list