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

Reply via email to