How do I POST a multipart request?

Discussion in 'Ruby' started by Roy Varghese, Sep 3, 2003.

  1. Roy Varghese

    Roy Varghese Guest

    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
    Roy Varghese, Sep 3, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. LD

    multipart/form-data Post

    LD, Aug 27, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    15,265
    navyjax2
    Sep 23, 2008
  2. Abe Simpson
    Replies:
    2
    Views:
    2,039
    Abe Simpson
    Dec 7, 2005
  3. Jeff Shannon
    Replies:
    4
    Views:
    1,020
    Wade Leftwich
    Jul 21, 2004
  4. dhtml
    Replies:
    0
    Views:
    3,273
    dhtml
    Jul 14, 2008
  5. Replies:
    1
    Views:
    391
Loading...

Share This Page