cURL / Mailing Lists / curl-users / Single Mail


How do I do this?

From: Chris Glon <>
Date: Wed, 15 Jun 2005 10:41:08 -0700 (PDT)

This is my 1st posting. I have been using cURL successfully for almost 2 years. It is a great product.
I am running cURL on Sun HW under Solaris:
curl 7.10.3 (sparc-sun-solaris2.8) libcurl/7.10.3 OpenSSL/0.9.6g zlib/1.1.3

I am having trouble with sending the following GET request. The GET request is supposed to be made of a 128 character string (right space padded) followed immediately by the contents of a PDF file, i.e binary data.
I tried it many ways but to no avail. At this stage, I am encountering two issues: 1- An ampersand is placed between the string and the file contents.2- When doing a get, it seems that cURL uploads the contents up to the very first newline only (See trace below).
Here is my latest try:
/opt/bin/curl -G -v --trace-ascii - --max-time 15 -o test.out --url http://xx.xx.80.249:19710 -d "page=1&type=g&scale=100&width=0&height=0&length=6497
                                                                    " --data-binary @O205893.pdf

Here is the trace data:
== Info: About to connect() to xx.xx.80.249:19710
== Info: Connected to xx.xx.80.249 (xx.xx.80.249) port 19710
=> Send header, 354 bytes (0x162)
0000: GET /?page=1&type=g&scale=100&width=0&height=0&length=6497
0080: &%PDF-1.1 HTTP/1.1
0099: User-Agent: curl/7.10.3 (sparc-sun-solaris2.8) libcurl/7.10.3 Op
00d9: enSSL/0.9.6g zlib/1.1.3
00f2: Host: xx.xx.80.249:19710
010c: Pragma: no-cache
011e: Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
  % Total % Received % Xferd Average Speed Time Curr.
                                 Dload Upload Total Current Left Speed
  0 0 0 0 0 0 0 0 --:--:-- 0:00:15 --:--:-- 0== Info: Operation timed out with 0 out of -1 bytes received
  0 0 0 0 0 0 0 0 --:--:-- 0:00:15 --:--:-- 0
== Info: Connection #0 left intact
curl: (28) Operation timed out with 0 out of -1 bytes received
== Info: Closing connection #0
Additional comments:
Here are the 1st 3 lines of the PDF file:
1 0 obj

I tried to use the "<" instead of the "@" but it doesn't seem to work.
I had to use the -G because I could not build a request that contained the 128 char string and the file upload in the same request.
What I have been wondering is wether I should (can?) send two requests: The 128 char string, keep the connection opened, then send in a 2nd step the actual file contents.
What am I doing wrong? Thanks for your help.
Received on 2005-06-15