[PATCH] httpd - User defined error pages

Pierre Métras genepi at sympatico.ca
Fri Aug 10 19:42:38 UTC 2007


Hi,

Here is the third revision of my patch to add support for user defined error 
pages in httpd. I've integrated most of the comments from Denis Vlasenko, but 
one. During development, I was surprised to get a larger executable. The 
parse_conf() function got the biggest code size increase.

After a few tests, it seems the culprit is the suggested bb_strtoi() call. The 
following line adds 97 bytes (on PIV with gcc):
	int status = bb_strtoi(p0 + 1, &p0, 10)
function                                             old     new   delta
parse_conf                                          1201    1448    +247

compared with originally:
	c = strchr(++p0, ':');
	*c = 0;
	int status = xatoi(p0);
	p0 = ++c;
function                                             old     new   delta
parse_conf                                          1201    1337    +136

I couldn't explain why such a difference...


This patch includes:
- Support for definition of error pages in httpd.conf (it was the main goal!). 
This is enabled by a configuration option, default no.
- Reports of simple errors in httpd.conf when they are detected. It does not 
check that the error page exists. Reports of memory exhausted.
- Support for comments and empty lines in httpd.conf. End of line comments 
where already supported and not documented.


In the end, with error pages enabled:

$ make bloatcheck
function                                             old     new   delta
parse_conf                                          1201    1427    +226
sendHeaders                                          461     571    +110
httpResponseNames                                    108     144     +36
sendFile                                             252     269     +17
handleIncoming                                      2094    2100      +6
.rodata                                             9715    9619     -96
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/1 up/down: 395/-96)           Total: 299 bytes
   text    data     bss     dec     hex filename
  87684    1068   10280   99032   182d8 busybox_old
  87940    1228   10280   99448   18478 busybox_unstripped


And without error pages enabled:

$ make bloatcheck
function                                             old     new   delta
parse_conf                                          1201    1309    +108
.rodata                                             9715    9747     +32
sendFile                                             252     269     +17
sendHeaders                                          461     469      +8
handleIncoming                                      2094    2100      +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 171/0)             Total: 171 bytes
   text    data     bss     dec     hex filename
  87684    1068   10280   99032   182d8 busybox_old
  87844    1068   10280   99192   18378 busybox_unstripped


-- Pierre Métras
-------------- next part --------------
A non-text attachment was scrubbed...
Name: httpd.error_pages
Type: text/x-diff
Size: 11551 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20070810/ef2ba2c2/attachment-0002.bin 


More information about the busybox mailing list