cURL / Mailing Lists / curl-users / Single Mail

curl-users

RE: How do I do this?

From: Chris Glon <chrisglon_at_yahoo.com>
Date: Thu, 16 Jun 2005 10:59:35 -0700 (PDT)

Thanks for your reply.
 
A couple of comments:
- I need to upgrade to 7.14.0, but I was impatient ;-)
- I had tried what you suggest. However, I am getting the following error:
== Info: gethostbyname_r(2) failed for xx.xx.80.249:19710?page=1&type=g&scale=100&width=0&height=0&length=6497 That is the reason I had to go with -G and then specify the --url. Hence my using the -d

- Btw, I had tried this as a POST too. But it seems that I was not getting the entire file to upload.
- I could never get the "<" to work (instead of "@")
- The --data-binary should let me upload anything, isn't it?

"Roth, Kevin P." <kproth_at_mapllc.com> wrote:
The -G flag is intended for those situations where you're ONLY doing a
GET, yet you want to use the -d parameter to attach your parameters,
possibly one at a time, and let curl put them together for you. By
specifying that string, you've instructed cURL to turn your
--data-binary (or --data, or --data-ascii) file into a GET parameter.

In your case, I believe you need something a little closer to:

/opt/bin/curl -v --trace-ascii - --max-time 15 -o test.out
--url
"http://xx.xx.80.249:19710?page=1&type=g&scale=100&width=0&height=0&leng
th=6497
"
--data-binary @O205893.pdf

The keys are:

1. Leave off the -G

2. Include the "get" parameters as part of the URL string.

3. Continue using --data-binary with the "@" in front as you suspected.

- Kevin

p.s., Daniel - would a (non-ascii-encoded) binary file ever make sense
embedded in the URL as is happening in this case? If not, you might
consider making --data-binary ignore the -G flag and let it do a
MIME-encoded POST no matter what.

________________________________
From: curl-users-bounces_at_cool.haxx.se
[mailto:curl-users-bounces_at_cool.haxx.se] On Behalf Of Chris Glon
Sent: Wednesday, June 15, 2005 1:41 PM

> 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

> 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.
Received on 2005-06-16