|
@@ -3279,16 +3279,16 @@ static int check_authorization(struct mg_connection *conn, const char *path)
|
|
|
|
|
|
static void send_authorization_request(struct mg_connection *conn)
|
|
|
{
|
|
|
- char date[64];
|
|
|
- time_t curtime = time(NULL);
|
|
|
- unsigned long nonce = (unsigned long)(conn->ctx->start_time);
|
|
|
-
|
|
|
+ char date[64];
|
|
|
+ time_t curtime = time(NULL);
|
|
|
+ unsigned long nonce = (unsigned long)(conn->ctx->start_time);
|
|
|
+
|
|
|
(void)pthread_mutex_lock(&conn->ctx->nonce_mutex);
|
|
|
nonce += conn->ctx->nonce_count;
|
|
|
++conn->ctx->nonce_count;
|
|
|
- (void)pthread_mutex_unlock(&conn->ctx->nonce_mutex);
|
|
|
-
|
|
|
- nonce ^= (unsigned long)(conn->ctx);
|
|
|
+ (void)pthread_mutex_unlock(&conn->ctx->nonce_mutex);
|
|
|
+
|
|
|
+ nonce ^= (unsigned long)(conn->ctx);
|
|
|
conn->status_code = 401;
|
|
|
conn->must_close = 1;
|
|
|
|
|
@@ -4488,7 +4488,7 @@ static void mkcol(struct mg_connection *conn, const char *path)
|
|
|
{
|
|
|
int rc, body_len;
|
|
|
struct de de;
|
|
|
- char date[64];
|
|
|
+ char date[64];
|
|
|
time_t curtime = time(NULL);
|
|
|
|
|
|
memset(&de.file, 0, sizeof(de.file));
|
|
@@ -4539,7 +4539,7 @@ static void put_file(struct mg_connection *conn, const char *path)
|
|
|
const char *range;
|
|
|
int64_t r1, r2;
|
|
|
int rc;
|
|
|
- char date[64];
|
|
|
+ char date[64];
|
|
|
time_t curtime = time(NULL);
|
|
|
|
|
|
conn->status_code = mg_stat(conn, path, &file) ? 200 : 201;
|
|
@@ -4813,7 +4813,7 @@ static void handle_propfind(struct mg_connection *conn, const char *path,
|
|
|
struct file *filep)
|
|
|
{
|
|
|
const char *depth = mg_get_header(conn, "Depth");
|
|
|
- char date[64];
|
|
|
+ char date[64];
|
|
|
time_t curtime = time(NULL);
|
|
|
|
|
|
gmt_time_string(date, sizeof(date), &curtime);
|
|
@@ -5155,9 +5155,9 @@ static void read_websocket(struct mg_connection *conn)
|
|
|
|
|
|
/* Copy the mask before we shift the queue and destroy it */
|
|
|
if (mask_len > 0) {
|
|
|
- *(uint32_t*)mask = *(uint32_t*)(buf + header_len - mask_len);
|
|
|
+ memcpy(mask, buf + header_len - mask_len, sizeof(mask));
|
|
|
} else {
|
|
|
- *(uint32_t*)mask = 0;
|
|
|
+ memset(mask, 0, sizeof(mask));
|
|
|
}
|
|
|
|
|
|
/* Read frame payload from the first message in the queue into
|
|
@@ -5648,10 +5648,10 @@ static int use_request_handler(struct mg_connection *conn)
|
|
|
|
|
|
return tmp_rh->handler(conn, tmp_rh->cbdata);
|
|
|
}
|
|
|
-
|
|
|
- /* try for pattern match */
|
|
|
- if (match_prefix(tmp_rh->uri, tmp_rh->uri_len, uri) > 0) {
|
|
|
- return tmp_rh->handler(conn, tmp_rh->cbdata);
|
|
|
+
|
|
|
+ /* try for pattern match */
|
|
|
+ if (match_prefix(tmp_rh->uri, tmp_rh->uri_len, uri) > 0) {
|
|
|
+ return tmp_rh->handler(conn, tmp_rh->cbdata);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -5669,7 +5669,7 @@ static void handle_request(struct mg_connection *conn)
|
|
|
char path[PATH_MAX];
|
|
|
int uri_len, ssl_index, is_script_resource;
|
|
|
struct file file = STRUCT_FILE_INITIALIZER;
|
|
|
- char date[64];
|
|
|
+ char date[64];
|
|
|
time_t curtime = time(NULL);
|
|
|
|
|
|
if ((conn->request_info.query_string = strchr(ri->uri, '?')) != NULL) {
|
|
@@ -6861,15 +6861,15 @@ static void get_system_name(char **sysName)
|
|
|
#if defined(_WIN32)
|
|
|
#if !defined(__SYMBIAN32__)
|
|
|
char name[128];
|
|
|
- DWORD dwVersion = 0;
|
|
|
- DWORD dwMajorVersion = 0;
|
|
|
- DWORD dwMinorVersion = 0;
|
|
|
+ DWORD dwVersion = 0;
|
|
|
+ DWORD dwMajorVersion = 0;
|
|
|
+ DWORD dwMinorVersion = 0;
|
|
|
DWORD dwBuild = 0;
|
|
|
|
|
|
- dwVersion = GetVersion();
|
|
|
-
|
|
|
- dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
|
|
|
- dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
|
|
|
+ dwVersion = GetVersion();
|
|
|
+
|
|
|
+ dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
|
|
|
+ dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
|
|
|
dwBuild = ((dwVersion < 0x80000000) ? (DWORD)(HIWORD(dwVersion)) : 0);
|
|
|
|
|
|
sprintf(name, "Windows %d.%d", dwMajorVersion, dwMinorVersion);
|