7025238 : HttpURLConnection does not handle URLs with an empty path component

Andreas Rieber rieberandreas at gmail.com
Tue Jun 18 12:19:45 PDT 2013


Hi,

i am looking for a sponsor of this issue.

The bug is here:
http://bugs.sun.com/view_bug.do?bug_id=7025238

First i verified that the problem still exists. Then i checked the 
problem against some other web servers. Apache handles a missing "/" in 
the path. Tomcat, Microsoft-HTTPAPI/2.0 and the openjdk build in http 
server behave with same response: 400 Bad Request.

I checked the URL specification but could not see any problem with empty 
path. The HTTP/1.1 specification is there a bit more detailed. So i 
checked HttpURLconnection.java and HttpClient.java where i found the 
problem. If the path/file from url.getFile() is null or empty, a "/" is 
used but not if the url.getFile() returns only a query string. In that 
case the path is empty and should have also a "/".

A webrev can be found here (to be discussed, i am still new to openjdk):
http://cr.openjdk.java.net/~arieber/7025238/webrev.00/

To write the jtreg test and run them all took longer than the fix ;-) I 
did run jtreg on: |test/java/net, | |test/sun/net, | |test/java/security 
and | |test/sun/security but sure i don't have all relevant platfo||rms.|

thanks
Andreas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/net-dev/attachments/20130618/e90f4c1b/attachment.html 


More information about the net-dev mailing list