Menu

#302 http/https and proxy returns previous url content

closed-fixed
http (206)
7
2013-06-21
2003-03-24
No

Hello,

I encountered a problem with curl-7.10.3 on RedHat7.3. I wrote a simple
program to go to the following urls in this order:

1. http://www.baylor.edu/frankie
returns 302 and redirected to....
2. http://www3.baylor.edu/frankie
return 404 and error page
3. https://www.baylor.edu/includes/nsstyle.css
notice the "https:" at the beginning
return 200 ok
4. http://www.yahoo.com
return 200 ok but the content is actually http://www.baylor.edu/

Notice that this problem __only__ appears when curl is set
to use proxy server.

I am attach a C program to help the demonstration. Be sure to
modify and set the corresponding proxy server/port of your choice
inside the code.

thanks!
Frankie Fong
frankie@emsoftltd.com

Discussion

  • Frankie Fong

    Frankie Fong - 2003-03-24

    This is the C program that could demonstrate the problem. Please modify the file to set the proxy server/port of your choice.

     
  • Daniel Stenberg

    Daniel Stenberg - 2003-03-24

    Logged In: YES
    user_id=1110

    And you are sure that the proxy itself returns updated and
    correct data?

    Can you write up a test case for this in a style the similar
    to the tests 500 (and upwards)?

    I've never seen this happen, and I don't have any access to
    a currently running proxy so it is a bit awkward for me to
    test/repeat this...

     
  • Frankie Fong

    Frankie Fong - 2003-03-25

    Logged In: YES
    user_id=740722

    Hello,

    As of the proxy itself, I tried 2 different proxy server from
    2 different ISP connections, same problem showed up.
    As of whether the proxies returns wrong data from www.yahoo.com,
    I used 'ethereal' application to monitor the traffic between my host
    and the proxy server, it seems like the curl library never bother to
    even send out request to proxy server for www.yahoo.com

    In writing up test cases into functions CURLcode test (char* URL){},
    I am not sure this is possible because I could only repeat this problem
    only in this sequence 3 different urls using the same curl instance:
    http://www3.baylor.edu/frankie
    https://www.baylor.edu/includes/nsstyle.css
    http://www.yahoo.com

    thanks,
    frankie

     
  • Daniel Stenberg

    Daniel Stenberg - 2003-03-27
    • priority: 5 --> 7
     
  • Daniel Stenberg

    Daniel Stenberg - 2003-03-27

    Logged In: YES
    user_id=1110

    So what if you single-step through the lib in step 4, do you
    see the GET request being sent away fine?

     
  • Frankie Fong

    Frankie Fong - 2003-03-28

    Logged In: YES
    user_id=740722

    Hello,

    First of all, it seems like the actually problem can be repeated by just doing steps 3 and 4.

    That means, going to a http:// website after a https:// website through
    a proxy would somehow reuse the previous ssl connection and cause
    the problem.

    Should a new connection be made to proxy be closed if the protocol
    changes from https: to http:?!

    Anyway, I stepped into http.c at where it sends the GET request and
    the return code is OK.

    thanks!
    frankie

     
  • Daniel Stenberg

    Daniel Stenberg - 2003-03-28

    Logged In: YES
    user_id=1110

    I think I've found a problem in ConnectionExists() (in
    url.c) that makes going from HTTPS to HTTP using the same
    proxy will do bad.

    Try this patch:

    diff -u -r1.264 url.c
    --- lib/url.c 25 Mar 2003 14:23:12 -0000 1.264
    +++ lib/url.c 28 Mar 2003 11:18:30 -0000
    @@ -1272,6 +1272,11 @@
    if(!check)
    /* NULL pointer means not filled-in entry */
    continue;
    +
    + if((needle->protocol&PROT_SSL) !=
    (check->protocol&PROT_SSL))
    + /* don't do mixed SSL and non-SSL connections */
    + continue;
    +
    if(!needle->bits.httpproxy || needle->protocol&PROT_SSL) {
    /* The requested connection does not use a HTTP proxy
    or it
    uses SSL. */

     
  • Frankie Fong

    Frankie Fong - 2003-03-31

    Logged In: YES
    user_id=740722

    It solved the problem, thank you. Should I set the bug
    status to
    close myself or let you do it?!

    frankie

     
  • Daniel Stenberg

    Daniel Stenberg - 2003-03-31
    • status: open --> closed-fixed
     
  • Daniel Stenberg

    Daniel Stenberg - 2003-03-31

    Logged In: YES
    user_id=1110

    Thanks for your report and verifying the fix. The correction
    will be included in the upcoming 7.10.4 release.

    Closing this report now.

     
MongoDB Logo MongoDB