Handle null header value property

When using an Apache Http components based infrastructure, a null header
value is handled as the empty string. The exact same infrastructure using
HttpURLConnection generates a header with no colon. This is actually not
proper HTTP and some components fail to read such request.

We now make sure to call HttpURLConnection#addRequestProperty with the
empty String for a null header value.

Issue: SPR-13225
This commit is contained in:
Stephane Nicoll
2015-07-14 10:34:28 +02:00
parent bdb63483df
commit de6bbe7797
2 changed files with 43 additions and 1 deletions

View File

@@ -100,7 +100,8 @@ final class SimpleBufferingClientHttpRequest extends AbstractBufferingClientHttp
}
else {
for (String headerValue : entry.getValue()) {
connection.addRequestProperty(headerName, headerValue);
String actualHeaderValue = headerValue != null ? headerValue : "";
connection.addRequestProperty(headerName, actualHeaderValue);
}
}
}