How do I POST a multipart request?

R

Roy Varghese

Hello

I am writing a script to send a POST request to a webserver.
The request consists of the following:

POST /someurl/servlets/SomeServlet

Host: myname
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US;
rv:1.3b)
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Encoding: none
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: close
Referer: http://someserver/servlets/servlet1
Cookie: USERID=test
Content-Type: multipart/form-data;
boundary=---------------------------1896019318556346621028960807
Content-Length: 1380

-----------------------------1896019318556346621028960807
Content-Disposition: form-data; name="name"

Roy
-----------------------------1896019318556346621028960807
Content-Disposition: form-data; name="age"

0
-----------------------------1896019318556346621028960807
Content-Disposition: form-data; name="address"

12 Street
-----------------------------1896019318556346621028960807

How can I use Ruby to send this request?
The Net::HTTP.post method takes only the POST path and a hash of the
headers, whereas some of the content of the request I have to send,
cannot be hashed.


Thx
Roy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top