• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to make http 1.0 request in java  RSS feed

 
syed afzal
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you make a http version 1.0 request using native java classes. I do not want to use apache httpclient or any other dependency. Any simple solution instead of jumping to socket programming ?
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
syed afzal wrote:How do you make a http version 1.0 request using native java classes. I do not want to use apache httpclient or any other dependency. Any simple solution instead of jumping to socket programming ?

And why do you think socket programming would help you out? The fact is that you can't simply "send" an HTTP request out into the ether, you need something to service it for you, and Apache is the best HTTP server I know of (and it's free).

Personally, I'd start with the tutorials. You might also do a search of the API docs for classes that include 'HTTP' or 'Http' (and there are quite a few).

Winston
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you explicitly mention the version number 1.0, I guess it's important for you that it's an HTTP/1.0 and not an HTTP/1.1 request.

I'm not sure if that is possible with the standard Java classes. Classes such as java.net.HttpURLConnection provide only very basic control, that's why people who need more precise control over HTTP requests and responses use a more powerful library such as Apache HttpComponents.

You could write a simple HTTP client yourself with socket programming, but this will be much more work than trying to use an existing library; the HTTP protocol seems simple, but there are quite a lot of details that don't make it trivial to implement.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The java.net classes let you make HTTP requests. (I think Winston was thinking about HTTP responses, which is what a server sends.)

As Jesper said, the difficulty could be sending HTTP 1.0 instead of 1.1 (which is what basically everybody has been using for many years). Why do you need 1.0, specifically?
 
syed afzal
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys.
So I guess there is no other way than apache http libs. Now I'l have to spend time on understanding new classes.
Well, I am dealing with some web application firewall fingerprinting issues, which involves crazy stuff like sending http/1.0, making request for http method (verb) which do not exist and more protocol level tampering.
On second thought, is Java a choice to begin with ?

Once again, thank you everyone. I appreciate it.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Apache HTTP library has an extensive online tutorial with many code samples available. It should be easy to get started with.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your application requires strange things like sending an HTTP method that isn't part of the official HTTP specification and other strange deviations from standard HTTP, then I'm not sure if it's possible to do that with Apache HttpComponents, but in my opinion it would be worth to find out, before trying to write your own implementation using sockets. (What firewall requires these strange tricks and why does it work like that?!).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!