cURL / Mailing Lists / curl-users / Single Mail

curl-users

session hangs, suppress "Expect: 100-continue"?

From: clemens fischer <ino-news_at_spotteswoode.dnsalias.org>
Date: Fri, 06 Oct 2006 21:44:37 +0200

'curl --version'
curl 7.15.5 (i386-portbld-freebsd6.2) libcurl/7.15.5 OpenSSL/0.9.7e zlib/1.2.2 libidn/0.6.7
Protocols: tftp ftp telnet dict ldap http file https ftps
Features: IDN IPv6 Largefile NTLM SSL libz

Is there a way to suppress command line curls sending an "Expect;
100-continue" header when using the `-F' or `--form-string' options?

I made a script extracting data needed to auto-submit the verification
form sent from spamcop.net after sending them spam emails. this
verification is mandatory: the free spamcop service requires users to
look at their automatic analyses in case people accidentally send "good"
emails. in my setup this cannot happen, so this verification is
a nuisance to me.

a byte-by-byte comparison between the data POSTed by "elinks" (text
browser, which works) and the script results in one essential
difference: curl sends a header "Expect: 100-continue". the
conversation with the remote host seems to work, but at the end the
transaction doesn't complete (long lines edited for brevity):

  $ spamcop-verify.awk < /home/www/webfs/spamcop-sc-1.html
  curl -v --trace-ascii - -s -A 'Lynx/2.8.5 (Compatible; ELinks)'
  -e 'Referer: http://www.spamcop.net/sc'
  --form-string 'action=flexsend'
  ...
  --form-string 'sc_comment3=http%3A%2F%2F...' http://www.spamcop.net/sc
  == Info: About to connect() to www.spamcop.net port 80
  == Info: Trying 212.105.197.136... == Info: connected
  == Info: Connected to www.spamcop.net (212.105.197.136) port 80
  => Send header, 277 bytes (0x115)
  0000: POST /sc HTTP/1.1
  0013: User-Agent: Lynx/2.8.5 (Compatible; ELinks)
  0040: Host: www.spamcop.net
  0057: Accept: */*
  0064: Referer: Referer: http://www.spamcop.net/sc
  0091: Content-Length: 2651
  00a7: Expect: 100-continue

here's the "Expect:" header.

  00bd: Content-Type: multipart/form-data; boundary=--------------------
  00fd: --------d2f66fede792
  0113:
  => Send data, 2651 bytes (0xa5b)
  0000: ------------------------------d2f66fede792
  002c: Content-Disposition: form-data; name="action"
  005b:
  005d: flexsend
  ...
  0a2d: ------------------------------d2f66fede792--
  <= Recv header, 23 bytes (0x17)
  0000: HTTP/1.1 100 Continue

... and this is the servers response. the session hangs from now on
until timeout:

  <= Recv header, 40 bytes (0x28)
  0000: Expires: Fri, 06 Oct 2006 19:15:02 GMT
  <= Recv header, 46 bytes (0x2e)
  0000: Cache-Control: max-age=0, no-cache, no-store
  <= Recv header, 18 bytes (0x12)
  0000: Pragma: no-cache
  <= Recv header, 37 bytes (0x25)
  0000: Date: Fri, 06 Oct 2006 19:15:02 GMT
  <= Recv header, 24 bytes (0x18)
  0000: Connection: keep-alive
  == Info: Empty reply from server
  == Info: Connection #0 to host www.spamcop.net left intact
  == Info: Closing connection #0

also, given the following submit buttons:

  <input type="submit" value="Send Spam Report(s) Now">

  <input type="submit" name="preview" value="Preview Reports">
  <input type="submit" name="cancel" value="Cancel">

i know for submitting thru "preview" or "cancel" i must send their
name/value pairs as "-F name=value", but i don't use them. is there any
requirement to send form-data for the first case (type "submit"
value="Send Spam Report(s) Now")?

regards, clemens
Received on 2006-10-06