php3-list | 199807

RE: [PHP3] How to stop stopping? From: Brian Schaffner (BSchaffner <email protected>)
Date: 07/29/98

This really isn't that complicated at all (provided you leave out the
SSL part). Essentially it works like this:

Server(apache) Client(netscape)
----------------------------------------
1) Listens for connection
                                        2) Opens socket to server's
                                        listening address:port
3) TCP Wrappers (if enabled)
4) accepts connection
                                        5) Send request:
                                        GET /index.phtml HTTP/1.0
6) (Simplified)
    Apache checks authent.
    Maps url to physical file
    Checks for handler on file's
    mime type (application/x-httpd-php3 .phtml)
    passes request through the php parser
    sends result to client
                                        7) reads response
8) closes connection
                                        9) closes connection
                                        10) parses html and displays
page
                                        11) reconnects to server(s) as
                                        necessary for graphics, etc...

You can verify this by connecting to a server using telnet.
Just type something like:

        telnet www.php.net 80

After it connects, type:

        GET / HTTP/1.0

Unless you're behind a firewall, in which case you do:

        telnet firewall.mycompany.com 80

        GET http://www.php.net/ HTTP/1.0

When the user presses "STOP", it simply closes the connection, forcing a
SIGPIPE which means that the server tried to write to a PIPE that had no
reader. I'm not sure of the entire details, but apache then starts the
shutdown process on the connection - which may or may not include a
shutdown on the part of PHP - I'm not sure about this - Rasmus would
know more.

Hopefully this over-simplified explanation will help. Just keep in mind
that what I've illustrated shows only one particular "layer". The lower
layers are transparent to the upper layers and therefore insignificant
and mostly inconsequential to them. For example, TCP guarentees delivery
of packets, therefore the client (web browser) doesn't need to get an
ACK (ack=acknowledgement) from the Apache server once it sends the
request - instead it sits back and waits for the results. TCP will keep
trying to get the request to server. This doesn't mean the browser can't
"time-out" when sending a request or connecting to a server - it simply
means that if the client wants - it can wait infinitly (or until the
highest possible integer the timeout allows) before timing out.
  
Brian Schaffner, Manager of Internet Services
ACCENT Marketing Services, Inc.
 

> -----Original Message-----
> From: lynch <email protected> [mailto:lynch <email protected>]
> Sent: Wednesday, July 29, 1998 3:54 PM
> To: Rasmus Lerdorf; Carl Drinkwater
> Cc: PHP3 Mailing List
> Subject: Re: [PHP3] How to stop stopping?
>
>
> At 8:06 AM 7/29/98, Rasmus Lerdorf wrote:
>
> >If you don't send any output during the critical parts of
> your script then
> >Apache has no way of knowing that the user hit his STOP
> button. And yes,
> >PHP still cleans up after itself.
>
> So... if I'm understanding this correctly...
>
> The only time a client can "talk to" a server, after
> connecting, is when
> the server decides to send something to a client?...
>
> Seems really weird to me, but it's good to have a better
> understanding of
> how this all works.
>
> Not sure where to put it, but an annotated diagram/flow-chart
> of the whole
> browser/http/ssl/php/cgi/module/tcp interaction would be a
> really nifty
> thing to see on the php website, imho...
>
> Actually... I suspect it would get so complex so fast it
> would be its own
> mini-site, but maybe it's all easier than I think. Yeah, right. :-)
>
> The question is, of the people who actually understand the
> big picture, who
> has enough time to do it? Oh, never mind. :-(
>
> --
> --
> -- "TANSTAAFL" Rich lynch <email protected>
>
>
>
> --
> PHP 3 Mailing List http://www.php.net/
> To unsubscribe send an empty message to php3-unsubscribe <email protected>
> To subscribe to the digest list: php3-digest-subscribe <email protected>
> For help: php3-help <email protected> Archive:
> http://www.php.net/mailsearch.php3
>
>

--
PHP 3 Mailing List   http://www.php.net/
To unsubscribe send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest list:  php3-digest-subscribe <email protected>
For help: php3-help <email protected>  Archive:  http://www.php.net/mailsearch.php3