From: Dean M. B. <mik...@gm...> - 2010-05-28 04:15:24
|
Hey Matt! On Fri, May 28, 2010 at 10:48 AM, Matt Trentini <mat...@gm...> wrote: > Heya Dean, > > As always, thanks to you, Glyn and everyone else associated with the > cpp-netlib; we're using it on a live project and have found it very > useful! > You're welcome, this means a great deal to know that you're using it in a live project already! You've just made my day. :) >> * asynchronous http client > > Async HTTP is the only feature in the list that we require. We've > actually managed to cobble together an async solution based on > cpp-netlib but it's so ugly that I haven't contributed it back. We > did have plans to tidy it up and submit it to you guys but finding > time is proving *very* difficult. > I know how that feels. I actually have done some work before on a cpp-netlib fork before that unfortunately they haven't authorized to be released back into cpp-netlib -- and one of the things I did there was actually support a real asynchronous HTTP client. Now though we have an opportunity of implementing something different, using Boost.Thread's futures for a real asynchronous HTTP client. Of course though that would introduce a few things like making an HTTP client that's actually an active object, and that will require a bit of gutting the current implementation. Fear not though, it sounds like a lot of work but with the magic of template specialization we'd be leaving a lot of the stuff untouched -- although later on it would be good to merge things... Scary, but definitely doable. > Actually, I should be more specific here. The critical requirement > for us is to allow *timeouts* on http requests. But I think that - > internally - you'll need to move the implementation to async asio > calls to allow the timeout to work correctly. At least that's what we > did - we initialised a deadline_timer and checked if it had expired > after each stage of the http request. > Yes, we'd have to gut the current sync implementation to use futures too for this to become real. The complications of adding timeouts would be something to consider deeply first though, what do you do when a timeout occurs, do you retry? do you throw? do you return a message that says that something went wrong in the body? Lots of questions that need to be answered first before we go about sprinkling in timeout support for requests. ;) If you or anybody would like to take this on too or have a proposal on how to fix it, then I'm all ears and very supportive. I love github and encourage everyone to fork and do crazy things with cpp-netlib. :) >> Are there any specific requests for improvement in the documentation that you would like me >> personally to address? > > An example with a threadpool would be nice: Push an http request into > a threadpool and get a callback when it's been completed (or timed > out). > I think this would require a little bit of help. I intend on hiding the threadpool into a single thread and turning the asynchronous client into an active object. >> cout << body(http::client().get(http::client::request("http://www.boost.org/")) << endl; > > Excellent! > Thanks! > Thanks again, > Matt > You're very much welcome, thanks for the feedback Matt! > PS, when I tried to download the source in either zip or tgz through > github a virus was found (by github): > > Virus/PUS: "Email-Worm.Win32.Plexus.a" found! > > It was in one of the test messages: > > http://github.com/mikhailberis/cpp-netlib/blob/master/libs/mime/test/TestMessages/00001136 > > Is this intended?? > I would say that's not intentional, and that's part of the MIME library tests. I've copied Marshall to this email so that he can take a look and maybe do something about the offending email. Thanks for letting us know! -- Dean Michael Berris deanberris.com |