diff options
author | Nathan Angelacos <nangel@alpinelinux.org> | 2008-12-17 00:04:57 +0000 |
---|---|---|
committer | Nathan Angelacos <nangel@alpinelinux.org> | 2008-12-17 00:04:57 +0000 |
commit | 63570d1761822e4278df2eaa03068fb4ccb13432 (patch) | |
tree | f8bc5b434e313a6f50e9329ba5bc5ae5f364745e /src | |
parent | 57bf42be12123cfa34ff70e4985537582047c14e (diff) | |
download | haserl-63570d1761822e4278df2eaa03068fb4ccb13432.tar.bz2 haserl-63570d1761822e4278df2eaa03068fb4ccb13432.tar.xz |
fix bug tracker bug 1959379; prepare for 0.9.25 release
Diffstat (limited to 'src')
-rw-r--r-- | src/haserl.c | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/src/haserl.c b/src/haserl.c index 1d0a46d..532458f 100644 --- a/src/haserl.c +++ b/src/haserl.c @@ -437,8 +437,11 @@ ReadCGIPOSTValues (list_t * env) sliding_buffer_t sbuf; buffer_t token; unsigned char *data; + const char *content_length_string = "CONTENT_LENGTH"; - if (getenv ("CONTENT_LENGTH") == NULL) + + if ((getenv (content_length_string) == NULL) || + (strtoul (getenv (content_length_string), NULL, 10) == 0)) return (0); if (getenv ("CONTENT_TYPE")) @@ -456,7 +459,7 @@ ReadCGIPOSTValues (list_t * env) sbuf.fh = STDIN; if (getenv ("CONTENT_LENGTH")) { - sbuf.maxread = strtoul (getenv ("CONTENT_LENGTH"), NULL, 10); + sbuf.maxread = strtoul (getenv (content_length_string), NULL, 10); } buffer_init (&token); @@ -678,45 +681,47 @@ main (int argc, char *argv[]) #ifdef INCLUDE_LUASHELL " and interpreted" #endif - ")\n" + ")\n" #endif #ifdef BASHEXTENSIONS - "Unsupported bash extensions supplied by simnux enabled\n" + "Unsupported bash extensions supplied by simnux enabled\n" #endif ); return (0); break; - default: /* more than one */ + default: /* more than one */ /* split combined #! args - linux bundles them as one */ command = argc_argv (argv[1], &av, ""); if (command > 1) - { - /* rebuild argv into new av2 */ - av2c = argc - 1 + command; - av2 = xmalloc (sizeof (char *) * av2c); - av2[0] = argv[0]; - for (count = 1; count <= command; count++) - { - av2[count] = av[count-1].string; - } - for (; count < av2c; count++) { - av2[count] = argv[count - command + 1]; - } - } - + { + /* rebuild argv into new av2 */ + av2c = argc - 1 + command; + av2 = xmalloc (sizeof (char *) * av2c); + av2[0] = argv[0]; + for (count = 1; count <= command; count++) + { + av2[count] = av[count - 1].string; + } + for (; count < av2c; count++) + { + av2[count] = argv[count - command + 1]; + } + } + parseCommandLine (av2c, av2); free (av); - if (av2 != argv) free (av2); + if (av2 != argv) + free (av2); if (optind < av2c) - { - filename = av2[optind]; - } + { + filename = av2[optind]; + } else - { - die_with_message (NULL, NULL, "No script file specified"); - } + { + die_with_message (NULL, NULL, "No script file specified"); + } break; } @@ -728,7 +733,7 @@ main (int argc, char *argv[]) /* populate the function pointers based on the shell selected */ if (strcmp (global.shell, "lua") && strcmp (global.shell, "luac")) - /* default to "bash" */ + /* default to "bash" */ { #ifdef INCLUDE_BASHSHELL shell_exec = &bash_exec; @@ -771,7 +776,7 @@ main (int argc, char *argv[]) global.var_prefix = "FORM."; global.nul_prefix = "ENV."; - if (global.shell[3] == 'c') /* luac only */ + if (global.shell[3] == 'c') /* luac only */ #ifdef INCLUDE_LUACSHELL shell_doscript = &luac_doscript; #else |