Commit 2ff2c369 authored by Sergey Lyubka's avatar Sergey Lyubka

Merge pull request #505 from eugoss/master

Inspect POST buffer in mg_get_var() only if first call of get_var() returns -1
parents eef70aaf c00b236c
...@@ -168,7 +168,7 @@ Changes in pre-compiled binaries: ...@@ -168,7 +168,7 @@ Changes in pre-compiled binaries:
since mongoose buffers all data prior to calling the callback since mongoose buffers all data prior to calling the callback
* keep-alive support is the default * keep-alive support is the default
* Dropped SSI support and throttling support * Dropped SSI support and throttling support
* Several configuraition parameters are gone: * Several configuration parameters are gone:
* `cgi_environment` (replaced with MONGOOSE_CGI), * `cgi_environment` (replaced with MONGOOSE_CGI),
* `protect_uri` (not useful) * `protect_uri` (not useful)
* `ssi_pattern` (SSI support is gone) * `ssi_pattern` (SSI support is gone)
...@@ -214,5 +214,5 @@ Changes in pre-compiled binaries: ...@@ -214,5 +214,5 @@ Changes in pre-compiled binaries:
* Couple of bugfixes, thanks to contributors * Couple of bugfixes, thanks to contributors
Eearlier release notes could be found by searching Earlier release notes could be found by searching
[Mongoose mailing list](https://groups.google.com/forum/#!forum/mongoose-users) [Mongoose mailing list](https://groups.google.com/forum/#!forum/mongoose-users)
...@@ -1403,7 +1403,7 @@ struct dir_entry { ...@@ -1403,7 +1403,7 @@ struct dir_entry {
file_stat_t st; file_stat_t st;
}; };
// NOTE(lsm): this enum shoulds be in sync with the config_options. // NOTE(lsm): this enum should be in sync with the config_options.
enum { enum {
ACCESS_CONTROL_LIST, ACCESS_CONTROL_LIST,
#ifndef MONGOOSE_NO_FILESYSTEM #ifndef MONGOOSE_NO_FILESYSTEM
...@@ -1993,7 +1993,7 @@ static void *push_to_stdin(void *arg) { ...@@ -1993,7 +1993,7 @@ static void *push_to_stdin(void *arg) {
if (!WriteFile(tp->hPipe, buf + sent, n - sent, &k, 0)) stop = 1; if (!WriteFile(tp->hPipe, buf + sent, n - sent, &k, 0)) stop = 1;
} }
} }
DBG(("%s", "FORWARED EVERYTHING TO CGI")); DBG(("%s", "FORWARDED EVERYTHING TO CGI"));
CloseHandle(tp->hPipe); CloseHandle(tp->hPipe);
NS_FREE(tp); NS_FREE(tp);
_endthread(); _endthread();
...@@ -2504,7 +2504,7 @@ static size_t parse_http_message(char *buf, size_t len, ...@@ -2504,7 +2504,7 @@ static size_t parse_http_message(char *buf, size_t len,
buf[len - 1] = '\0'; buf[len - 1] = '\0';
// RFC says that all initial whitespaces should be ingored // RFC says that all initial whitespaces should be ignored
while (*buf != '\0' && isspace(* (unsigned char *) buf)) { while (*buf != '\0' && isspace(* (unsigned char *) buf)) {
buf++; buf++;
} }
...@@ -3514,11 +3514,11 @@ static int scan_directory(struct connection *conn, const char *dir, ...@@ -3514,11 +3514,11 @@ static int scan_directory(struct connection *conn, const char *dir,
} }
mg_snprintf(path, sizeof(path), "%s%c%s", dir, '/', dp->d_name); mg_snprintf(path, sizeof(path), "%s%c%s", dir, '/', dp->d_name);
// Resize the array if nesessary // Resize the array if necessary
if (arr_ind >= arr_size) { if (arr_ind >= arr_size) {
if ((p = (struct dir_entry *) if ((p = (struct dir_entry *)
NS_REALLOC(*arr, (inc + arr_size) * sizeof(**arr))) != NULL) { NS_REALLOC(*arr, (inc + arr_size) * sizeof(**arr))) != NULL) {
// Memset new chunk to zero, otherwize st_mtime will have garbage which // Memset new chunk to zero, otherwise st_mtime will have garbage which
// can make strftime() segfault, see // can make strftime() segfault, see
// http://code.google.com/p/mongoose/issues/detail?id=79 // http://code.google.com/p/mongoose/issues/detail?id=79
memset(p + arr_size, 0, sizeof(**arr) * inc); memset(p + arr_size, 0, sizeof(**arr) * inc);
...@@ -4291,7 +4291,7 @@ static void do_ssi_include(struct mg_connection *conn, const char *ssi, ...@@ -4291,7 +4291,7 @@ static void do_ssi_include(struct mg_connection *conn, const char *ssi,
mg_snprintf(path, sizeof(path), "%s", file_name); mg_snprintf(path, sizeof(path), "%s", file_name);
} else if (sscanf(tag, " file=\"%[^\"]\"", file_name) == 1 || } else if (sscanf(tag, " file=\"%[^\"]\"", file_name) == 1 ||
sscanf(tag, " \"%[^\"]\"", file_name) == 1) { sscanf(tag, " \"%[^\"]\"", file_name) == 1) {
// File name is relative to the currect document // File name is relative to the current document
mg_snprintf(path, sizeof(path), "%s", ssi); mg_snprintf(path, sizeof(path), "%s", ssi);
if ((p = strrchr(path, '/')) != NULL) { if ((p = strrchr(path, '/')) != NULL) {
p[1] = '\0'; p[1] = '\0';
...@@ -5043,7 +5043,7 @@ int mg_get_var(const struct mg_connection *conn, const char *name, ...@@ -5043,7 +5043,7 @@ int mg_get_var(const struct mg_connection *conn, const char *name,
char *dst, size_t dst_len) { char *dst, size_t dst_len) {
int len = get_var(conn->query_string, conn->query_string == NULL ? 0 : int len = get_var(conn->query_string, conn->query_string == NULL ? 0 :
strlen(conn->query_string), name, dst, dst_len); strlen(conn->query_string), name, dst, dst_len);
if (len < 0) { if (len == -1) {
len = get_var(conn->content, conn->content_len, name, dst, dst_len); len = get_var(conn->content, conn->content_len, name, dst, dst_len);
} }
return len; return len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment