BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000608 [BusyBox] Networking Support minor always 12-19-05 22:07 01-10-06 19:25
Reporter flowtide View Status public  
Assigned To BusyBox
Priority normal Resolution fixed  
Status closed   Product Version 1.01
Summary 0000608: The httpd doesn
Description Without fork() using handleIncoming() function several times doesn't work except first request.

Because global variable config->httpd_found.found_moved_temporarily was set during first request and remained.
So next request will be failed always because below line is always true.
if(config->httpd_found.found_moved_temporarily) {
    sendHeaders(HTTP_MOVED_TEMPORARILY);
}

So put the line before exiting handleIncoming() function
config->httpd_found.found_moved_temporarily = NULL;

Additional Information
Attached Files

- Relationships

- Notes
(0000803)
vodz
12-20-05 03:05

Ok. I removed debug feature for production version. ;-)
See SVN 12954.
 
(0000811)
flowtide
12-25-05 20:04

Not even for debug mode, using handleIncoming() function without fork() is desirable when we really need small web server.
Because it doesn't need to invoke another httpd process and so overall resource requirement is very small.
I wish you to support compile time flag whether it uses fork() or not.
And I have no problem at all using httpd without fork() for every request.
 
(0000812)
vodz
12-26-05 00:27

> I wish you to support compile time flag whether it uses fork() or not.

Without fork() httpd can usage in inetd-mode.
Other methods without wait accept() for a networking daemons is not exist in wordl.
 
(0000813)
flowtide
12-26-05 08:12

I see but I guess there is misunderstanding between us.
I don't mean httpd in the busybox has bug. It is small and powerful httpd that I met before in Internet.
In fact I am using busybox on uClinux with NO MMU ARM CPU so I am very careful about memory footprint.
Anyway, my suggestion of not using fork() in none inetd-mode has no problem because of following sequence.

In miniHttpd():
while ( 1 )
{
    select(); // wait for new request
    int s = accept();
    handleIncoming();
    close(s);
}

It seems that the reason of fork() is to process another request while processing handleIncoming().

In addition new patch for debug mode doesn't work.
if(config->httpd_found.found_moved_temporarily) {
    sendHeaders(HTTP_MOVED_TEMPORARILY);
#if DEBUG
    /* clear unforked memory flag */
    config->httpd_found.found_moved_temporarily = NULL;
#endif
    break;
    }

Because httpd_found is union type, found_mime_type is also set during sending result.
You should put following code near the end of handleIncoming.
#if DEBUG
    /* clear unforked memory flag */
    config->httpd_found.found_moved_temporarily = NULL;
#endif
 
(0000814)
vodz
12-26-05 08:21

> while ( 1 )
> {
> select(); // wait for new request
> int s = accept();
> handleIncoming();
> close(s);
> }

If handleIncoming() is slow, then daemon have not accept other connections. Its bad idea.
Good idea for nonMMU: accept from inetd, vfork()+exec("httpd").
 
(0000919)
landley
01-10-06 19:24

vodz got it.
 

- Issue History
Date Modified Username Field Change
12-19-05 22:07 flowtide New Issue
12-19-05 22:07 flowtide Status new => assigned
12-19-05 22:07 flowtide Assigned To  => BusyBox
12-20-05 03:05 vodz Note Added: 0000803
12-25-05 20:04 flowtide Note Added: 0000811
12-26-05 00:27 vodz Note Added: 0000812
12-26-05 08:12 flowtide Note Added: 0000813
12-26-05 08:21 vodz Note Added: 0000814
01-10-06 19:24 landley Status assigned => closed
01-10-06 19:24 landley Note Added: 0000919
01-10-06 19:25 landley Resolution open => fixed


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker