commons-httclient: Request URI in protokol header

M

markusw2006

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
 
C

Chris Uppal

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,230
Latest member
LifeBoostCBD

Latest Threads

Top