Permalink
Browse files

some small cleanup for the MSVC/Win32 build; allow 5xx/4xx/etc. HTTP …

…errors to show in the browser: don't override everything with the 'click here to restart/stop' page.
  • Loading branch information...
1 parent 6569b18 commit 071a17458cfae756c00221469723e95897dc81b1 @GerHobbelt committed Sep 26, 2012
@@ -558,7 +558,7 @@ static void *mongoose_callback(enum mg_event event, struct mg_connection *conn)
file_found = (0 == mg_stat(request_info->phys_path, &st) && !st.is_directory);
if (file_found) {
// are we looking for HTML output of MarkDown file?
- if (mg_match_prefix("**.md$|**.wiki$", -1, request_info->phys_path) > 0) {
+ if (mg_match_prefix("**.md$|**.mkd$|**.markdown$|**.wiki$", -1, request_info->phys_path) > 0) {
serve_a_markdown_page(conn, &st, (event == MG_SSI_INCLUDE_REQUEST));
return "";
}
@@ -775,7 +775,7 @@ static void *mongoose_callback(enum mg_event event, struct mg_connection *conn)
return NULL; // let mongoose handle the default of 'file exists/directory listing'...
}
- if (strstr(request_info->uri, "/restart")) {
+ if (strstr(uri, "/restart")) {
// send an info page
content_length = mg_snprintf(conn, content, sizeof(content),
"<html><body><h1>Restart in progress</h1>"
@@ -846,6 +846,11 @@ static void *mongoose_callback(enum mg_event event, struct mg_connection *conn)
} else
#endif
{
+ // allow default error processing chain:
+ if (!strncmp(uri, "/error/", 7)) {
+ return 0;
+ }
+
content_length = mg_snprintf(conn, content, sizeof(content),
"<html><body><p>Hello from mongoose! Remote port: %d."
"<p><a href=\"/restart\">Click here</a> to restart "
@@ -1424,7 +1429,7 @@ static BOOL CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam,
#if 0
// See also: http://stackoverflow.com/questions/11884021/c-why-this-window-title-gets-truncated
- // In our case, we get a clobered window title in a Unicode build.
+ // In our case, we get a clobbered window title in a Unicode build.
if(IsWindowUnicode(hWnd))
return DefWindowProcW(hWnd, msg, wParam, lParam);
else
View
@@ -6,12 +6,13 @@
<style>
#biohazard
{
- width: 130px;
- height: 130px;
+ width: 415px;
+ height: 393px;
}
div#biohazdiv
{
float: left;
+ margin: 0 1em 1em 0;
}
</style>
<body>
@@ -1,6 +1,18 @@
// Microsoft Visual C++ generated resource script.
//
#include "mongoose_book_samples_server.resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+//#include "../../mongoose_sys_porting.h"
+#include <windows.h>
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
@@ -37,12 +49,13 @@ END
2 TEXTINCLUDE
BEGIN
+ "//#include ""../../mongoose_sys_porting.h""\r\n"
+ "#include <windows.h>\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
- "\r\n"
"\0"
END
@@ -87,18 +100,9 @@ BEGIN
END
#endif // APSTUDIO_INVOKED
-#endif // English (United States) resources
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef APSTUDIO_INVOKED
+#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
@@ -1,30 +1,3 @@
-// Copyright (c) 2004-2012 Sergey Lyubka
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#ifndef RESOURCE_HEADER_INCLUDED
-#define RESOURCE_HEADER_INCLUDED
-
-//#include "../../mongoose_sys_porting.h"
-#include <windows.h>
-
-
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by mongoose_book_samples_server.rc
@@ -40,11 +13,10 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NO_MFC 1
+#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1002
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
-
-#endif
@@ -490,7 +490,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\examples\mongoose_book_samples_server.resource.h" />
- <ClInclude Include="..\examples\resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\examples\mongoose_book_samples_server.rc" />
@@ -46,6 +46,5 @@
<ClInclude Include="..\examples\mongoose_book_samples_server.resource.h">
<Filter>Resources</Filter>
</ClInclude>
- <ClInclude Include="..\examples\resource.h" />
</ItemGroup>
</Project>

0 comments on commit 071a174

Please sign in to comment.