Hello everyone, I'm messing with a tiny webserver. A problem arises when I access this webserver with Firefox. When the webserver is done sending all of the data to Firefox, the last send(), at which should release -1 if an error occured:
http://www.die.net/doc/linux/man/man3/send.3.html
Doesn't, and instead it closes my application :(
The webserver does not close, everything goes OK, when I access the webserver with Konqueror or Epiphany web browsers. For some reason Firefox likes to kill the webserver with the send() function!
Here's a code snip:
Here's the overall output:Code:puts( "*** WE'RE GOING TO MAKE IT!!" ); assert((z=send(cs,b,strlen(b),0))!=-1); puts( "*** PHEW!!" ); printf("Sent %d bytes\n",z);
Notice the end where the webserver screams: "WE'RE GOING TO MAKE IT!!", well, they didn't make it :(....*cries*....Code:HTTP server running, please visit http://localhost:60001 Press a key to exit... Foreign User: 127.0.0.1 Received: /***************************************************** GET / HTTP/1.1 Host: localhost:60001 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8b2) Gecko/10134297 Firefox/1.0.4 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive \***************************************************** *** WE'RE GOING TO MAKE IT!! *** PHEW!! Sent 17 bytes *** WE'RE GOING TO MAKE IT!! *** PHEW!! Sent 25 bytes *** WE'RE GOING TO MAKE IT!! *** PHEW!! Sent 2 bytes *** WE'RE GOING TO MAKE IT!! *** PHEW!! Sent 59 bytes *** WE'RE GOING TO MAKE IT!! *** PHEW!! Sent 67 bytes *** WE'RE GOING TO MAKE IT!! *** PHEW!! Sent 28 bytes *** WE'RE GOING TO MAKE IT!! *** PHEW!! Sent 22 bytes Foreign User: 127.0.0.1 Received: /***************************************************** GET /favicon.ico HTTP/1.1 Host: localhost:60001 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8b2) Gecko/10134297 Firefox/1.0.4 Accept: image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive \***************************************************** *** WE'RE GOING TO MAKE IT!! *** PHEW!! Sent 17 bytes *** WE'RE GOING TO MAKE IT!! *** PHEW!! Sent 25 bytes *** WE'RE GOING TO MAKE IT!! *** PHEW!! Sent 2 bytes *** WE'RE GOING TO MAKE IT!! *** PHEW!! Sent 59 bytes *** WE'RE GOING TO MAKE IT!! *** PHEW!! Sent 67 bytes *** WE'RE GOING TO MAKE IT!!
Here's the updated webserver code.
http://killall.no-ip.org/Programming...ocktail_sauce/
Does anybody have any hints of why send() kills the webserver unexpectively at the very end of sending data to Firefox ? :(
PS: Tell me if I should post all of the code onto the forum in text.



LinkBack URL
About LinkBacks


