From cc4a4fb2abcdb6da8f625ce04fa54c1b9e37f3c1 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Sat, 16 Feb 2013 15:26:11 +0000 Subject: [PATCH 1/9] Added http_error() to struct mg_callbacks --- UserManual.md | 1 + 1 file changed, 1 insertion(+) diff --git a/UserManual.md b/UserManual.md index aac3f3f9..b4c6aa4c 100644 --- a/UserManual.md +++ b/UserManual.md @@ -335,6 +335,7 @@ To start the embedded web server, call `mg_start()`. To stop it, call const char *path, size_t *data_len); void (*init_lua)(struct mg_connection *, void *lua_context); void (*upload)(struct mg_connection *, const char *file_name); + int (*http_error)(struct mg_connection *, int status); }; [hello.c](https://github.com/valenok/mongoose/blob/master/examples/hello.c) From a123874ac56cd3e3a0223eca96d71a3f6d7be79e Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Thu, 21 Feb 2013 22:58:51 +0000 Subject: [PATCH 2/9] Updated readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bf9b842c..162ad045 100644 --- a/README.md +++ b/README.md @@ -54,8 +54,8 @@ to all who already did so: T.Barmann, D.Hughes, J.C.Sloan, R.Romeo, L.E.Spencer, S.Kotay, R.M.Shorter and 7 others. Appreciated guys, you keep my brains going! Cash is also welcome indeed. Press [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DGZ2FMP95TAL6) -button to donate. Donation progress: 189/1000 € +button to donate. Donation progress: 239/1000 € (thanks to O.M.Vilhunen, C.Radik, G.Woodcock, M.Szczepkowski, -Eternal Lands Development Team, T.Tollet, C.Tangerino) +Eternal Lands Development Team, T.Tollet, C.Tangerino, G.Karsai, A.Bourgett) -![Progress](http://chart.googleapis.com/chart?chxr=0,0,1000&chxt=x&chbh=30,0,0&chs=300x35&cht=bhs&chco=90c0f0&chd=t:18.9) +![Progress](http://chart.googleapis.com/chart?chxr=0,0,1000&chxt=x&chbh=30,0,0&chs=300x35&cht=bhs&chco=90c0f0&chd=t:23.9) From 1c6036c3ac8001d97e2c62d160863aac428d2e72 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Fri, 22 Feb 2013 08:08:47 +0000 Subject: [PATCH 3/9] Updated readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 162ad045..54bb66b6 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ community for free is If you feel grateful for the stuff I've done, you can buy me a book from my [Amazon wishlist](http://amzn.com/w/1OC2ZCPTQYIEP?sort=priority). Many thanks to all who already did so: T.Barmann, D.Hughes, J.C.Sloan, R.Romeo, -L.E.Spencer, S.Kotay, R.M.Shorter and 7 others. +L.E.Spencer, S.Kotay, R.M.Shorter, W.Mar, J.Wilander and 7 others. Appreciated guys, you keep my brains going! Cash is also welcome indeed. Press [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DGZ2FMP95TAL6) button to donate. Donation progress: 239/1000 € From 08708435a753098fd23e9a2eb59569ae47d7cb12 Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Sat, 23 Feb 2013 10:37:45 +0800 Subject: [PATCH 4/9] avoid defining macros already present on mingw32 --- main.c | 7 +++++++ mongoose.c | 3 +++ 2 files changed, 10 insertions(+) diff --git a/main.c b/main.c index 4993b82b..8c477831 100644 --- a/main.c +++ b/main.c @@ -41,8 +41,15 @@ #include #include #include + +#ifndef PATH_MAX #define PATH_MAX MAX_PATH +#endif + +#ifndef S_ISDIR #define S_ISDIR(x) ((x) & _S_IFDIR) +#endif + #define DIRSEP '\\' #define snprintf _snprintf #define vsnprintf _vsnprintf diff --git a/mongoose.c b/mongoose.c index 7399c5ca..3cb1be74 100644 --- a/mongoose.c +++ b/mongoose.c @@ -139,7 +139,10 @@ typedef long off_t; #define flockfile(x) EnterCriticalSection(&global_log_file_lock) #define funlockfile(x) LeaveCriticalSection(&global_log_file_lock) #define sleep(x) Sleep((x) * 1000) + +#if !defined(va_copy) #define va_copy(x, y) x = y +#endif // !va_copy MINGW #defines va_copy #if !defined(fileno) #define fileno(x) _fileno(x) From affd82a88518f1ed4df790b47a4071592a3fee09 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Sun, 24 Feb 2013 07:56:41 +0000 Subject: [PATCH 5/9] updated readme --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 54bb66b6..e868c332 100644 --- a/README.md +++ b/README.md @@ -54,8 +54,9 @@ to all who already did so: T.Barmann, D.Hughes, J.C.Sloan, R.Romeo, L.E.Spencer, S.Kotay, R.M.Shorter, W.Mar, J.Wilander and 7 others. Appreciated guys, you keep my brains going! Cash is also welcome indeed. Press [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DGZ2FMP95TAL6) -button to donate. Donation progress: 239/1000 € +button to donate. Donation progress: 249/1000 € (thanks to O.M.Vilhunen, C.Radik, G.Woodcock, M.Szczepkowski, -Eternal Lands Development Team, T.Tollet, C.Tangerino, G.Karsai, A.Bourgett) +Eternal Lands Development Team, T.Tollet, C.Tangerino, G.Karsai, A.Bourgett, +C.Blakemore) -![Progress](http://chart.googleapis.com/chart?chxr=0,0,1000&chxt=x&chbh=30,0,0&chs=300x35&cht=bhs&chco=90c0f0&chd=t:23.9) +![Progress](http://chart.googleapis.com/chart?chxr=0,0,1000&chxt=x&chbh=30,0,0&chs=300x35&cht=bhs&chco=90c0f0&chd=t:24.9) From d3c02331d47cc1653a195f6b2d023772eaaaa3df Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Sun, 24 Feb 2013 23:22:34 +0800 Subject: [PATCH 6/9] squash mingw printf format warning --- mongoose.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mongoose.c b/mongoose.c index 3cb1be74..8459a43e 100644 --- a/mongoose.c +++ b/mongoose.c @@ -1336,7 +1336,7 @@ static pid_t spawn_process(struct mg_connection *conn, const char *prog, DEBUG_TRACE(("Running [%s]", cmdline)); if (CreateProcessA(NULL, cmdline, NULL, NULL, TRUE, CREATE_NEW_PROCESS_GROUP, envblk, NULL, &si, &pi) == 0) { - cry(conn, "%s: CreateProcess(%s): %d", + cry(conn, "%s: CreateProcess(%s): %ld", __func__, cmdline, ERRNO); pi.hProcess = (pid_t) -1; } @@ -5195,7 +5195,7 @@ struct mg_context *mg_start(const struct mg_callbacks *callbacks, // Start worker threads for (i = 0; i < atoi(ctx->config[NUM_THREADS]); i++) { if (mg_start_thread(worker_thread, ctx) != 0) { - cry(fc(ctx), "Cannot start worker thread: %d", ERRNO); + cry(fc(ctx), "Cannot start worker thread: %ld", ERRNO); } else { ctx->num_threads++; } From a2239c2b4b86a3ecaf19282143fa03c0b4366ac4 Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Sun, 24 Feb 2013 23:29:05 +0800 Subject: [PATCH 7/9] squash mingw variable set but not used warning --- mongoose.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mongoose.c b/mongoose.c index 8459a43e..a17d1e45 100644 --- a/mongoose.c +++ b/mongoose.c @@ -1018,14 +1018,11 @@ static void change_slashes_to_backslashes(char *path) { // Encode 'path' which is assumed UTF-8 string, into UNICODE string. // wbuf and wbuf_len is a target buffer and its length. static void to_unicode(const char *path, wchar_t *wbuf, size_t wbuf_len) { - char buf[PATH_MAX], buf2[PATH_MAX], *p; + char buf[PATH_MAX], buf2[PATH_MAX]; mg_strlcpy(buf, path, sizeof(buf)); change_slashes_to_backslashes(buf); - // Point p to the end of the file name - p = buf + strlen(buf) - 1; - // Convert to Unicode and back. If doubly-converted string does not // match the original, something is fishy, reject. memset(wbuf, 0, wbuf_len * sizeof(wchar_t)); From d8536b011cca06b77e2dae26a0731071ed254d7d Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Sun, 24 Feb 2013 23:41:32 +0800 Subject: [PATCH 8/9] portable socket type should be SOCKET --- mongoose.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mongoose.c b/mongoose.c index a17d1e45..5b715c01 100644 --- a/mongoose.c +++ b/mongoose.c @@ -4693,7 +4693,7 @@ struct mg_connection *mg_connect(const char *host, int port, int use_ssl, struct mg_connection *conn = NULL; struct sockaddr_in sin; struct hostent *he; - int sock; + SOCKET sock; if (host == NULL) { snprintf(ebuf, ebuf_len, "%s", "NULL host"); From e47b5b775a56fa4062ee51a6e55fe3e9a70d04d8 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Sun, 24 Feb 2013 20:34:32 +0000 Subject: [PATCH 9/9] Squashed warning --- mongoose.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mongoose.c b/mongoose.c index 5b715c01..dce1a370 100644 --- a/mongoose.c +++ b/mongoose.c @@ -5192,7 +5192,7 @@ struct mg_context *mg_start(const struct mg_callbacks *callbacks, // Start worker threads for (i = 0; i < atoi(ctx->config[NUM_THREADS]); i++) { if (mg_start_thread(worker_thread, ctx) != 0) { - cry(fc(ctx), "Cannot start worker thread: %ld", ERRNO); + cry(fc(ctx), "Cannot start worker thread: %ld", (long) ERRNO); } else { ctx->num_threads++; }