Re: New classes

From: Date: Mon, 11 Feb 2002 07:47:39 +0000
Subject: Re: New classes
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-4580@lists.php.net to get a copy of this message
On Thu, 2002-02-07 at 14:50, Richard Heyes wrote: > "Stig S. Bakken" <ssb@alltheweb.com> wrote: > > > On Sun, 2002-02-03 at 15:59, Richard Heyes wrote: > > > > I don't think HTTP_POST should be a separate class, but rather a > > > > customization of HTTP_Request. But if you make HTTP_Request you > should > > > > complement it with HTTP_Response. HTTP_Response could store headers > and > > > > maybe have a MIME content interface. > > > > > > How about having a structure like this: > > > > > > HTTP_Client > > > | > > > +-HTTP_Request > > > | > > > +-HTTP_Response > > > > Careful about overdesigning, objects are still expensive in PHP. What > > would HTTP_Client provide that would not make sense to have in > > HTTP_Request? > > Thinking about it, it should be like this: > > HTTP_Client > | > +-HTTP_Request > | > +-HTTP_Response > > Since the response is specific to the request. Wrt advantages, the key thing > I can think of is making multiple request simpler. Eg: > > $htclient =& new HTTP_Client(); > > $page = $htclient->get($url1); > $page = $htclient->get($url2); > > I would imagine other uses for the parent Client class would present > themselves > when it comes to response manipulation. Maybe incorporation of the HTTP > class > in PEAR at the moment could also be useful. This is how I see the relation between HTTP clients, requests and responses: The HTTP client (useragent as the web lingo goes) provides the state a request needs to be sent to the server. For normal connections, that means just storing the URL, for persistent connections it means also keeping a socket open. The HTTP request is chunk of data that is passed on to the HTTP client for sending. They have no functionality in common. It returns another chuck of data, the response. These two share some characteristics (mime header/body) that maybe could make sense to have in a common class. - Stig

Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
« previous php.pear.dev (#4580) next »