Re: fsockopen and HTTP/1.1???

From: Date: Sun, 30 Jun 2002 22:56:19 +0000
Subject: Re: fsockopen and HTTP/1.1???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-104769@lists.php.net to get a copy of this message
In article <20020627092803.25191.qmail@pb1.pair.com> , alex@netflex.nl (Alex Elderson) wrote: >open connection to webapps.hardinxveld.netflex.nl oke > > get / done > get / failt > >Closing connection to webapps.hardinxveld.netflex.nl oke > > >The problem is the "Connection: Close\n\n" header. The webserver close the >connection after the first request, if i remove >the "Connection: Close\n\n" header the first fgets($web_conn, 128) command >will never ends. > >It's running on winXP apache 2.0.36 PHP 4.2.1 (test server) from the shell First of all, you need to be aware that a web-server is not required to respond using HTTP/1.1 just because you asked for it... If the web-server don't feel like doing HTTP/1.1, it can fall back to HTTP/1.0 in its response. [At least, that's how I understand it...] So this whole multiple-file thingie may not work if, as I suspect, HTTP/1.0 doesn't support multiple files in one connection. Secondly, I think it's probably just a Bad Idea (tm) to try to force HTTP to do 2 files in one connection anyway -- It just complicates your life, and is giving you headaches already... How much worse will it get in a year? That said, I suspect that fgets() is looking for a particular character all by itself on a line that determines the end of a file. Control-D, possibly. So, *MAYBE* sending a chr(4) (control-D) after each file will work... Even if it does work, I still think it's a Bad Idea -- I'm not sure fgets() is DOCUMENTED to use the Control-D, so there's no guarantee it will keep working. More headaches next week/month/year. Disclaimer: I'm not promising any of this is correct -- mostly guess-work here. -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#104769) next »