From: Glyn M. <gly...@gm...> - 2008-08-28 07:36:18
|
Hi Dean and Divye, 2008/8/28 Dean Michael Berris <mik...@gm...> > On Thu, Aug 28, 2008 at 1:01 AM, Divye Kapoor <div...@gm...> > wrote: > > > > > > On Wed, Aug 27, 2008 at 6:14 PM, Glyn Matthews <gly...@gm...> > > wrote: > >> > >> using namespace boost::network; > >> http::request request("http://www.boost.org/"); > >> http::client client_; > >> http::response response_; > >> response_ = client_.get(request); > >> > >> > >> What exactly is the role of the client here? I'm a little confused by > the > >> syntax because it reads as though you're trying to make a get request to > an > >> HTTP client. Would it perhaps be better to rename http::client to > >> http::connection? > > > > Currently, I read the above code as: > > 1. frame a request for resource http://www.boost.org/ > > 2. Create a client that handles http requests/responses > > 3. Get the resource specified by the request and provide a response. > > > > This is the intended interpretation which I was going for. :-) > In my mind, you send a GET to a server, not the client. When I write code like this I *am* the client, I don't *use* a client. If I'm the only one being anal about this then I'll let this point go :) > > However, I do admit that client.head(request) and client.put(request) > don't > > seem to be too intuitive in that respect. > > > > I had been thinking about that before I even started, and I was > thinking more to provide a compile-time and explicit mapping between > the interfaces and the semantics of the HTTP protocol. More > importantly, I was thinking of alternatives which were: > > 1. Encapsulating the 'method' into the http::request object. > 2. Making the client accept the method as a string. > 3. Using the "push" abstraction to convey the action. > > I decided against all three because: > ... I see your reasoning behind all these. > > I hope at least this can make it into the documentation or in a > rationale document somehow... ;-) > Yep, this was why I opened this subject. > > HTH! > It does, thanks. G |