--- Denys Vlasenko <[EMAIL PROTECTED]> wrote:

> On Wednesday 17 October 2007 10:56, Alex Landau wrote:
> > --- Alex Landau <[EMAIL PROTECTED]> wrote:
> > 
> > > Hi,
> > > 
> > > The attached patch adds an option to set the default page to display for 
> > > a URL like
> > > http://hostname/ instead of index.html. The option is compile-time 
> > > selectable and
> the
> > > filename is config-file choosable. The file may also be a CGI script (if 
> > > CGI is
> > > compiled
> > > in).
> > > 
> > > Any comments?
> 
> I removed dup() below:
> 
> cgi_io_loop_and_exit(proxy_fd, dup(proxy_fd), length);
> 
> Is it needed?

Yes, it is. cgi_io_loop_and_exit() expects 2 distinct file descriptors (ala 
pipe()) and
closes one of them to notify the CGI about an EOF in the postdata. This will 
close the
connection in the proxy case. I've put it back.

> 
> Also I edited code parts which looked like "if ((A = expr) == B) ... ",
> and removed trailing whitespace.
> 
> Here you allocate 8k buffer and copy there all headers from client:
> 
>         char *headers = xmalloc(IOBUF_SIZE);
>         ...
> 
> But you use it only if request happens to be one of the proxied
> requests:
> 
>         proxy_entry = find_proxy_entry(urlcopy);
>         if (proxy_entry != NULL) {
>                 ....
>                 write(proxy_fd, headers, headers_ptr - headers);
>                 write(proxy_fd, "\r\n", 2);
>                 cgi_io_loop_and_exit(proxy_fd, proxy_fd, length);
>         }
> 
> Can you check find_proxy_entry(urlcopy) earlier and do xmalloc
> and copying only if needed?
> 

Sure, how could I miss it? Thanks!

> I am attaching modified httpd.c, please base your further work on it.
> 

Ditto.

> Thanks Alex for your work.

I hope someone besides me will find these features useful.
:-)

> --
> vda
> 
Alex


      
____________________________________________________________________________________
Tonight's top picks. What will you watch tonight? Preview the hottest shows on 
Yahoo! TV.
http://tv.yahoo.com/ 

Attachment: httpd.c.bz2
Description: 824490146-httpd.c.bz2

_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to