[aadk-commits] qwell: uClinux/trunk r281 -
/uClinux/trunk/uClinux-dist/user/mini_httpd/
aadk-commits at lists.digium.com
aadk-commits at lists.digium.com
Thu Mar 29 12:31:25 MST 2007
Author: qwell
Date: Thu Mar 29 14:31:23 2007
New Revision: 281
URL: http://svn.digium.com/view/aadk?view=rev&rev=281
Log:
Add pseudo-support for proxying (it handles the arguments, and does nothing with them)
Also change a few instances of fork() to vfork().
In passing, I noticed that directory listings are using ls, sed, and tail...eww
More to come...
Modified:
uClinux/trunk/uClinux-dist/user/mini_httpd/mini_httpd.c
Modified: uClinux/trunk/uClinux-dist/user/mini_httpd/mini_httpd.c
URL: http://svn.digium.com/view/aadk/uClinux/trunk/uClinux-dist/user/mini_httpd/mini_httpd.c?view=diff&rev=281&r1=280&r2=281
==============================================================================
--- uClinux/trunk/uClinux-dist/user/mini_httpd/mini_httpd.c (original)
+++ uClinux/trunk/uClinux-dist/user/mini_httpd/mini_httpd.c Thu Mar 29 14:31:23 2007
@@ -101,6 +101,7 @@
static int vhost;
static char* user;
static char* cgi_pattern;
+static char* proxy_pattern;
static char* hostname;
static char hostname_buf[500];
static u_int hostaddr;
@@ -153,6 +154,7 @@
static void do_file( void );
static void do_dir( void );
static void do_cgi( void );
+static void do_proxy( void );
static void cgi_interpose_input( int wfd );
static void cgi_interpose_output( int rfd, int parse_headers );
static char** make_argp( void );
@@ -208,6 +210,7 @@
do_chroot = 0;
vhost = 0;
cgi_pattern = (char*) 0;
+ proxy_pattern = (char*) 0;
charset = "iso-8859-1";
user = DEFAULT_USER;
hostname = (char*) 0;
@@ -236,6 +239,11 @@
++argn;
cgi_pattern = argv[argn];
}
+ else if ( strcmp( argv[argn], "-P" ) == 0 && argn + 1 < argc )
+ {
+ ++argn;
+ proxy_pattern = argv[argn];
+ }
else if ( strcmp( argv[argn], "-u" ) == 0 && argn + 1 < argc )
{
++argn;
@@ -355,7 +363,7 @@
exit( 1 );
}
#else
- switch ( fork() )
+ switch ( vfork() )
{
case 0:
break;
@@ -528,7 +536,7 @@
}
/* Fork a sub-process to handle the connection. */
- r = fork();
+ r = vfork();
if ( r < 0 )
{
perror( "fork" );
@@ -554,9 +562,9 @@
usage( void )
{
#ifdef USE_SSL
- (void) fprintf( stderr, "usage: %s [-D] [-S] [-p port] [-c cgipat] [-u user] [-h hostname] [-r] [-v] [-l logfile] [-i pidfile] [-T charset]\n", argv0 );
+ (void) fprintf( stderr, "usage: %s [-D] [-S] [-p port] [-c cgipat] [-P proxypat] [-u user] [-h hostname] [-r] [-v] [-l logfile] [-i pidfile] [-T charset]\n", argv0 );
#else /* USE_SSL */
- (void) fprintf( stderr, "usage: %s [-D] [-p port] [-c cgipat] [-u user] [-h hostname] [-r] [-v] [-l logfile] [-i pidfile] [-T charset]\n", argv0 );
+ (void) fprintf( stderr, "usage: %s [-D] [-p port] [-c cgipat] [-P proxypat] [-u user] [-h hostname] [-r] [-v] [-l logfile] [-i pidfile] [-T charset]\n", argv0 );
#endif /* USE_SSL */
exit( 1 );
}
@@ -859,6 +867,12 @@
do_cgi();
return;
}
+ /* Is it a proxied path? */
+ if ( proxy_pattern != (char*) 0 && match( proxy_pattern, file ) )
+ {
+ do_proxy();
+ return;
+ }
switch (method) {
case METHOD_GET:
@@ -961,6 +975,12 @@
send_response();
}
+
+static void
+do_proxy( void )
+ {
+
+ }
static void
do_cgi( void )
More information about the aadk-commits
mailing list