Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Handling a post request using Sockets  RSS feed

 
Trader Joey
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to write a simple web server. Currently the server runs fine with "get" requests. Heres what I do to handle a get request. As soon as the ServerSocket accepts a socket, I read the input stream, and check if the action is get or post. If the action is get, I parse and get the URL. I create a URL, open a URLConnection and read from the output stream. This works fine. I am wondering how to handle "post" requests. Becuase I dont get to the parameters that are passed in the request.
Thanks
Nikhil
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your goin to do this, read HTTP 1.0 specification Once you have that down, read Htp 1.1 Specification
One thing you'll note out of this is that Post information is sent over a second and seperate input stream from the request URI. When you get the request and examine the Header and it indicates a POST, you need to open a second stream with the client and read it in.
Of course if your truely interested, you could participate in Jigsaw a Java Based HTTP Server.
------------------
I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
[This message has been edited by Carl Trusiak (edited October 22, 2001).]
 
Trader Joey
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
That sure is helpful. Thanks. I will read up the specs but your brief explanation will certainly be a good start. I was wondering if you could also help me with https. Any links I could read up.
Thanks again
Nikhil
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!