Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
08048bd5
Commit
08048bd5
authored
Feb 25, 2013
by
abadc0de
Browse files
Options
Browse Files
Download
Plain Diff
Merge
https://github.com/valenok/mongoose
parents
800517ac
e47b5b77
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
11 deletions
+20
-11
README.md
README.md
+5
-4
UserManual.md
UserManual.md
+1
-0
main.c
main.c
+7
-0
mongoose.c
mongoose.c
+7
-7
No files found.
README.md
View file @
08048bd5
...
@@ -51,11 +51,12 @@ community for free is
...
@@ -51,11 +51,12 @@ community for free is
If you feel grateful for the stuff I've done, you can buy me a book from my
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
[
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,
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.
Appreciated guys, you keep my brains going! Cash is also welcome indeed.
Press
[
<img src="http://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif">
](
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DGZ2FMP95TAL6
)
Press
[
<img src="http://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif">
](
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DGZ2FMP95TAL6
)
button to donate. Donation progress:
18
9/1000
€
button to donate. Donation progress:
24
9/1000
€
(thanks to O.M.Vilhunen, C.Radik, G.Woodcock, M.Szczepkowski,
(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,
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:
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:
24
.9
)
UserManual.md
View file @
08048bd5
...
@@ -335,6 +335,7 @@ To start the embedded web server, call `mg_start()`. To stop it, call
...
@@ -335,6 +335,7 @@ To start the embedded web server, call `mg_start()`. To stop it, call
const char *path, size_t *data_len);
const char *path, size_t *data_len);
void (*init_lua)(struct mg_connection *, void *lua_context);
void (*init_lua)(struct mg_connection *, void *lua_context);
void (*upload)(struct mg_connection *, const char *file_name);
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
)
[
hello.c
](
https://github.com/valenok/mongoose/blob/master/examples/hello.c
)
...
...
main.c
View file @
08048bd5
...
@@ -41,8 +41,15 @@
...
@@ -41,8 +41,15 @@
#include <windows.h>
#include <windows.h>
#include <winsvc.h>
#include <winsvc.h>
#include <shlobj.h>
#include <shlobj.h>
#ifndef PATH_MAX
#define PATH_MAX MAX_PATH
#define PATH_MAX MAX_PATH
#endif
#ifndef S_ISDIR
#define S_ISDIR(x) ((x) & _S_IFDIR)
#define S_ISDIR(x) ((x) & _S_IFDIR)
#endif
#define DIRSEP '\\'
#define DIRSEP '\\'
#define snprintf _snprintf
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#define vsnprintf _vsnprintf
...
...
mongoose.c
View file @
08048bd5
...
@@ -139,7 +139,10 @@ typedef long off_t;
...
@@ -139,7 +139,10 @@ typedef long off_t;
#define flockfile(x) EnterCriticalSection(&global_log_file_lock)
#define flockfile(x) EnterCriticalSection(&global_log_file_lock)
#define funlockfile(x) LeaveCriticalSection(&global_log_file_lock)
#define funlockfile(x) LeaveCriticalSection(&global_log_file_lock)
#define sleep(x) Sleep((x) * 1000)
#define sleep(x) Sleep((x) * 1000)
#if !defined(va_copy)
#define va_copy(x, y) x = y
#define va_copy(x, y) x = y
#endif // !va_copy MINGW #defines va_copy
#if !defined(fileno)
#if !defined(fileno)
#define fileno(x) _fileno(x)
#define fileno(x) _fileno(x)
...
@@ -1015,14 +1018,11 @@ static void change_slashes_to_backslashes(char *path) {
...
@@ -1015,14 +1018,11 @@ static void change_slashes_to_backslashes(char *path) {
// Encode 'path' which is assumed UTF-8 string, into UNICODE string.
// Encode 'path' which is assumed UTF-8 string, into UNICODE string.
// wbuf and wbuf_len is a target buffer and its length.
// 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
)
{
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
));
mg_strlcpy
(
buf
,
path
,
sizeof
(
buf
));
change_slashes_to_backslashes
(
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
// Convert to Unicode and back. If doubly-converted string does not
// match the original, something is fishy, reject.
// match the original, something is fishy, reject.
memset
(
wbuf
,
0
,
wbuf_len
*
sizeof
(
wchar_t
));
memset
(
wbuf
,
0
,
wbuf_len
*
sizeof
(
wchar_t
));
...
@@ -1333,7 +1333,7 @@ static pid_t spawn_process(struct mg_connection *conn, const char *prog,
...
@@ -1333,7 +1333,7 @@ static pid_t spawn_process(struct mg_connection *conn, const char *prog,
DEBUG_TRACE
((
"Running [%s]"
,
cmdline
));
DEBUG_TRACE
((
"Running [%s]"
,
cmdline
));
if
(
CreateProcessA
(
NULL
,
cmdline
,
NULL
,
NULL
,
TRUE
,
if
(
CreateProcessA
(
NULL
,
cmdline
,
NULL
,
NULL
,
TRUE
,
CREATE_NEW_PROCESS_GROUP
,
envblk
,
NULL
,
&
si
,
&
pi
)
==
0
)
{
CREATE_NEW_PROCESS_GROUP
,
envblk
,
NULL
,
&
si
,
&
pi
)
==
0
)
{
cry
(
conn
,
"%s: CreateProcess(%s): %d"
,
cry
(
conn
,
"%s: CreateProcess(%s): %
l
d"
,
__func__
,
cmdline
,
ERRNO
);
__func__
,
cmdline
,
ERRNO
);
pi
.
hProcess
=
(
pid_t
)
-
1
;
pi
.
hProcess
=
(
pid_t
)
-
1
;
}
}
...
@@ -4835,7 +4835,7 @@ struct mg_connection *mg_connect(const char *host, int port, int use_ssl,
...
@@ -4835,7 +4835,7 @@ struct mg_connection *mg_connect(const char *host, int port, int use_ssl,
struct
mg_connection
*
conn
=
NULL
;
struct
mg_connection
*
conn
=
NULL
;
struct
sockaddr_in
sin
;
struct
sockaddr_in
sin
;
struct
hostent
*
he
;
struct
hostent
*
he
;
int
sock
;
SOCKET
sock
;
if
(
host
==
NULL
)
{
if
(
host
==
NULL
)
{
snprintf
(
ebuf
,
ebuf_len
,
"%s"
,
"NULL host"
);
snprintf
(
ebuf
,
ebuf_len
,
"%s"
,
"NULL host"
);
...
@@ -5334,7 +5334,7 @@ struct mg_context *mg_start(const struct mg_callbacks *callbacks,
...
@@ -5334,7 +5334,7 @@ struct mg_context *mg_start(const struct mg_callbacks *callbacks,
// Start worker threads
// Start worker threads
for
(
i
=
0
;
i
<
atoi
(
ctx
->
config
[
NUM_THREADS
]);
i
++
)
{
for
(
i
=
0
;
i
<
atoi
(
ctx
->
config
[
NUM_THREADS
]);
i
++
)
{
if
(
mg_start_thread
(
worker_thread
,
ctx
)
!=
0
)
{
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"
,
(
long
)
ERRNO
);
}
else
{
}
else
{
ctx
->
num_threads
++
;
ctx
->
num_threads
++
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment