version 1.1.1.1.2.6, 2012/03/09 16:09:38
|
version 1.3.4.1, 2012/07/31 11:56:16
|
Line 44 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF TH
|
Line 44 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF TH
|
SUCH DAMAGE. |
SUCH DAMAGE. |
*/ |
*/ |
#include "global.h" |
#include "global.h" |
#include "tools.h" |
|
#include "mime.h" |
#include "mime.h" |
|
|
|
|
Line 76 www_SetErr(int eno, char *estr, ...)
|
Line 75 www_SetErr(int eno, char *estr, ...)
|
va_list lst; |
va_list lst; |
|
|
www_Errno = eno; |
www_Errno = eno; |
memset(www_Error, 0, STRSIZ); | memset(www_Error, 0, sizeof www_Errno); |
va_start(lst, estr); |
va_start(lst, estr); |
vsnprintf(www_Error, STRSIZ, estr, lst); | vsnprintf(www_Error, sizeof www_Errno, estr, lst); |
va_end(lst); |
va_end(lst); |
} |
} |
|
|
Line 99 www_initCGI(void)
|
Line 98 www_initCGI(void)
|
|
|
str = getenv("REQUEST_METHOD"); |
str = getenv("REQUEST_METHOD"); |
if (!str) { |
if (!str) { |
www_SetErr(EBADMSG, "Request method not found"); | www_SetErr(EFAULT, "Request method not found"); |
return NULL; |
return NULL; |
} |
} |
if (!strcmp(str, "GET") || !strcmp(str, "HEAD")) { |
if (!strcmp(str, "GET") || !strcmp(str, "HEAD")) { |
/* GET | HEAD */ |
/* GET | HEAD */ |
str = getenv("QUERY_STRING"); |
str = getenv("QUERY_STRING"); |
if (!str) { |
if (!str) { |
www_SetErr(EBADMSG, "Query string not found"); | www_SetErr(EFAULT, "Query string not found"); |
return NULL; |
return NULL; |
} |
} |
cgi = www_parseQuery(str); |
cgi = www_parseQuery(str); |
Line 114 www_initCGI(void)
|
Line 113 www_initCGI(void)
|
/* POST */ |
/* POST */ |
str = getenv("CONTENT_LENGTH"); |
str = getenv("CONTENT_LENGTH"); |
if (!str) { |
if (!str) { |
www_SetErr(EBADMSG, "Content length not found"); | www_SetErr(EFAULT, "Content length not found"); |
return NULL; |
return NULL; |
} else |
} else |
ctlen = strtol(str, NULL, 0); |
ctlen = strtol(str, NULL, 0); |
|
|
s = getenv("CONTENT_TYPE"); |
s = getenv("CONTENT_TYPE"); |
if (!s) { |
if (!s) { |
www_SetErr(EBADMSG, "Content type not found"); | www_SetErr(EFAULT, "Content type not found"); |
return NULL; |
return NULL; |
} |
} |
if (www_cmp(s, "multipart/form-data") && |
if (www_cmp(s, "multipart/form-data") && |
www_cmp(s, "application/x-www-form-urlencoded")) { |
www_cmp(s, "application/x-www-form-urlencoded")) { |
www_SetErr(EBADMSG, "MIME parts are broken"); | www_SetErr(EFAULT, "MIME parts are broken"); |
return NULL; |
return NULL; |
} |
} |
|
|
Line 149 www_initCGI(void)
|
Line 148 www_initCGI(void)
|
free(str); |
free(str); |
} else { |
} else { |
/* Unknown method */ |
/* Unknown method */ |
www_SetErr(EBADMSG, "Unknown request method"); | www_SetErr(EFAULT, "Unknown request method"); |
return NULL; |
return NULL; |
} |
} |
|
|