Solved

Posting by telneting to port 80

Posted on 1997-05-27
2
170 Views
Last Modified: 2013-12-25
One of my cgi scripts telnet's to port 80 of a server with an intent to POST something..
The script name is post.cgi and the variable that needs to be passed is "numb"
How would I post the numb string to post.cgi
First I try telneting to port 80
then I type "POST /cgi-bin/post.cgi HTTP/1.0"

What do I do next to post numb=1 to post.cgi?

Thanks
0
Comment
Question by:chiefarcher
2 Comments
 
LVL 2

Accepted Solution

by:
mkornell earned 100 total points
Comment Utility
You output to telnet should look like:

----begin output----
POST /cgi-bin/post.cgi HTTP/1.0
Content-length: ?????

numb=some_url_encoded_data
----end output----

(Of course, don't send the lines starting with '----' :-)

After the initial POST line, you need to send appropriate header lines, of the form "Header: header information"

You really, _really_ should send a Content-length: header.  This tells the server how much data (in bytes) you are going to be sending.  Some servers require this to be set, and others, if it is not set, will read all passed.

Other headers you might want to set are User-Agent: and Host:.

After the header lines, you need to send a blank line. This tells the server on the other end that you've finished sending headers and are about to send data.

Then, send your POST data. How the data will be interpreted is totally up to the receiving end, but typically it will be expecting a name1=value1&name2=value2 format.  (Sounds like this is case for your needs.)

For a full description of the HTTP protocol, refer to RFC 1945 (HTTP/1.0) or RFC 2068 (HTTP/1.1).  These can be found at http://info.internet.isi.edu/1/in-notes/rfc

Just curious: Is your post.cgi script written in Perl? If it is, there are Perl libraries that will take care of all the HTTP overhead for you.  Check out the libwww bundle at CPAN ( http://www.perl.org/CPAN ).

--mark;
0
 

Author Comment

by:chiefarcher
Comment Utility
Beautiful
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now