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
4f716e2b
Commit
4f716e2b
authored
Aug 25, 2010
by
valenok
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed win32 build
parent
7ad045bc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
24 deletions
+28
-24
Makefile
Makefile
+11
-11
mongoose.c
mongoose.c
+14
-8
dll.def
win32/dll.def
+3
-5
No files found.
Makefile
View file @
4f716e2b
...
@@ -13,7 +13,6 @@ all:
...
@@ -13,7 +13,6 @@ all:
# -DNO_CGI - disable CGI support (-5kb)
# -DNO_CGI - disable CGI support (-5kb)
# -DNO_SSL - disable SSL functionality (-2kb)
# -DNO_SSL - disable SSL functionality (-2kb)
# -DCONFIG_FILE=\"file\" - use `file' as the default config file
# -DCONFIG_FILE=\"file\" - use `file' as the default config file
# -DNO_SSI - disable SSI support (-4kb)
# -DHAVE_STRTOUI64 - use system strtoui64() function for strtoull()
# -DHAVE_STRTOUI64 - use system strtoui64() function for strtoull()
...
@@ -54,19 +53,20 @@ solaris:
...
@@ -54,19 +53,20 @@ solaris:
# Assuming that studio is installed in d:\vc6, change VC variable below to
# Assuming that studio is installed in d:\vc6, change VC variable below to
# the correct path on your system. Run "d:\vc6\bin\nmake windows"
# the correct path on your system. Run "d:\vc6\bin\nmake windows"
VC
=
d:
\v
c2010
\v
c
VC
=
q:
\v
c6
#VC= d:\vc6
OUT
=
c:
\o
ut
SDK
=
d:
\s
dk
\v
7.1
#WINDBG= /Zi /DDEBUG /Od /DDEBUG
#WINDBG= /Zi /DDEBUG /Od /DDEBUG
WINDBG
=
/DNDEBUG /Os
WINDBG
=
/DNDEBUG
#/Os
WINFLAGS
=
/MT /TC /nologo /W4
$(WINDBG)
/I
$(VC)
/include
\
CLFLAGS
=
/MD /TC /nologo /W4 /c
$(WINDBG)
/I
$(VC)
/include
/I
$(SDK)
\i
nclude /link /incremental:no /libpath:
$(VC)
\l
ib
\
LINKFLAGS
=
/incremental:no /libpath:
$(VC)
\l
ib ws2_32.lib
/libpath:
$(SDK)
/lib ws2_32.lib
windows
:
windows
:
$(VC)
\b
in
\c
l.exe mongoose.c
$(WINFLAGS)
\
$(VC)
\b
in
\c
l main.c
$(CLFLAGS)
/Fo
$(OUT)
\m
ain.obj
/DLL /DEF:win32
\d
ll.def /out:_
$(PROG)
.dll
$(VC)
\b
in
\c
l mongoose.c
$(CLFLAGS)
/Fo
$(OUT)
\m
ongoose.obj
$(VC)
\b
in
\c
l.exe mongoose.c main.c
$(WINFLAGS)
/out:
$(PROG)
.exe
$(VC)
\b
in
\l
ink
$(OUT)
\m
ongoose.obj
$(LINKFLAGS)
\
/DLL /DEF:win32
\d
ll.def /out:
$(OUT)
\_
$(PROG)
.dll
$(VC)
\b
in
\l
ink
$(OUT)
\m
ain.obj
$(OUT)
\m
ongoose.obj
$(LINKFLAGS)
\
/out:
$(OUT)
\$
(
PROG
)
.exe
# Build for Windows under MinGW
# Build for Windows under MinGW
#MINGWDBG= -DDEBUG -O0
#MINGWDBG= -DDEBUG -O0
...
...
mongoose.c
View file @
4f716e2b
...
@@ -66,10 +66,10 @@ typedef long off_t;
...
@@ -66,10 +66,10 @@ typedef long off_t;
#define strerror(x) _ultoa(x, (char *) _alloca(sizeof(x) *3 ), 10)
#define strerror(x) _ultoa(x, (char *) _alloca(sizeof(x) *3 ), 10)
#endif // _WIN32_WCE
#endif // _WIN32_WCE
#define EPOCH_DIFF 0x019DB1DED53E8000ULL // 116444736000000000 nsecs
#define RATE_DIFF 10000000 // 100 nsecs
#define MAKEUQUAD(lo, hi) ((uint64_t)(((uint32_t)(lo)) | \
#define MAKEUQUAD(lo, hi) ((uint64_t)(((uint32_t)(lo)) | \
((
uint64_t
)((
uint32_t
)(
hi
)))
<<
32
))
((
uint64_t
)((
uint32_t
)(
hi
)))
<<
32
))
#define RATE_DIFF 10000000 // 100 nsecs
#define EPOCH_DIFF MAKEUQUAD(0xd53e8000, 0x019db1de)
#define SYS2UNIX_TIME(lo, hi) \
#define SYS2UNIX_TIME(lo, hi) \
(
time_t
)
((
MAKEUQUAD
((
lo
),
(
hi
))
-
EPOCH_DIFF
)
/
RATE_DIFF
)
(
time_t
)
((
MAKEUQUAD
((
lo
),
(
hi
))
-
EPOCH_DIFF
)
/
RATE_DIFF
)
...
@@ -651,6 +651,10 @@ static int pthread_cond_signal(pthread_cond_t *cv) {
...
@@ -651,6 +651,10 @@ static int pthread_cond_signal(pthread_cond_t *cv) {
return
SetEvent
(
*
cv
)
==
0
?
-
1
:
0
;
return
SetEvent
(
*
cv
)
==
0
?
-
1
:
0
;
}
}
static
int
pthread_cond_broadcast
(
pthread_cond_t
*
cv
)
{
return
PulseEvent
(
*
cv
)
==
0
?
-
1
:
0
;
}
static
int
pthread_cond_destroy
(
pthread_cond_t
*
cv
)
{
static
int
pthread_cond_destroy
(
pthread_cond_t
*
cv
)
{
return
CloseHandle
(
*
cv
)
==
0
?
-
1
:
0
;
return
CloseHandle
(
*
cv
)
==
0
?
-
1
:
0
;
}
}
...
@@ -804,7 +808,7 @@ static int mg_stat(const char *path, struct mgstat *stp) {
...
@@ -804,7 +808,7 @@ static int mg_stat(const char *path, struct mgstat *stp) {
if
(
GetFileAttributesExW
(
wbuf
,
GetFileExInfoStandard
,
&
info
)
!=
0
)
{
if
(
GetFileAttributesExW
(
wbuf
,
GetFileExInfoStandard
,
&
info
)
!=
0
)
{
stp
->
size
=
MAKEUQUAD
(
info
.
nFileSizeLow
,
info
.
nFileSizeHigh
);
stp
->
size
=
MAKEUQUAD
(
info
.
nFileSizeLow
,
info
.
nFileSizeHigh
);
stp
->
mtime
=
SYS2UNIX_TIME
(
info
.
ftLastWriteTime
.
dwLowDateTime
,
stp
->
mtime
=
SYS2UNIX_TIME
(
info
.
ftLastWriteTime
.
dwLowDateTime
,
info
.
ftLastWriteTime
.
dwHighDateTime
);
info
.
ftLastWriteTime
.
dwHighDateTime
);
stp
->
is_directory
=
stp
->
is_directory
=
info
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
;
info
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
;
ok
=
0
;
// Success
ok
=
0
;
// Success
...
@@ -916,16 +920,17 @@ static int start_thread(struct mg_context *ctx, mg_thread_func_t func,
...
@@ -916,16 +920,17 @@ static int start_thread(struct mg_context *ctx, mg_thread_func_t func,
return
hThread
==
NULL
?
-
1
:
0
;
return
hThread
==
NULL
?
-
1
:
0
;
}
}
#if 0
static HANDLE dlopen(const char *dll_name, int flags) {
static HANDLE dlopen(const char *dll_name, int flags) {
wchar_t wbuf[PATH_MAX];
wchar_t wbuf[PATH_MAX];
flags = 0; // Unused
flags = 0; // Unused
to_unicode(dll_name, wbuf, ARRAY_SIZE(wbuf));
to_unicode(dll_name, wbuf, ARRAY_SIZE(wbuf));
return LoadLibraryW(wbuf);
return LoadLibraryW(wbuf);
}
}
#endif
#if !defined(NO_CGI)
#if !defined(NO_CGI)
#define SIGKILL 0
static
int
kill
(
pid_t
pid
,
int
sig_num
)
{
static
int
kill
(
pid_t
pid
,
int
sig_num
)
{
(
void
)
TerminateProcess
(
pid
,
sig_num
);
(
void
)
TerminateProcess
(
pid
,
sig_num
);
(
void
)
CloseHandle
(
pid
);
(
void
)
CloseHandle
(
pid
);
...
@@ -958,7 +963,7 @@ static pid_t spawn_process(struct mg_connection *conn, const char *prog,
...
@@ -958,7 +963,7 @@ static pid_t spawn_process(struct mg_connection *conn, const char *prog,
&
si
.
hStdOutput
,
0
,
MG_TRUE
,
DUPLICATE_SAME_ACCESS
);
&
si
.
hStdOutput
,
0
,
MG_TRUE
,
DUPLICATE_SAME_ACCESS
);
// If CGI file is a script, try to read the interpreter line
// If CGI file is a script, try to read the interpreter line
interp
=
conn
->
ctx
->
options
[
OPT_CGI_INTERPRETER
]
;
interp
=
conn
->
ctx
->
config
->
cgi_interpreter
;
if
(
interp
==
NULL
)
{
if
(
interp
==
NULL
)
{
line
[
2
]
=
'\0'
;
line
[
2
]
=
'\0'
;
(
void
)
mg_snprintf
(
conn
,
cmdline
,
sizeof
(
cmdline
),
"%s%c%s"
,
(
void
)
mg_snprintf
(
conn
,
cmdline
,
sizeof
(
cmdline
),
"%s%c%s"
,
...
@@ -982,7 +987,7 @@ static pid_t spawn_process(struct mg_connection *conn, const char *prog,
...
@@ -982,7 +987,7 @@ static pid_t spawn_process(struct mg_connection *conn, const char *prog,
}
}
(
void
)
mg_snprintf
(
conn
,
cmdline
,
sizeof
(
cmdline
),
"%s%s%s"
,
(
void
)
mg_snprintf
(
conn
,
cmdline
,
sizeof
(
cmdline
),
"%s%s%s"
,
interp
,
interp
[
0
]
==
'\0'
?
""
:
" "
,
prog
);
interp
,
interp
[
0
]
==
'\0'
?
""
:
" "
,
prog
);
(
void
)
mg_snprintf
(
conn
,
line
,
sizeof
(
line
),
"%s"
,
dir
);
(
void
)
mg_snprintf
(
conn
,
line
,
sizeof
(
line
),
"%s"
,
dir
);
change_slashes_to_backslashes
(
line
);
change_slashes_to_backslashes
(
line
);
...
@@ -2325,8 +2330,9 @@ static void handle_file_request(struct mg_connection *conn, const char *path,
...
@@ -2325,8 +2330,9 @@ static void handle_file_request(struct mg_connection *conn, const char *path,
conn
->
request_info
.
status_code
,
msg
,
date
,
lm
,
etag
,
conn
->
request_info
.
status_code
,
msg
,
date
,
lm
,
etag
,
mime_vec
.
len
,
mime_vec
.
ptr
,
cl
,
range
);
mime_vec
.
len
,
mime_vec
.
ptr
,
cl
,
range
);
if
(
strcmp
(
conn
->
request_info
.
request_method
,
"HEAD"
)
!=
0
)
if
(
strcmp
(
conn
->
request_info
.
request_method
,
"HEAD"
)
!=
0
)
{
send_file_data
(
conn
,
fp
,
cl
);
send_file_data
(
conn
,
fp
,
cl
);
}
(
void
)
fclose
(
fp
);
(
void
)
fclose
(
fp
);
}
}
...
...
win32/dll.def
View file @
4f716e2b
...
@@ -2,15 +2,13 @@ LIBRARY
...
@@ -2,15 +2,13 @@ LIBRARY
EXPORTS
EXPORTS
mg_start
mg_start
mg_stop
mg_stop
mg_get_option
mg_read
mg_set_option
mg_set_callback
mg_write
mg_write
mg_printf
mg_printf
mg_get_header
mg_get_header
mg_get_var
mg_get_var
mg_get_qsvar
mg_get_cookie
mg_version
mg_version
mg_show_usage_string
mg_modify_passwords_file
mg_modify_passwords_file
mg_md5
mg_md5
mg_get_cookie
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