curl-users
Re: How do I do this?
Date: Thu, 28 Jul 2005 16:44:09 -0700 (PDT)
With some delays, we followed your advice and upgraded to 7.12. But still no luck...This is frustrating since we are using cURL very successfully in other areas.
So, I will explain what we are trying to do:
We have an image generator/server that will take a PDF file as input and return a raster image (e.g. a GIF file). Some parameters are passed as a 128 byte header in front of the binary data to specify things like which page to convert, what file output type, etc... The header is padded with spaces to reach the 128 byte length. The request needs to be closed with an EOF.
So, say we want to generate a gif image from page 1 of a PDF file called O205893.pdf that has a 6497 byte lenght.
The header could look like this:
task=image&page=1&mode=gc&scale=100&unique=123456789&length=6497
This is the cURL command we are trying:
/usr/local/bin/curl -v --trace-ascii - --max-time 15 -o testxrip.out --url "http://xx.xx
.1.170:19710/?task=image&page=1&mode=gc&scale=100&unique=123456789&length=6497
" --data-binary @O205893.pdf -d "EOF"
Here is the trace:
== Info: About to connect() to xx.xx.1.170 port 19710
== Info: Trying xx.xx.1.170... == Info: connected
== Info: Connected to xx.xx.1.170 (xx.xx.1.170) port 19710
=> Send header, 6861 bytes (0x1acd)
0000: POST /?task=image&page=1&mode=gc&scale=100&unique=123456789&leng
0040: th=6497
0080: HTTP/1.1
0092: User-Agent: curl/7.12.2 (sparc-sun-solaris2.8) libcurl/7.12.2 Op
00d2: enSSL/0.9.7g zlib/1.1.3
00eb: Host: xx.xx.1.170:19710
0104: Pragma: no-cache
0116: Accept: */*
0123: Content-Length: 6497
0139: Content-Type: application/x-www-form-urlencoded
016a:
016c: %PDF-1.1.%....
017c: 1 0 obj.<<./Type /XObject./Subtype /Image./Name /Im1./Width 38./
01bc: Height 38./BitsPerComponent 8./ColorSpace /DeviceRGB./Length 125
01fc: 3./Filter /DCTDecode.>>.stream
[ ... snip ...]
1abe: `..............
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0== Info: Empty reply from server
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
== Info: Connection #0 to host xx.xx.1.170 left intact
curl: (52) Empty reply from server
== Info: Closing connection #0
When using cURL prior version (7.10.03), I had the following showing the number of bytes transferred:
% Total % Received % Xferd Average Speed Time Curr.
Dload Upload Total Current Left Speed
100 6497 0 0 100 6497 0 288k 0:00:00 0:00:00 0:00:00 288k== Info: Empty reply from server
100 6497 0 0 100 6497 0 264k 0:00:00 0:00:00 0:00:00 0
In fact, the question is: Does cURL do what I think it should be doing, or am I missing something? Am I actually sending Header (128 bytes) + Body (PDF File) + EOF to the server?
Thanks for looking into this!
Daniel Stenberg <daniel-curl_at_haxx.se> wrote:
On Wed, 15 Jun 2005, Chris Glon wrote:
> 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
You should consider upgrading. curl has gotten a LOT better since that
version.
[ ... snip ...]
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2005-07-29