Handler should receive Parser as argument on events
vinipsmaker opened this issue · 3 comments
This way it could query items like method and simplify implementation of a few tasks.
This is kind of how mio works btw (Handler receives mutable reference to EventLoop even though EventLoop owns Handler).
So, on_url(&mut self, &[u8])
should be on_url(&mut self, &mut Parser, &[u8])
and the other methods should be updated too.
Nevermind, I found a crate that gets this right: https://crates.io/crates/http_parser
Now I can have my crate supporting HTTP pipelining properly.
Sorry for a late reply.
This proposal makes sense, thanks! This is quite a breaking change, however, but I wanted to improve a few things in the API anyway, so I think this can be implemented in v0.3.
Now it's fixed in v0.3.0.
Please let me know if you find any issues. Thanks!