Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Http 1.0

 
Brian Mozhdehi
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Brian Mozhdehi
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You send the whole URL in that location when you're talking to a proxy server; is that what's going on here?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic