From: Agustín K-b. B. <kab...@ho...> - 2008-08-29 05:59:47
|
Dean Michael Berris escribió: > 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: > > For #1: > - This puts undue burden to the request crafting aspect: it makes it > cumbersome to craft requests that you intend to re-use anyway (perform > a HEAD first, and if headers don't fit a certain criteria then do a > GET using the same resource) > - It complicates the http::request implementation by deviating too > much from the message framework/abstraction > I would expect some orthogonality among the library. That is, if a client sends a request then I'd expect a server to be able to receive one. How could this be handled under the current design, in which the http 'method' is not part of the request? According to RFC2616, "A request message from a client to a server includes, within the first line of that message, the method to be applied to the resource, (...)". I would like to see a clear compile-time mapping for the objects, just as I like them for HTTP 'methods'. Perhaps something like this: using namespace boost::network; http::resource resource("http://www.boost.org/"); http::request request_; http::client client_; http::response response_; request_ = http::get(resource); response_ = client_.request(request_); IMHO, not only the code looks closer to the protocol, but also detaches it from the underlaying transport mechanism (client_ here). It may just be that this is not what the library seeks for. I would appreciate some enlightening on the subject. Agustín K-ballo Bergé.- |