cURL / Mailing Lists / curl-users / Single Mail

curl-users

[ curl-Bugs-558888 ] Wrong host when fallowing location

From: <noreply_at_sourceforge.net>
Date: Tue, 21 May 2002 14:43:14 -0700

Bugs item #558888, was opened at 2002-05-21 14:43
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=100976&aid=558888&group_id=976

Category: libcurl
Group: bad behaviour
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Daniel Stenberg (bagder)
Summary: Wrong host when fallowing location

Initial Comment:
Hi.

Back with this bug which still exists in 7.9.7 .

If
you use a proxy you and curl has to fallow a location to a new host
the "Host" header in the new request remains
unchanged.

Sample program:
#include
<curl/curl.h>
#include <curl/types.h>
#include
<curl/easy.h>

size_t ignore( void *ptr, size_t size,
size_t
         nmemb, void *stream)
{
        return
nmemb*size;
}
void main()
{
  CURL *curl;
  
curl_global_init(CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32);

 
 printf("Version: %s\n",curl_version( ));

  curl =
curl_easy_init();

  if(curl)
  {
    
curl_easy_setopt(curl, CURLOPT_URL,
"http://chat.msn.com/chatroom.msnw?rm=Singles&cat=RM");
        curl_easy_setopt(curl,
CURLOPT_VERBOSE, 1);
        curl_easy_setopt(curl,
CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE
5.0; Windows 98)");
        curl_easy_setopt(curl,
CURLOPT_WRITEFUNCTION,
ignore);
        curl_easy_setopt(curl, CURLOPT_PROXY ,
"193.231.9.3:3128"); /* proxy at roedu
*/
        curl_easy_setopt(curl, CURLOPT_FAILONERROR ,
1);
        curl_easy_setopt(curl,
CURLOPT_FOLLOWLOCATION,
1);
        
        printf("%d\n",curl_easy_perform(curl));

    

        curl_easy_cleanup(curl);
  
}
}

Output:
Version: libcurl 7.9.7 (OpenSSL
0.9.6d)
* About to connect() to 193.231.9.3:3128
*
Connected to 193.231.9.3 (193.231.9.3) port 3128
> GET
http://chat.msn.com/chatroom.msnw?rm=Singles&cat=RM
HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 5.0;
Windows 98)
Host: chat.msn.com
Pragma: no-
cache
Accept: image/gif, image/x-xbitmap, image/jpeg,
image/pjpeg, */*

* HTTP/1.0 proxy connection set to
keep alive!
* Connection #0 left intact
* Follows
Location: to new URL:
'http://login.passport.com/login.srf?lc=1033&id=
2260&ru=http%3A%2F%2Fchat%2Emsn%2Ecom%2Fchatroom%2Emsnw%3Frm%3DSingles%26cat%3DR
M%26pps%3Dk&tw=43200&kv=2&ct=1022017339&kpp=3&ver=2.1.0077.1&tpf=edac197b592d1d5
bcf8bc496a5ddad6f'
*
Re-using existing connection! (#0)
* Connected to [re-used]
(193.231.9.3) port 3128
> GET
http://login.passport.com/login.srf?lc=1033&id=2260&ru=http%3A%2F%2Fchat%2
Emsn%2Ecom%2Fchatroom%2Emsnw%3Frm%3DSingles%26cat%3DRM%26pps%3Dk&tw=43200&kv=2&c
t=1022017339&kpp=3&ver=2.1.0077.1&tpf=edac197b592d1d5bcf8bc496a5ddad6f
HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 5.0;
Windows 98)
Host: chat.msn.com
Pragma: no-
cache
Accept: image/gif, image/x-xbitmap, image/jpeg,
image/pjpeg, */*

* HTTP/1.0 proxy connection set to
keep alive!
* Connection #0 left intact
0
* Closing
connection #0

Daniel

----------------------------------------------------------------------

You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=100976&aid=558888&group_id=976

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
Received on 2002-05-21