Welcome! Log In Create A New Profile

Advanced

Re: Parallel subrequests for multi-source long polling?

November 21, 2009 09:12PM
shaun Wrote:
-------------------------------------------------------
> agentzh Wrote:
> --------------------------------------------------
> -----
> > All the addon module's .o files are put under a
> > single directory,
> > namely, objs/addon/src/. If two modules use two
> > different versions of
> > your ngx_blah_blah_blah.c, then one of the .o
> will
> > get overridden and
> > break that module's certain assumption. This
> will
> > not be an issue,
> > however, if version numbers are coded into the
> .c
> > file names, like
> > ngx_blah_blah_blah_v1.c :)
> >
> > Personally I like the second method more
> because
> > it reduces one
> > dependency on the end-user's side :)
> >
> > Cheers,
> > -agentzh
>
> Distributing versioned .c/.h files seems the
> cleanest.

Piotr / Agentzh,

I moved all the subrequest specific stuff in to a separate module, available here:
git://github.com/srlindsay/nginx-independent-subrequest.git

Piotr, this uses some of your fake request code (see src/fake_request.c). I added your license at the front of that file, since most of that code is yours.

At the moment, this module has one publicly available function: ngx_indep_subreq_fetch(). You give it a parsed ngx_url_t and a callback function and it creates the request, sets up the upstream, kicks off the proxying, and then calls your callback with the subrequest during the finalize_request stage.

You can pass in a struct of function pointers that the module will use at the various upstream callback points. Right now, you'll definitely need a function for create_request(), otherwise the request will have no request buffers to pass along. Having something that sets r->upstream->request_bufs to "GET / HTTP/1.0\r\n\r\n" is enough to get it to actually successfully proxy and return data, assuming your fetch callback sends the upstream->buffer to the main request and finalizes it.

Pretty rough right now, but it's a good start.

--Shaun
Subject Author Posted

Parallel subrequests for multi-source long polling?

shaun November 18, 2009 01:30AM

Re: Parallel subrequests for multi-source long polling?

Piotr Sikora November 18, 2009 02:28AM

Re: Parallel subrequests for multi-source long polling?

agentzh November 18, 2009 03:28AM

Re: Parallel subrequests for multi-source long polling?

agentzh November 18, 2009 03:30AM

Re: Parallel subrequests for multi-source long polling?

shaun November 18, 2009 04:22AM

Re: Parallel subrequests for multi-source long polling?

agentzh November 18, 2009 11:30PM

Re: Parallel subrequests for multi-source long polling?

shaun November 19, 2009 03:54AM

Re: Parallel subrequests for multi-source long polling?

agentzh November 19, 2009 04:58AM

Re: Parallel subrequests for multi-source long polling?

agentzh November 19, 2009 06:32AM

Re: Parallel subrequests for multi-source long polling?

shaun November 19, 2009 02:20PM

Re: Parallel subrequests for multi-source long polling?

Piotr Sikora November 19, 2009 03:28PM

Re: Parallel subrequests for multi-source long polling?

shaun November 19, 2009 04:08PM

Re: Parallel subrequests for multi-source long polling?

Piotr Sikora November 19, 2009 05:42PM

Re: Parallel subrequests for multi-source long polling?

shaun November 20, 2009 03:33AM

Re: Parallel subrequests for multi-source long polling?

Piotr Sikora November 20, 2009 04:48AM

Re: Parallel subrequests for multi-source long polling?

agentzh November 20, 2009 05:28AM

Re: Parallel subrequests for multi-source long polling?

shaun November 20, 2009 06:41AM

Re: Parallel subrequests for multi-source long polling?

shaun November 21, 2009 09:12PM

Re: Parallel subrequests for multi-source long polling?

Piotr Sikora November 21, 2009 10:10PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 202
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready