United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6469663 HTTP Request-URI contains fragment when connecting through proxy
JDK-6469663 : HTTP Request-URI contains fragment when connecting through proxy

Details
Type:
Bug
Submit Date:
2006-09-12
Status:
Closed
Updated Date:
2011-03-08
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
core-libs
OS:
generic
Sub-Component:
java.net
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
5.0u8
Fixed Versions:

Related Reports
Backport:
Backport:
Backport:
Relates:

Sub Tasks

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()
                                     
2006-09-12



Hardware and Software, Engineered to Work Together