aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes Http 1.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Http 1.0" Watch "Http 1.0" New topic
Author

Http 1.0

Brian Mozhdehi
Ranch Hand

Joined: Aug 17, 2006
Posts: 81
Hi - I need to use the HTTP 1.0 protocol for a web server I am trying to post to. In that, I need the request headers to send explicitly
POST <URL> HTTP/1.0.

When I use HttpURLConnection, I cant seem to find a way for it to send 1.0 instead of 1.1, i.e it sends HTTP/1.1. Also, it seems to send only the resource in the <URL> paramater, i.e for http://foo.com/bar it sends /bar when I need it to send http://foo.com/bar.

This requirement is being driven by a government server, so I cannot change it. Do I need to manually code the transmission of the request headers or is there a way to make HttpURLConnection do whats needed? Or is there another object that might work in place of HttpURLConnection?

Thanks much for any help.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42264
    
  64
The HttpClient library provides a number of options that HttpURLConnection doesn't have; maybe selecting the protocol version is one of them.

As to sending the complete URL, I don't think that's possible. Does the ptotocol specification even allow that? It would in any case be superfluous, as the connection to the server has been established at that point, so sending the server name again doesn't provide any information.


Ping & DNS - my free Android networking tools app
Brian Mozhdehi
Ranch Hand

Joined: Aug 17, 2006
Posts: 81
Thanks much for this, much appreciated. I agree with what you are saying on the specification/entire URL. It isnt part of the specification I dont think. I may end up having to write directly to the stream. But at least I can try HttpClient and see what happens. Maybe I can "extend" to allow the variation. On a side note, this whole project is crazy - its a Canadian government thing, this is among their many requirements that make no sense
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

You send the whole URL in that location when you're talking to a proxy server; is that what's going on here?


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Http 1.0