cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: cURL does not redirect properly

From: ykhuang <yk-huang_at_prolific.com.tw>
Date: Tue, 28 Jun 2005 19:13:46 +0800

Daniel Stenberg wrote:

>
>> cURL should be noticed to redirect to second URL but it didn't. What
>> should I do to get correct response from server? Any hint is welcome.
>
>
> Many servers attempt to detect user-agent and act differently
> depending on that. Some check the referer field etc. There is no way
> for us (without insight in server details) to know what made the
> server act differently, but making the curl request look as similar as
> possible to the browser's request is often a good start.
>
Thanks for the suggestion.

But I think that user agent and referer field might not be the major issue.
I used wget on the same URL without addtional arguments like user agent
or referer url, it could get correct
response from server and redirect to the desired URL. Here's the log:

[root_at_ykhuang] # wget -S
"http://websms1.emome.net/sms/sendsms/index2.jsp?nop=emome&lang=html&subno=0919705048*&BV_SessionID=@@@@1214718987.1119956711@@@@&BV_EngineID=ccchaddemjegfifcefeceefdffidgom.0&trans_id=5235-1119956711-472&mac=410768&emomeCTime=2001/06/20
16:43:00"
Warning: wildcards not supported in HTTP.
--19:04:16--
http://websms1.emome.net/sms/sendsms/index2.jsp?nop=emome&lang=html&subno=0919705048*&BV_SessionID=@@@@1214718987.1119956711@@@@&BV_EngineID=ccchaddemjegfifcefeceefdffidgom.0&trans_id=5235-1119956711-472&mac=410768&emomeCTime=2001/06/20%2016:43:00
           =>
`index2.jsp?nop=emome&lang=html&subno=0919705048*&BV_SessionID=@@@@1214718987.1119956711@@@@&BV_EngineID=ccchaddemjegfifcefeceefdffidgom.0&trans_id=5235-1119956711-472&mac=410768&emomeCTime=2001%2F06%2F20%2016:43:00'
Resolving websms1.emome.net... done.
Connecting to websms1.emome.net[211.79.38.83]:80... connected.
HTTP request sent, awaiting response...
 1 HTTP/1.0 302 Found
 2 Server: Resin/2.1.11
 3 Expires: Tue, 20 Aug 1996 14:25:27 GMT
 4 Pragma: no-cache
 5 Location: http://websms1.emome.net/sms/sendsms/new.jsp?msg=
 6 Set-Cookie: JSESSIONID=bZMMGF-xCF8a; path=/
 7 Content-Type: text/html; charset=Big5
 8 Content-Length: 88
 9 Date: Tue, 28 Jun 2005 11:04:16 GMT
Location: http://websms1.emome.net/sms/sendsms/new.jsp?msg= [following]
--19:04:16-- http://websms1.emome.net/sms/sendsms/new.jsp?msg=
           => `new.jsp?msg=.2'
Connecting to websms1.emome.net[211.79.38.83]:80... connected.
HTTP request sent, awaiting response...
 1 HTTP/1.0 200 OK
 2 Server: Resin/2.1.11
 3 Content-Type: text/html; charset=big5
 4 Date: Tue, 28 Jun 2005 11:04:16 GMT

    [
<=>
] 39,875 100.88K/s

19:04:17 (100.88 KB/s) - `new.jsp?msg=.2' saved [39875]
Received on 2005-06-28