WinInet - file size retrieval is not working too hot

This is a discussion on WinInet - file size retrieval is not working too hot within the Windows Programming forums, part of the Platform Specific Boards category; I have this little piece of code that gets file size of any http resource: hConnect = InternetConnect(hInternet, ServerName, INTERNET_DEFAULT_HTTP_PORT, ...

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    2

    WinInet - file size retrieval is not working too hot

    I have this little piece of code that gets file size of any http resource:


    hConnect = InternetConnect(hInternet, ServerName, INTERNET_DEFAULT_HTTP_PORT, "", "", INTERNET_SERVICE_HTTP, 0, 0);

    hReq = HttpOpenRequest(hConnect, "HEAD", ResourceName, NULL, "", (LPCSTR *) types, 0, 0);

    HttpSendRequest(hReq, NULL, 0, NULL, 0);

    HttpQueryInfo(hReq, HTTP_QUERY_CONTENT_LENGTH, buf, (LPDWORD)&s, 0);


    And it works. Usually. Except on this one guy's computer, where HttpSendRequest returns with ERROR_HTTP_INVALID_SERVER_RESPONSE error.

    Personally, I think antiviral software jumbles the request somehow (we are both in the same subnet, so network errors are unlikely), but it is not an excuse.

    Does anyone have any ideas on how to make this code work? or a different approach maybe? My gratitude will be enormous =)

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Any chance you can actually see WHAT the response is from the server?

    I take it you haven't got any firewall issues?

    --
    Mats

  3. #3
    Registered User
    Join Date
    Aug 2007
    Posts
    2
    Damn, it never occured to me to actually check =) Still, htmlSendRequest() blocks for about a minute, so there's a good chance it just timeouts with no response.

    Firewall's ok, the two PC's are pretty much identical, the only noticeable difference is antiviruses, I use McAffe, the guy who has problems use Kaspersky.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  2. Invalid conversion from 'void*' to 'BYTE' help
    By bikr692002 in forum C++ Programming
    Replies: 9
    Last Post: 02-22-2006, 10:27 AM
  3. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  4. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 01:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21