JDK-6469663 : HTTP Request-URI contains fragment when connecting through proxy
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 5.0u8
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2006-09-12
  • Updated: 2011-03-08
  • Resolved: 2011-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6 JDK 7
1.4.2_14Fixed 6u2Fixed 7 b03Fixed
Related Reports
Relates :  
Description
The Request-URI used in a HTTP request from java.net.HttpURLConnection contains the uri fragment when the connection is being made through a proxy. This is not strictly correct according to RFC 2616 and could cause problems for some proxies. 

This is not the case in 1.3.x, the fragment is not added to the Request-URI. This behavior first changed in 1.4.

In the case where the connection is direct the uri fragment is not added to the Request-URI for all version of the jdk.

Comments
EVALUATION The Request-URI is being generated in HttpClient.getURLFile. In the case where we are connecting through a proxy then URL.toExternalForm is used, and this will include the fragment (if there is one). In the case of direct connection we simply use url.getFile(). This changed from 1.3 to 1.4. In 1.3 we simply do <protocol>://<host><port> + url.getfile(). In 1.4 this was changed to URL.toExternalForm (which includes the fragment). This change (as mentioned above) was for: 4720715 FTP with user and password doesn't work through proxy The reason to use toExternalForm is that it will include the username and password if there is one. FTP uses HttpURLConnection in the case of a connection through a proxy. We should fix it in HttpClient.getURLFile by replacing toExternalForm with something like <protocol>://<user>:<pass>@<host><port> + url.getfile()
12-09-2006