PoorMan: update thttpd from 2.25b to 2.29

http://www.acme.com/software/thttpd/#releasenotes
Compiled on 32 and 64bit, ran PoorMan, and verified it served webpage and shows logs correctly.

Change-Id: I23fdf0f9910089aa8e24bb66ed7fb49b065b5577
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4404
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
This commit is contained in:
Coldfirex 2021-08-28 21:15:18 -05:00 committed by Alex von Gluck IV
parent 3e8376c6dd
commit 4a850ca730
5 changed files with 1222 additions and 580 deletions

View File

@ -309,13 +309,6 @@
*/
#define DESIRED_MAX_MAPPED_BYTES 1000000000
/* CONFIGURE: Minimum and maximum intervals between child-process reaping,
** in seconds.
*/
#define MIN_REAP_TIME 30
#define MAX_REAP_TIME 900
/* You almost certainly don't want to change anything below here. */
/* CONFIGURE: When throttling CGI programs, we don't know how many bytes

File diff suppressed because it is too large Load Diff

View File

@ -54,6 +54,9 @@
#define NEW(t,n) ((t*) malloc( sizeof(t) * (n) ))
#define RENEW(o,t,n) ((t*) realloc( (void*) o, sizeof(t) * (n) ))
/* Do overlapping strcpy safely, by using memmove. */
#define ol_strcpy(dst,src) memmove(dst,src,strlen(src)+1)
/* The httpd structs. */
@ -86,7 +89,7 @@ typedef struct {
int global_passwd;
char* url_pattern;
char* local_pattern;
int no_empty_referers;
int no_empty_referrers;
//added for poorman
int do_list_dir;
char* index_name;
@ -112,7 +115,7 @@ typedef struct {
char* encodings;
char* pathinfo;
char* query;
char* referer;
char* referrer;
char* useragent;
char* accept;
char* accepte;
@ -146,7 +149,8 @@ typedef struct {
int should_linger;
struct stat sb;
int conn_fd;
int processed_directory_index;
int processed_directory_index;
char* file_address;
} httpd_conn;
/* Methods. */
@ -154,6 +158,9 @@ typedef struct {
#define METHOD_GET 1
#define METHOD_HEAD 2
#define METHOD_POST 3
#define METHOD_PUT 4
#define METHOD_DELETE 5
#define METHOD_TRACE 6
/* States for checked_state. */
#define CHST_FIRSTWORD 0
@ -182,7 +189,7 @@ extern httpd_server* httpd_initialize(
unsigned short port, char* cgi_pattern, int cgi_limit, char* charset,
char* p3p, int max_age, char* cwd, int no_log, FILE* logfp,
int no_symlink_check, int vhost, int global_passwd, char* url_pattern,
char* local_pattern, int no_empty_referers );
char* local_pattern, int no_empty_referrers );
/* PoorMan: Initialize_listen_socket() is changed from static to extern.
** httpd_unlisten() needs an opposite operation that can be accessed from
@ -261,7 +268,8 @@ extern void httpd_destroy_conn( httpd_conn* hc );
/* Send an error message back to the client. */
extern void httpd_send_err(
httpd_conn* hc, int status, char* title, char* extraheads, char* form, char* arg );
httpd_conn* hc, int status, char* title, char* extraheads, char* form,
char* arg );
/* Some error messages. */
extern char* httpd_err400title;
@ -290,7 +298,7 @@ extern void httpd_clear_ndelay( int fd );
extern int httpd_read_fully( int fd, void* buf, size_t nbytes );
/* Write the requested buffer completely, accounting for interruptions. */
extern int httpd_write_fully( int fd, const void* buf, size_t nbytes );
extern int httpd_write_fully( int fd, const char* buf, size_t nbytes );
/* Generate debugging statistics syslog message. */
extern void httpd_logstats( long secs );

View File

@ -11,7 +11,7 @@ ai application/postscript
aif audio/x-aiff
aifc audio/x-aiff
aiff audio/x-aiff
asc text/plain
asc text/plain; charset=%s
asf video/x-ms-asf
asx video/x-ms-asf
au audio/basic
@ -26,7 +26,7 @@ cpt application/mac-compactpro
crl application/x-pkcs7-crl
crt application/x-x509-ca-cert
csh application/x-csh
css text/css
css text/css; charset=%s
dcr application/x-director
dir application/x-director
djv image/vnd.djvu
@ -34,7 +34,7 @@ djvu image/vnd.djvu
dll application/octet-stream
dms application/octet-stream
doc application/msword
dtd text/xml
dtd text/xml; charset=%s
dump application/octet-stream
dvi application/x-dvi
dxr application/x-director
@ -52,8 +52,8 @@ gif image/gif
gtar application/x-gtar
hdf application/x-hdf
hqx application/mac-binhex40
htm text/html
html text/html
htm text/html; charset=%s
html text/html; charset=%s
ice x-conference/x-cooltalk
ief image/ief
iges model/iges
@ -66,8 +66,11 @@ jpeg image/jpeg
jpg image/jpeg
js application/x-javascript
kar audio/midi
kml application/vnd.google-earth.kml+xml
kmz application/vnd.google-earth.kmz
latex application/x-latex
lha application/octet-stream
loc application/xml-loc
lzh application/octet-stream
m3u audio/x-mpegurl
man application/x-troff-man
@ -95,7 +98,7 @@ mxu video/vnd.mpegurl
nc application/x-netcdf
o application/octet-stream
oda application/oda
ogg application/x-ogg
ogg application/ogg
pac application/x-ns-proxy-autoconfig
pbm image/x-portable-bitmap
pdb chemical/x-pdb
@ -117,10 +120,10 @@ rm audio/x-pn-realaudio
roff application/x-troff
rpm audio/x-pn-realaudio-plugin
rss application/rss+xml
rtf text/rtf
rtx text/richtext
sgm text/sgml
sgml text/sgml
rtf text/rtf; charset=%s
rtx text/richtext; charset=%s
sgm text/sgml; charset=%s
sgml text/sgml; charset=%s
sh application/x-sh
shar application/x-shar
silo model/mesh
@ -160,8 +163,8 @@ tif image/tiff
tiff image/tiff
tr application/x-troff
tsp application/dsptype
tsv text/tab-separated-values
txt text/plain
tsv text/tab-separated-values; charset=%s
txt text/plain; charset=%s
ustar application/x-ustar
vcd application/x-cdlink
vrml model/vrml
@ -184,12 +187,12 @@ wrl model/vrml
wsrc application/x-wais-source
wvx video/x-ms-wvx
xbm image/x-xbitmap
xht application/xhtml+xml
xhtml application/xhtml+xml
xht application/xhtml+xml; charset=%s
xhtml application/xhtml+xml; charset=%s
xls application/vnd.ms-excel
xml text/xml
xml text/xml; charset=%s
xpm image/x-xpixmap
xsl text/xml
xsl text/xml; charset=%s
xwd image/x-xwindowdump
xyz chemical/x-xyz
zip application/zip

View File

@ -59,17 +59,18 @@ pound_case( char* str )
}
}
//static int
//strlong_compare( v1, v2 )
// char* v1;
// char* v2;
//strlong_compare( const void* v1, const void* v2 )
// {
// return strcmp( ((struct strlong*) v1)->s, ((struct strlong*) v2)->s );
// const struct strlong* s1 = (const struct strlong*) v1;
// const struct strlong* s2 = (const struct strlong*) v2;
// return strcmp( s1->s, s2->s );
// }
static int
strlong_search( char* str, const struct strlong* tab, int n, long* lP )
strlong_search( char* str, struct strlong* tab, int n, long* lP )
{
int i, h, l, r;
@ -115,7 +116,7 @@ scan_wday( char* str_wday, long* tm_wdayP )
// sizeof(struct strlong), strlong_compare );
// sorted = 1;
// }
/*manually sorted wday_tab to avoid concurrent accessing problem*/
static const struct strlong wday_tab[] = {
{ "fri", 5 }, { "friday", 5 },
@ -126,7 +127,7 @@ scan_wday( char* str_wday, long* tm_wdayP )
{ "tue", 2 }, { "tuesday", 2 },
{ "wed", 3 }, { "wednesday", 3 }
};
pound_case( str_wday );
return strlong_search(
str_wday, wday_tab, sizeof(wday_tab)/sizeof(struct strlong), tm_wdayP );
@ -199,7 +200,7 @@ tm_to_time( struct tm* tmP )
/* Years since epoch, converted to days. */
t = ( tmP->tm_year - 70 ) * 365;
/* Leap days for previous years. */
/* Leap days for previous years - this will break in 2100! */
t += ( tmP->tm_year - 69 ) / 4;
/* Days for the beginning of this month. */
t += monthtab[tmP->tm_mon];