cURL / Mailing Lists / curl-users / Single Mail

curl-users

POST to IIS/5.0 fails

From: <Jeromme_Lawler_at_xtoenergy.com>
Date: Tue, 18 Feb 2003 15:43:12 -0600

I am having the same issue. Here is my syntax:

curl -F "File1"="C%3A%5Cgood.exe" -F "Action"="Upload+the+file"
http://172.17.17.217/scripts/u.asp

I believe that the problem lies in the Content Length and/or Boundary Info.
Here is an example of the Internet Explorer POST:

POST /scripts/u.asp HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/vnd.ms-excel, application/msword, */*
Referer: http://172.17.17.217/scripts/u.asp
Accept-Language: en-gb,en-us;q=0.5
Content-Type: multipart/form-data; boundary
=---------------------------7d35eb29076c
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Q312461)
Host: 172.17.17.217
Content-Length: 1713646
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: ASPSESSIONIDGQQQQKEC=BMLPLFCAAHGMDLEGDOKCCHAC;
ASPSESSIONIDGGQGQTAC=HBBFGLDBDMBEPAGALJLKHBJM

Now compare this to the cURL POST:

POST /scripts/u.asp HTTP/1.1
User-Agent: curl/7.10.3 (win32) libcurl/7.10.3
Host: 172.17.17.217
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
Content-Length: 237
Expect: 100-continue
Content-Type: multipart/form-data; boundary=curlttvbxkjH32pkr7RJm68M3PNcE3u

If you look at the .ASP code (attached), It seems to be parsing boundary
for "--".

Any idea how to get cURL to more closely mimic Internet Explorer behavior
in this scenario?

                                                                   
                                                                   
                                                                   
                                                                   
                                                                   
   On Thu, 31 Oct 2002, Stephan Burlot wrote:
                                                                   
                                                                   
> Using curl 7.10.1 on MacOSX 10.2.1, I'm unable to POST a
   file to a IIS/5.0
> server.
>
> using curl -v -F file_to_upload=@filename -F submit=OK
> http://62.110.77.152/upload/upload.asp, I get an error from
   the server,
> telling me I have to add enctype=multipart/form-data to send
   the file. Of
> course, sending via MS Explorer on the Mac works fine
   (Omniweb doesnt).
                                                                   
                                                                   
   Ok, then it seems as if the receiving end is really picky on
   some fields it
   really shouldn't bother about.
                                                                   
                                                                   
> Is this a server issue, ie are there some IIS gurus here
   able to confirm
> this, or is my curl command incomplete? I checked using
   tcpdump and curl
> doesnt seem to send less headers than Explorer, so I'm lost.
                                                                   
                                                                   
   The receiver is probably not really strictly IIS, but some
   kind of
   program/script running on IIS. You're probably better off
   asking the ASP
   author for details. Or by trying harder to make it look even
   more as a IE
   post.
                                                                   
                                                                   
> In the end, I want to send files programmatically, so any
   hint in this
> direction will be gladly accepted.
                                                                   
                                                                   
   I remember once, the stupid receiving script rejected every
   attempted file
   upload that had a file name that didn't start with
   "[LETTER]:"... It really
   is impossible to tell. You have to keep on guessing and
   trying, or ask the
   admins.
                                                                   
                                                                   

(See attached file: upload.asp)(See attached file: upload.inc)

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

Received on 2003-02-18