librelist archives

« back to archive

Borrowing the kegogi parser

Borrowing the kegogi parser

From:
Zed A. Shaw
Date:
2010-08-21 @ 18:52
Alex,

I thought I could do the proxy code with this two-task design, which
would have worked except it becomes way too complicated trying to
coordinate the shutdown from HTTP.

Really what I need to do is grab the kegogi parser and just parse the
proxy's response, and do it all within the connection state machine
lock-step.  That'll be way more reliable and also let us do things like
process the responses to act on them later.  It'll use fewer resources
too.

What that means is I'm going to be stealing the kegogi client parsing
code, moving it into libm2.a and then making an API for it based on your
code.  Kegogi will then just use the client stuff in libm2.a rather than
it's own source.  I'll make sure they both work before I commit.

Let me know if you got a problem with this, or if you're touching that
code.

-- 
Zed A. Shaw
http://zedshaw.com/

Re: [mongrel2] Borrowing the kegogi parser

From:
Alex Gartrell
Date:
2010-08-21 @ 19:01
I haven't been poking at the httpclient at all lately.  I think there may be
a bug in the retrieving the body, but you'll almost certainly come across it
if it's as broken as I suspect it is.

Let me know if I can do anything.

Alex

On Sat, Aug 21, 2010 at 2:52 PM, Zed A. Shaw <zedshaw@zedshaw.com> wrote:

> Alex,
>
> I thought I could do the proxy code with this two-task design, which
> would have worked except it becomes way too complicated trying to
> coordinate the shutdown from HTTP.
>
> Really what I need to do is grab the kegogi parser and just parse the
> proxy's response, and do it all within the connection state machine
> lock-step.  That'll be way more reliable and also let us do things like
> process the responses to act on them later.  It'll use fewer resources
> too.
>
> What that means is I'm going to be stealing the kegogi client parsing
> code, moving it into libm2.a and then making an API for it based on your
> code.  Kegogi will then just use the client stuff in libm2.a rather than
> it's own source.  I'll make sure they both work before I commit.
>
> Let me know if you got a problem with this, or if you're touching that
> code.
>
> --
> Zed A. Shaw
> http://zedshaw.com/
>

Re: [mongrel2] Borrowing the kegogi parser

From:
Zed A. Shaw
Date:
2010-08-22 @ 09:32
On Sat, Aug 21, 2010 at 03:01:19PM -0400, Alex Gartrell wrote:
> I haven't been poking at the httpclient at all lately.  I think there may be
> a bug in the retrieving the body, but you'll almost certainly come across it
> if it's as broken as I suspect it is.
> 
> Let me know if I can do anything.

Hey, I cleaned up the httpclient_parser and made it much much easier to
use for chunked encodings. Now it detects chunked transfers and sets a
few variables in the parser struct.  You can then test for chunked
transfer, and then use the parser to pop out each one until it's done.

Look at tests/httpclient_tests.c to see how I'm doing it.

I also made it so if a callback is NULL it doesn't try to call it.  You
can get reid of those noop callbacks now.

-- 
Zed A. Shaw
http://zedshaw.com/

Re: [mongrel2] Borrowing the kegogi parser

From:
Zed A. Shaw
Date:
2010-08-21 @ 23:59
On Sat, Aug 21, 2010 at 03:01:19PM -0400, Alex Gartrell wrote:
> I haven't been poking at the httpclient at all lately.  I think there may be
> a bug in the retrieving the body, but you'll almost certainly come across it
> if it's as broken as I suspect it is.
> 
> Let me know if I can do anything.

Ok man I moved your cheese.  The httpclient_parser stuff is now in
mongrel2 src, but I left your httpclient.c stuff.  Kegogi builds just
fine and you should be able to just go about your business.  If I make
changes I'll make sure to clean up your stuff at the same time.



-- 
Zed A. Shaw
http://zedshaw.com/