updated on Tue Jan 10 08:08:34 UTC 2012
[aur-mirror.git] / micro_httpd / micro_httpd.patch
blob1d631933853290592fa7ac3ef41a1fde04af9fb9
1 --- micro_httpd.c 2005-12-13 09:05:11.000000000 -0600
2 +++ micro_httpd.c.new 2008-01-16 10:16:38.185022855 -0600
3 @@ -105,6 +105,12 @@ main( int argc, char** argv )
4 file = idx;
5 goto do_file;
7 + (void) snprintf( idx, sizeof(idx), "%sindex.xhtml", file );
8 + if ( stat( idx, &sb ) >= 0 )
9 + {
10 + file = idx;
11 + goto do_file;
12 + }
13 send_headers( 200, "Ok", (char*) 0, "text/html", -1, sb.st_mtime );
14 (void) printf( "<html><head><title>Index of %s</title></head>\n<body bgcolor=\"#99cc99\"><h4>Index of %s</h4>\n<pre>\n", file, file );
15 n = scandir( file, &dl, NULL, alphasort );
16 @@ -197,9 +203,10 @@ get_mime_type( char* name )
18 dot = strrchr( name, '.' );
19 if ( dot == (char*) 0 )
20 - return "text/plain; charset=iso-8859-1";
21 - if ( strcmp( dot, ".html" ) == 0 || strcmp( dot, ".htm" ) == 0 )
22 - return "text/html; charset=iso-8859-1";
23 + return "text/plain; charset=utf-8";
24 + if ( strcmp( dot, ".html" ) == 0 || strcmp( dot, ".htm" ) == 0 ||
25 + strcmp( dot, ".xhtml" ) == 0 )
26 + return "text/html; charset=utf-8";
27 if ( strcmp( dot, ".jpg" ) == 0 || strcmp( dot, ".jpeg" ) == 0 )
28 return "image/jpeg";
29 if ( strcmp( dot, ".gif" ) == 0 )
30 @@ -228,7 +235,7 @@ get_mime_type( char* name )
31 return "application/ogg";
32 if ( strcmp( dot, ".pac" ) == 0 )
33 return "application/x-ns-proxy-autoconfig";
34 - return "text/plain; charset=iso-8859-1";
35 + return "text/plain; charset=utf-8";