cURL / Mailing Lists / curl-users / Single Mail

curl-users

curl mixing up url in query?

From: Alcides Carlos de Moraes Neto <alcides.neto_at_gmail.com>
Date: Wed, 25 Aug 2004 17:43:25 -0300

Hello,

First of all, I'm new to the list, hey. :) I've been having this
little problem with curl and can't find a solution anywhere, nor
anyone I know knows what the heck is going on so I was hoping someone
here would be able to help me. Soo.. here goes:

What I want to do is access this page, get the cookies it sends me,
and then get an image from this page, which has a dynamic URL, which
depends on the session cookies. So, I do this:

curl --cookie-jar cookie.ck
http://servicos.timbrasil.com.br/weblogic/torpedoWeb/smsmt.jsp >
output.htm
# using sed, I get the URL of the image
URL_IMG=$(sed -ne 's," alt="" border="0">,,;s,<img
src="servlet/imageservlet?dummy=,servlet/imageservlet?dummy=,p'
output.htm)
# OK, now that I have the image's URL, i save it using curl again
curl -b cookie --url
"http://servicos.timbrasil.com.br/weblogic/torpedoWeb/${URL_IMG}" >
img.gif

Sounds simple enough, but it won't work. On the last curl command, I
get a "Your browser sent a query this server could not understand."
BUT If instead of using
"http://servicos.timbrasil.com.br/weblogic/torpedoWeb/${URL_IMG}", I
copy and paste the url directly, and use single quotes, it will work,
example:
curl -b cookie --url
'http://servicos.timbrasil.com.br/weblogic/torpedoWeb/servlet/imageservlet?dummy=10934659809100.8029557817079662Bs38sj4sDbaw21VFzS9Z2eZ2Zj1FvthdA01iNoVgqvYtSM8BkKTp!-1473695480!175123996!7001!7002!1093465980770'
> img.gif

Weird uh? So I use -v in both cases to see what is happening, and this
is what I get:
Verbose from the command where I put the URL in directly:
* About to connect() to servicos.timbrasil.com.br port 80
* Connected to servicos.timbrasil.com.br (200.179.42.65) port 80
> GET /weblogic/torpedoWeb/servlet/imageservlet?dummy=10934663352350.6947964068594404Bs4fGD4f39ytfyIQoPZ26olleRSGstc38ajd50XZSk7zmjjzN1XN!-1473695480!175123996!7001!7002!1093466335073 HTTP/1.1

Verbose from the command using the variable $URL_IMG
* About to connect() to servicos.timbrasil.com.br port 80
* Connected to servicos.timbrasil.com.br (200.179.42.65) port 80
> GET /weblogic/torpedoWeb/servlet/imageservlet?dummy=10934663352350.6947964068594404Bs4fGD4f39ytfyIQoPZ26olleRSGstc38ajd50XZSk7zmjjzN1XN!-1473695480!175123996! HTTP/1.1!1093466335073

Note it's the same URL. But in the second case, I don't know how the
"HTTP/1.1" part of the query somehow gets crammed in the middle of the
URL? where it should be 7001!7002.

Is this a bug? I don't know what to do, if someone could please help
me it would be much appreciated.
I hope I was clear enough, if not ask away... I'm not a native english
speaker so there may be some typos here and there, sorry for that :)

Thanks in advance for all the help.

'--
Ats,

Alcides Carlos de Moraes Neto
"Victory means nothing. The fight is everything."
Received on 2004-08-25