Hi Max!
Please see my response in-lined below.
On Mon, Jan 17, 2011 at 11:27 PM, Max Malmgren <ma...@kt...> wrote:
> Hi,
>
> First off, let me say thanks for a very useful library. I've only been using
> it for a few days but it is very simple to use most of the time.
>
You're welcome, I'm glad it's been useful to you. :)
> I've managed to use your library to implement a HTTP proxy, which was very
> simple. I did this using the synchronous server and synchronous client.
>
> However, since I'd like to use this in a streaming capacity, I'd like to use
> asynchronous reads and writes.
>
> I have tried setting up a simple async server, using the same model I did
> for the synchronous server. However, at runtime I get a bad_cast exception
> when I use my browser to make a request. It does not even enter the operator
> overload method body.
>
> I'm sorry if this is the wrong place for this type of question, but I would
> very much appreciate some help to understand what I'm doing wrong. As you
> can see, it is simply a definition of a class, which I use as input to the
> server method.
>
Actually, it's better if you ask on the cpp-netlib-devel mailing list.
It's where the developers and users get together to ask questions and
help each other out. :)
What version of the library are you using?
> Source:
>
> #include <string>
> #include "asyncproxy.h"
>
> namespace proxy {
> void ASyncProxy::startProxy(std::string url, std::string port)
> {
> boost::network::utils::thread_pool thread_pool(2);
> http_server server(url, port, *this, thread_pool);
> server.run();
> }
> ASyncProxy::ASyncProxy(void (*callback)(std::string))
> {
> this->callback = callback;
> }
> void ASyncProxy::operator()(http_server::request const & req,
> http_server::connection_ptr connection)
> {
> connection->set_status(http_server::connection::ok);
> }
> }
>
> int main()
> {
> proxy::ASyncProxy prox(&writeQueue);
> prox.startProxy(url, port);
> }
>
Can you show the exact request that makes the server fail? There may
be a bug somewhere in the implementation that has something to do with
converting strings into numbers.
What browser are you using and can you send in your raw request data?
Thanks in advance and I hope to hear from you again soon (hopefully
this time on the developers mailing list). :)
Also, there's documentation on how to use the HTTP asynchronous server
from here: http://cpp-netlib.github.com/ -- let me know if you run
into any issues that you need further clarification about.
--
Dean Michael Berris
about.me/deanberris
|