mirror of
https://github.com/lammertb/libhttp.git
synced 2025-08-09 03:22:45 +03:00
Remove windows specific code from example
This commit is contained in:
@@ -202,9 +202,15 @@ class FooHandler : public CivetHandler
|
|||||||
char buf[1024];
|
char buf[1024];
|
||||||
int fail = 0;
|
int fail = 0;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
_snprintf(buf, sizeof(buf), "D:\\somewhere\\%s\\%s", req_info->remote_user, req_info->local_uri);
|
_snprintf(buf, sizeof(buf), "D:\\somewhere\\%s\\%s", req_info->remote_user, req_info->local_uri);
|
||||||
buf[sizeof(buf)-1] = 0; /* TODO: check overflow */
|
buf[sizeof(buf)-1] = 0; /* TODO: check overflow */
|
||||||
f = fopen_recursive(buf, "wb");
|
f = fopen_recursive(buf, "wb");
|
||||||
|
#else
|
||||||
|
snprintf(buf, sizeof(buf), "~/somewhere/%s/%s", req_info->remote_user, req_info->local_uri);
|
||||||
|
buf[sizeof(buf)-1] = 0; /* TODO: check overflow */
|
||||||
|
f = fopen_recursive(buf, "w");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
fail = 1;
|
fail = 1;
|
||||||
@@ -234,13 +240,11 @@ class FooHandler : public CivetHandler
|
|||||||
"HTTP/1.1 409 Conflict\r\n"
|
"HTTP/1.1 409 Conflict\r\n"
|
||||||
"Content-Type: text/plain\r\n"
|
"Content-Type: text/plain\r\n"
|
||||||
"Connection: close\r\n\r\n");
|
"Connection: close\r\n\r\n");
|
||||||
MessageBeep(MB_ICONERROR);
|
|
||||||
} else {
|
} else {
|
||||||
mg_printf(conn,
|
mg_printf(conn,
|
||||||
"HTTP/1.1 201 Created\r\n"
|
"HTTP/1.1 201 Created\r\n"
|
||||||
"Content-Type: text/plain\r\n"
|
"Content-Type: text/plain\r\n"
|
||||||
"Connection: close\r\n\r\n");
|
"Connection: close\r\n\r\n");
|
||||||
MessageBeep(MB_OK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user