LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 12-05-2003, 09:31 AM   #1
mofofish
LQ Newbie
 
Registered: Dec 2003
Posts: 3

Rep: Reputation: 0
HTTP request parsing: POST


i am developing a program part of which is a simple web server, i am trying to work the format of POST requests from html forms because my program needs to recieve a POST request and parse it to read what data the http request is POSTing. while writting the rest of my program i used this simple script and some home made html to reverse engineer http.

Code:
#!/usr/bin/ruby

require 'socket'
                                                                                                                             
server = TCPServer.new('0.0.0.0', '8080')

while (session = server.accept)
  puts session.gets
end
and then i used this html page to try and find out how POST requests look

Code:
<html>
<body>
<form method=post action="ht tp ://127.0.0.1: 808 0/t est.cgi">
<input name="track" type="checkbox" value="biffy.mp3">
<input name="track" type="checkbox" value="biffy234.mp3">
<input type=submit>
</form>
</body>
</html>
PLEASE IGNORE SPACES IN THE URL, HAD TO PUT THEM THERE BECAUSE THE BOARD SOFTWARE ACCUSED ME OF SPAMMING BECAUSE ITS MY FIRST POST

when i click on the submit button all i get output wise from my script is

Code:
POST /test.cgi HTTP/1.1
and nothing else

so i need to find out either

- whats wrong with my reverse engineering setup
- the syntax of POST including all details like what seperates the data from different parts of the form

thanks

mofofish
 
Old 12-05-2003, 09:37 AM   #2
RJW
Member
 
Registered: Nov 2003
Location: Australia[WA]
Distribution: FreeBSD 5.x/6.x
Posts: 146

Rep: Reputation: 15
The POST method sends two packets; the first sends the HTTP header, which notifies the server of the request and all it's attributes (such as POST data size, type etc.), and the second is the actual POST data.
 
Old 12-05-2003, 09:52 AM   #3
mofofish
LQ Newbie
 
Registered: Dec 2003
Posts: 3

Original Poster
Rep: Reputation: 0
do you mean packets as in tcp/ip packets? or do you mean a high level sort of packet? could you possible explain in greater detail of post some links, ive searched google many times looking for an answer

cheers

mofofish
 
Old 12-05-2003, 10:11 AM   #4
RJW
Member
 
Registered: Nov 2003
Location: Australia[WA]
Distribution: FreeBSD 5.x/6.x
Posts: 146

Rep: Reputation: 15
Yes, it will be a TCP/IP packet, however the request will be tunneled through the previous. So in layman, the next lot of data coming to your listening socket _should_ be the POST data.

You seem very inexperienced in the world of HTTP. The best reference I can point you towards is www.w3.org. Be aware, there is *hours* of reading here.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing out http request in php abrb220 Programming 1 11-19-2005 02:23 AM
http request mkamyar Linux - Software 5 08-30-2005 02:30 AM
HTTP::Request and CPAN support amer_58 Linux - Newbie 2 03-30-2005 11:46 AM
Authentication In A Http Request With Kerberos Ephraim Programming 0 08-03-2004 04:13 AM
viewing outcoming HTTP request?... BCE_HAMAHA Linux - Newbie 1 12-15-2002 12:02 AM


All times are GMT -5. The time now is 07:11 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration