Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#18 bug in UrlStream

Common_Libraries
closed
David Sugar
Library (32)
6
2006-06-11
2006-03-04
Anonymous
No

I'm getting an error downloading this page:
http://www.sellshareware.com/ProgramInfo.asp?
PrID=40660

This page calls a redirect and at the second loop
on "retry:" tag strchr returns NULL

(url.cpp line 525)

setString(host, sizeof(host), url);
hp = strchr(host, '/'); // here strchr returns NULL
while(*hp == '/') // crash here
++hp;

Is there a fix?

Discussion

  • David Sugar
    David Sugar
    2006-06-11

    • status: open --> closed
    • labels: --> Library
    • milestone: --> Common_Libraries
    • priority: 5 --> 6
    • assigned_to: nobody --> dyfet
     
  • David Sugar
    David Sugar
    2006-06-11

    Logged In: YES
    user_id=217

    First, as a general note, I think all the ::send(...) should
    use MSG_NOSIGNAL, as signal handling is problematic from
    threading and portability standpoint.

    I solved this specific issue, the "Location:" entry returned
    has no /path:

    HTTP/1.1 302 Object moved
    Date: Sun, 11 Jun 2006 01:08:21 GMT
    X-Powered-By: ASP.NET
    Location: CustomView.asp?PrID=40660&AfID=0&PageID=1
    Content-Length: 121
    Content-Type: text/html
    Set-Cookie: ASPSESSIONIDAQBDATAT=CDPHLEHCCGIHADBBGMLNADBP;
    path=/
    Cache-control: private

    I solved this for now with:

    setString(host, sizeof(host), url);
    reformat:
    hp = strchr(host, '/');
    if(!hp)
    {
    host[0] = '/';
    setString(host + 1, sizeof(host) - 1, url);
    goto reformat;
    }

    Which assures if we get back a XXX path on location, we at
    least make it a /XXXX path. Perhaps the original prefix
    should be restored as well.

    This and using MSG_NOSIGNAL will be part of the next release.