Overview
Features
Download
Documentation
Community
Add-Ons & Services

HTTPServer and IE8 not getting images

A general discussion forum.

HTTPServer and IE8 not getting images

Postby budric » 13 Nov 2010, 00:34

Hi,
I'm seeing some very weird behavior that only shows up on IE8, and no other browsers. I have a reduced it to a smallest piece of code:
Code: Select all
class GenerateImageStatic : public HTTPRequestHandler
{
    void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
    {
        response.sendFile("c:\\temp\\dummy.png", "image/png");
    }
};
HTTPRequestHandler * RequestHandlerFactory::createRequestHandler(const HTTPServerRequest& request)
{
    cout << request.getURI() << std::endl;                                         
    RegularExpression generateImage("/GenerateImageStatic.*");
    if (generateImage.match(request.getURI(), 0))
        return new GenerateImageStatic();
    else
        return 0;
}

...Web site
<script type="text/javascript">
    for (var i = 0; i < 10; i++)
    {
        var img = document.createElement("img");
        img.src = "http://myPocoServer/GenerateImageStatic?nc=" + (new Date()).getTime();
        document.body.appendChild(img);
    }
</script>

Basically IE shows the images as broken! Also POCO server does not see any request made for the images (cout statement), so I don't know how IE decides images are broken. IE cache is cleared and also that ?nc=currentDate makes sure the requests are for fresh images. If you copy the image URL and just navigate to it in a new TAB in IE, the image loads, and then refresh the old tab, all the other images load all of a sudden! I don't get the problem with Chrome or Firefox. So POCO HTTPServer and my code work in those cases.

Now the reason I think it's POCO related is because if I use this URL:
Code: Select all
img.src = "http://maps.google.com:80/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=14&size=512x512&maptype=roadmap&markers=color:blue|label:S|40.702147,-74.015794&markers=color:green|label:G|40.711614,-74.012318&markers=color:red|color:red|label:C|40.718217,-73.998284&sensor=false&nc=" + (new Date()).getTime();

which goes to google, everything works...

Is there anything you can think of that can cause this problem?
budric
 
Posts: 24
Joined: 13 May 2009, 17:14

Re: HTTPServer and IE8 not getting images

Postby budric » 15 Nov 2010, 18:43

I implemented the same simple server using Java servlet and all requests come through and work. I'm currently trying to dig through POCO HTTPServer code to figure out what would cause the connection to be dropped based on headers. Because basically some IE 8 requests are not getting to the request handler factory.
budric
 
Posts: 24
Joined: 13 May 2009, 17:14

Re: HTTPServer and IE8 not getting images

Postby guenter » 16 Nov 2010, 09:15

Probably it's a problem with persistent connections. Make sure that when sending a response in your request handler you always either set the content length in the response header, or you use chunked transfer encoding (response.setChunkedTransferEncoding(true)). Otherwise, the browser may get confused about the current state of the connection. Note that response.sendFile() should take care of this automatically.
guenter
 
Posts: 1112
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: HTTPServer and IE8 not getting images

Postby budric » 16 Nov 2010, 17:26

Yes, what worries me is that IE connections are not reaching my handler in the first place for me to change any of the header information like disable keep-alive or chunked transfer encoding (tried with and without). I have placed a break point in TCPServer::run() and it is not reached! IE is either not making the requests or they are not getting through (note that on other browsers that breakpoint is triggered, so it's not a silly mistake with break points and source not available to IDE).

I'm worried that the 1 thread that's using select() to accept socket connection is missing a connection because it's busy doing something else. For example select() timeout has been exceeded, now it's out of select(). I don't know enough about winsock to know if that's a possibility or if winsock queues the requests...

I have also run Net/Samples/HTTPLoadTest against HTTPTimeServer with 1000 threads and 1 repetitions per thread. I get a lot of "No message received" "connection reset by peer". Ok so I don't think IE is sending 1000 threads at the server...still I'm out of ideas.

I've also tried boost/asio http server sample 3. Same problems in IE. I don't know how that one works, whether it's using select()
budric
 
Posts: 24
Joined: 13 May 2009, 17:14

Re: HTTPServer and IE8 not getting images

Postby guenter » 16 Nov 2010, 19:09

Probably something is wrong with your IE setup or installation. I regularly test POCO-based web apps with IE7-IE8 and haven't experienced any issues.
guenter
 
Posts: 1112
Joined: 11 Jul 2006, 16:27
Location: Austria


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest