1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-10 14:42:08 +03:00

Removed Lua dependencies and made sure PHP can be run.

git-svn-id: svn://svn.code.sf.net/p/axtls/code/trunk@217 9a5d90b5-6617-0410-8a86-bb477d3ed2e3
This commit is contained in:
cameronrich 2011-08-24 09:56:49 +00:00
parent cbd60876eb
commit 92667aee8a
3 changed files with 16 additions and 53 deletions

View File

@ -65,7 +65,7 @@ config CONFIG_HTTP_HAS_CGI
config CONFIG_HTTP_CGI_EXTENSIONS config CONFIG_HTTP_CGI_EXTENSIONS
string "CGI File Extension(s)" string "CGI File Extension(s)"
default ".lua,.lp" default ".lua,.lp,.php"
depends on CONFIG_HTTP_HAS_CGI depends on CONFIG_HTTP_HAS_CGI
help help
Tell axhhtpd what file extension(s) are used for CGI. Tell axhhtpd what file extension(s) are used for CGI.
@ -83,29 +83,26 @@ config CONFIG_HTTP_ENABLE_LUA
config CONFIG_HTTP_LUA_PREFIX config CONFIG_HTTP_LUA_PREFIX
string "Lua's Installation Prefix" string "Lua's Installation Prefix"
default "/usr/local" default "/usr"
depends on CONFIG_HTTP_ENABLE_LUA depends on CONFIG_HTTP_ENABLE_LUA
help help
The location of Lua's installation prefix. This is also necessary for The location of Lua's installation prefix.
Lua's cgi launcher application.
config CONFIG_HTTP_LUA_CGI_LAUNCHER
string "CGI launcher location"
default "/bin/cgi.exe" if CONFIG_PLATFORM_CYGWIN
default "/bin/cgi" if !CONFIG_PLATFORM_CYGWIN
depends on CONFIG_HTTP_ENABLE_LUA
help
The location of LUA's CGI launcher application (after
the CONFIG_HTTP_LUA_PREFIX)
config CONFIG_HTTP_BUILD_LUA config CONFIG_HTTP_BUILD_LUA
bool "Build Lua" bool "Build Lua"
default n default n
depends on CONFIG_HTTP_ENABLE_LUA depends on CONFIG_HTTP_ENABLE_LUA
help help
Build Lua and install in /usr/local/bin Build Lua and install in /usr/bin by default.
config CONFIG_HTTP_CGI_LAUNCHER
string "CGI launcher location"
default "/usr/bin/cgi.exe"
depends on CONFIG_HTTP_HAS_CGI
help
The location of the CGI launcher application (could be /usr/bin/php5).
The default is to use Lua's CGI launcher.
endmenu endmenu
config CONFIG_HTTP_DIRECTORIES config CONFIG_HTTP_DIRECTORIES

View File

@ -92,9 +92,6 @@ struct connstruct
#if defined(CONFIG_HTTP_HAS_CGI) #if defined(CONFIG_HTTP_HAS_CGI)
uint8_t is_cgi; uint8_t is_cgi;
char cgicontenttype[MAXREQUESTLENGTH]; char cgicontenttype[MAXREQUESTLENGTH];
#ifdef CONFIG_HTTP_ENABLE_LUA
uint8_t is_lua;
#endif
int content_length; int content_length;
char remote_addr[MAXREQUESTLENGTH]; char remote_addr[MAXREQUESTLENGTH];
char uri_request[MAXREQUESTLENGTH]; char uri_request[MAXREQUESTLENGTH];

View File

@ -405,14 +405,7 @@ void procsendhead(struct connstruct *cn)
#if defined(CONFIG_HTTP_HAS_CGI) #if defined(CONFIG_HTTP_HAS_CGI)
if (file_exists != -1 && cn->is_cgi) if (file_exists != -1 && cn->is_cgi)
{ {
if ((stbuf.st_mode & S_IEXEC) == 0 || isdir(cn->actualfile)) proccgi(cn);
{
/* A non-executable file, or directory? */
send_error(cn, 403);
}
else
proccgi(cn);
return; return;
} }
#endif #endif
@ -578,7 +571,7 @@ void procsendfile(struct connstruct *cn)
static void proccgi(struct connstruct *cn) static void proccgi(struct connstruct *cn)
{ {
int tpipe[2], spipe[2]; int tpipe[2], spipe[2];
char *myargs[2]; char *myargs[3];
char cgienv[CGI_ARG_SIZE][MAXREQUESTLENGTH]; char cgienv[CGI_ARG_SIZE][MAXREQUESTLENGTH];
char * cgiptr[CGI_ARG_SIZE+4]; char * cgiptr[CGI_ARG_SIZE+4];
const char *type = "HEAD"; const char *type = "HEAD";
@ -668,8 +661,9 @@ static void proccgi(struct connstruct *cn)
} else /* Otherwise we can shutdown the read side of the sock */ } else /* Otherwise we can shutdown the read side of the sock */
shutdown(cn->networkdesc, 0); shutdown(cn->networkdesc, 0);
myargs[0] = cn->actualfile; myargs[0] = CONFIG_HTTP_CGI_LAUNCHER;
myargs[1] = NULL; myargs[1] = cn->actualfile;
myargs[2] = NULL;
/* /*
* set the cgi args. A url is defined by: * set the cgi args. A url is defined by:
@ -721,11 +715,6 @@ static void proccgi(struct connstruct *cn)
if (cn->is_ssl) if (cn->is_ssl)
strcpy(cgienv[cgi_index++], "HTTPS=on"); strcpy(cgienv[cgi_index++], "HTTPS=on");
#ifdef CONFIG_PLATFORM_CYGWIN
/* TODO: find out why Lua needs this */
strcpy(cgienv[cgi_index++], "PATH=/usr/bin");
#endif
if (cgi_index >= CGI_ARG_SIZE) if (cgi_index >= CGI_ARG_SIZE)
{ {
printf("Content-type: text/plain\n\nToo many CGI args (%d, %d)\n", printf("Content-type: text/plain\n\nToo many CGI args (%d, %d)\n",
@ -761,14 +750,7 @@ static char * cgi_filetype_match(struct connstruct *cn, const char *fn)
t += strlen(tp->ext); t += strlen(tp->ext);
if (*t == '/' || *t == '\0') if (*t == '/' || *t == '\0')
{
#ifdef CONFIG_HTTP_ENABLE_LUA
if (strcmp(tp->ext, ".lua") == 0 || strcmp(tp->ext, ".lp") == 0)
cn->is_lua = 1;
#endif
return t; return t;
}
else else
return NULL; return NULL;
@ -786,9 +768,6 @@ static void decode_path_info(struct connstruct *cn, char *path_info)
#if defined(CONFIG_HTTP_HAS_CGI) #if defined(CONFIG_HTTP_HAS_CGI)
cn->is_cgi = 0; cn->is_cgi = 0;
#endif
#ifdef CONFIG_HTTP_ENABLE_LUA
cn->is_lua = 0;
#endif #endif
*cn->uri_request = '\0'; *cn->uri_request = '\0';
*cn->uri_path_info = '\0'; *cn->uri_path_info = '\0';
@ -1005,16 +984,6 @@ static void buildactualfile(struct connstruct *cn)
*cp = 0; *cp = 0;
} }
#endif #endif
#if defined(CONFIG_HTTP_ENABLE_LUA)
/*
* Use the lua launcher if this file has a lua extension. Put this at the
* end as we need the directory name.
*/
if (cn->is_lua)
sprintf(cn->actualfile, "%s%s", CONFIG_HTTP_LUA_PREFIX,
CONFIG_HTTP_LUA_CGI_LAUNCHER);
#endif
} }
static int sanitizefile(const char *buf) static int sanitizefile(const char *buf)