Hello,
I have a problem with the commons-httpclient package (jakarta). Suppose
I want to send a POST request (PostMethod in commons-httpclient) to the
URL http://my-server:9999/Test. The commons-httpclient generates a
request looking like this:
POST /Test HTTP/1.1
User Agent: Jakarta Commons-HttpClient/3.0-rc2
HOST: my-server:9999
...
This is a valid request. But in our intranet the request is blocked by
a firewall, because of the relative path in the request line (first
line). The firewall needs a request like this:
POST http://my-server:9999/Test HTTP/1.1
User Agent: Jakarta Commons-HttpClient/3.0-rc2
HOST: my-server:9999
...
This format is mandatory (RFC 2616) if the request is send via a proxy.
I've examined the commons-httpclient code and found out that the
complete URL is written in the request line if I set a proxy in the
HttpClient class (in the HostConfiguration). But I don't know the URL
of the proxy where the firewall runs. Is there another way to force the
commons-httpclient to write the full URL?
I've tried to set the destination server as proxy, too (in the example
above I've set my-server:9999 as proxy). This worked in a local
environment. I haven't tested if this will work in our intranet (since
the test will take some time) and it also looks a little bit like a
dirty workaround to me.
Regards
Markus
Chris Uppal - 11 May 2006 10:54 GMT
> This format is mandatory (RFC 2616) if the request is send via a proxy.
> I've examined the commons-httpclient code and found out that the
> complete URL is written in the request line if I set a proxy in the
> HttpClient class (in the HostConfiguration). But I don't know the URL
> of the proxy where the firewall runs.
To me, that sounds as if your firewall is configured to reject all connections
which bypass the nominated proxy (not necessarily the firewall itself). If so
then you don't have a code workaround -- it's a network configuration issue,
and you have to find out which server the Mighty Network Administrator has
configured.
I.e. talk to your network people.
(Of course, it may be a configuration error in the firewall, but you would be
well-advised not to advance this suggestion to the Mighty Network
Administrator)
-- chris