Commit 464113c5 authored by Sergey Lyubka's avatar Sergey Lyubka

Sync mongoose changes

PUBLISHED_FROM=8b6ebf46728aca40f916dde88e372b4540ed6ea4
parent c34f6c54
...@@ -58,11 +58,11 @@ static int check_pass(const char *user, const char *pass) { ...@@ -58,11 +58,11 @@ static int check_pass(const char *user, const char *pass) {
* or NULL if not found. * or NULL if not found.
*/ */
static struct session *get_session(struct http_message *hm) { static struct session *get_session(struct http_message *hm) {
struct mg_str *cookie_header = mg_get_http_header(hm, "cookie");
if (cookie_header == NULL) goto clean;
char ssid_buf[21]; char ssid_buf[21];
char *ssid = ssid_buf; char *ssid = ssid_buf;
struct session *ret = NULL; struct session *ret = NULL;
struct mg_str *cookie_header = mg_get_http_header(hm, "cookie");
if (cookie_header == NULL) goto clean;
if (!mg_http_parse_header2(cookie_header, SESSION_COOKIE_NAME, &ssid, if (!mg_http_parse_header2(cookie_header, SESSION_COOKIE_NAME, &ssid,
sizeof(ssid_buf))) { sizeof(ssid_buf))) {
goto clean; goto clean;
......
...@@ -8526,7 +8526,8 @@ MG_INTERNAL void mg_send_http_file(struct mg_connection *nc, char *path, ...@@ -8526,7 +8526,8 @@ MG_INTERNAL void mg_send_http_file(struct mg_connection *nc, char *path,
#endif #endif
} else if (mg_is_not_modified(hm, &st)) { } else if (mg_is_not_modified(hm, &st)) {
/* Note: not using mg_http_send_error in order to keep connection alive */ /* Note: not using mg_http_send_error in order to keep connection alive */
mg_send_head(nc, 304, 0, NULL); /* Note: passing extra headers allow users to control session cookies */
mg_send_head(nc, 304, 0, opts->extra_headers);
} else { } else {
mg_http_serve_file2(nc, index_file ? index_file : path, hm, opts); mg_http_serve_file2(nc, index_file ? index_file : path, hm, opts);
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#ifndef CS_MONGOOSE_SRC_COMMON_H_ #ifndef CS_MONGOOSE_SRC_COMMON_H_
#define CS_MONGOOSE_SRC_COMMON_H_ #define CS_MONGOOSE_SRC_COMMON_H_
#define MG_VERSION "6.15" #define MG_VERSION "6.16"
/* Local tweaks, applied before any of Mongoose's own headers. */ /* Local tweaks, applied before any of Mongoose's own headers. */
#ifdef MG_LOCALS #ifdef MG_LOCALS
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#ifndef CS_MONGOOSE_SRC_COMMON_H_ #ifndef CS_MONGOOSE_SRC_COMMON_H_
#define CS_MONGOOSE_SRC_COMMON_H_ #define CS_MONGOOSE_SRC_COMMON_H_
#define MG_VERSION "6.15" #define MG_VERSION "6.16"
/* Local tweaks, applied before any of Mongoose's own headers. */ /* Local tweaks, applied before any of Mongoose's own headers. */
#ifdef MG_LOCALS #ifdef MG_LOCALS
......
...@@ -2692,7 +2692,8 @@ MG_INTERNAL void mg_send_http_file(struct mg_connection *nc, char *path, ...@@ -2692,7 +2692,8 @@ MG_INTERNAL void mg_send_http_file(struct mg_connection *nc, char *path,
#endif #endif
} else if (mg_is_not_modified(hm, &st)) { } else if (mg_is_not_modified(hm, &st)) {
/* Note: not using mg_http_send_error in order to keep connection alive */ /* Note: not using mg_http_send_error in order to keep connection alive */
mg_send_head(nc, 304, 0, NULL); /* Note: passing extra headers allow users to control session cookies */
mg_send_head(nc, 304, 0, opts->extra_headers);
} else { } else {
mg_http_serve_file2(nc, index_file ? index_file : path, hm, opts); mg_http_serve_file2(nc, index_file ? index_file : path, hm, opts);
} }
......
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