Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
mongoose
Commits
36d95e23
Commit
36d95e23
authored
Mar 25, 2015
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix win32 build
parent
8a27a95a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
Makefile
examples/web_server/Makefile
+5
-2
mongoose.c
mongoose.c
+8
-3
No files found.
examples/web_server/Makefile
View file @
36d95e23
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
# All rights reserved
# All rights reserved
PROG
=
web_server
PROG
=
web_server
CFLAGS
=
-W
-Wall
-I
../..
-
pthread
-g
-O0
-DMONGOOSE_ENABLE_THREADS
$(CFLAGS_EXTRA)
CFLAGS
=
-W
-Wall
-I
../..
-
g
-O0
$(CFLAGS_EXTRA)
SOURCES
=
$(PROG)
.c ../../mongoose.c
SOURCES
=
$(PROG)
.c ../../mongoose.c
OPENSSL_FLAGS
=
-DNS_ENABLE_SSL
-lssl
OPENSSL_FLAGS
=
-DNS_ENABLE_SSL
-lssl
...
@@ -13,7 +13,10 @@ SOURCES_POLAR = $(SOURCES) $(POLARSSLCOMPAT_PATH)/polarssl_compat.c
...
@@ -13,7 +13,10 @@ SOURCES_POLAR = $(SOURCES) $(POLARSSLCOMPAT_PATH)/polarssl_compat.c
INCDIR_POLAR
=
-I
$(POLARSSLCOMPAT_PATH)
-I
$(POLARSSL_PATH)
/include
INCDIR_POLAR
=
-I
$(POLARSSLCOMPAT_PATH)
-I
$(POLARSSL_PATH)
/include
LDFLAGS_POLAR
=
-L
$(POLARSSL_PATH)
/lib
-lmbedtls
LDFLAGS_POLAR
=
-L
$(POLARSSL_PATH)
/lib
-lmbedtls
CFLAGS_POLAR
=
$(CFLAGS)
$(INCDIR_POLAR)
-DNS_ENABLE_SSL
CFLAGS_POLAR
=
$(CFLAGS)
$(INCDIR_POLAR)
-DNS_ENABLE_SSL
#
$(PROG).exe
:
$(SOURCES)
cl
-Fo
$(PROG)
$(SOURCES)
-nologo
-MD
-I
../..
$(PROG)
:
$(SOURCES)
$(PROG)
:
$(SOURCES)
$(CC)
-o
$(PROG)
$(SOURCES)
$(CFLAGS)
$(CC)
-o
$(PROG)
$(SOURCES)
$(CFLAGS)
...
...
mongoose.c
View file @
36d95e23
...
@@ -63,6 +63,10 @@
...
@@ -63,6 +63,10 @@
#pragma warning (disable : 4204) // missing c99 support
#pragma warning (disable : 4204) // missing c99 support
#endif
#endif
#if defined(_WIN32) && !defined(MONGOOSE_NO_CGI)
#define MONGOOSE_ENABLE_THREADS
/* Windows uses stdio threads for CGI */
#endif
#ifndef MONGOOSE_ENABLE_THREADS
#ifndef MONGOOSE_ENABLE_THREADS
#define NS_DISABLE_THREADS
#define NS_DISABLE_THREADS
#endif
#endif
...
@@ -3327,7 +3331,7 @@ static void open_file_endpoint(struct connection *conn, const char *path,
...
@@ -3327,7 +3331,7 @@ static void open_file_endpoint(struct connection *conn, const char *path,
file_stat_t
*
st
,
const
char
*
extra_headers
)
{
file_stat_t
*
st
,
const
char
*
extra_headers
)
{
char
date
[
64
],
lm
[
64
],
etag
[
64
],
range
[
64
],
headers
[
1000
];
char
date
[
64
],
lm
[
64
],
etag
[
64
],
range
[
64
],
headers
[
1000
];
const
char
*
msg
=
"OK"
,
*
hdr
;
const
char
*
msg
=
"OK"
,
*
hdr
;
time_t
curtime
=
time
(
NULL
);
time_t
t
,
curtime
=
time
(
NULL
);
int64_t
r1
,
r2
;
int64_t
r1
,
r2
;
struct
vec
mime_vec
;
struct
vec
mime_vec
;
int
n
;
int
n
;
...
@@ -3357,7 +3361,7 @@ static void open_file_endpoint(struct connection *conn, const char *path,
...
@@ -3357,7 +3361,7 @@ static void open_file_endpoint(struct connection *conn, const char *path,
// Prepare Etag, Date, Last-Modified headers. Must be in UTC, according to
// Prepare Etag, Date, Last-Modified headers. Must be in UTC, according to
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3
gmt_time_string
(
date
,
sizeof
(
date
),
&
curtime
);
gmt_time_string
(
date
,
sizeof
(
date
),
&
curtime
);
t
ime_t
t
=
st
->
st_mtime
;
// store in local variable for NDK compile
t
=
st
->
st_mtime
;
// store in local variable for NDK compile
gmt_time_string
(
lm
,
sizeof
(
lm
),
&
t
);
gmt_time_string
(
lm
,
sizeof
(
lm
),
&
t
);
construct_etag
(
etag
,
sizeof
(
etag
),
st
);
construct_etag
(
etag
,
sizeof
(
etag
),
st
);
...
@@ -3562,6 +3566,7 @@ static void print_dir_entry(const struct dir_entry *de) {
...
@@ -3562,6 +3566,7 @@ static void print_dir_entry(const struct dir_entry *de) {
int64_t
fsize
=
de
->
st
.
st_size
;
int64_t
fsize
=
de
->
st
.
st_size
;
int
is_dir
=
S_ISDIR
(
de
->
st
.
st_mode
);
int
is_dir
=
S_ISDIR
(
de
->
st
.
st_mode
);
const
char
*
slash
=
is_dir
?
"/"
:
""
;
const
char
*
slash
=
is_dir
?
"/"
:
""
;
time_t
t
;
if
(
is_dir
)
{
if
(
is_dir
)
{
mg_snprintf
(
size
,
sizeof
(
size
),
"%s"
,
"[DIRECTORY]"
);
mg_snprintf
(
size
,
sizeof
(
size
),
"%s"
,
"[DIRECTORY]"
);
...
@@ -3578,7 +3583,7 @@ static void print_dir_entry(const struct dir_entry *de) {
...
@@ -3578,7 +3583,7 @@ static void print_dir_entry(const struct dir_entry *de) {
mg_snprintf
(
size
,
sizeof
(
size
),
"%.1fG"
,
(
double
)
fsize
/
1073741824
);
mg_snprintf
(
size
,
sizeof
(
size
),
"%.1fG"
,
(
double
)
fsize
/
1073741824
);
}
}
}
}
t
ime_t
t
=
de
->
st
.
st_mtime
;
// store in local variable for NDK compile
t
=
de
->
st
.
st_mtime
;
// store in local variable for NDK compile
strftime
(
mod
,
sizeof
(
mod
),
"%d-%b-%Y %H:%M"
,
localtime
(
&
t
));
strftime
(
mod
,
sizeof
(
mod
),
"%d-%b-%Y %H:%M"
,
localtime
(
&
t
));
mg_url_encode
(
de
->
file_name
,
strlen
(
de
->
file_name
),
href
,
sizeof
(
href
));
mg_url_encode
(
de
->
file_name
,
strlen
(
de
->
file_name
),
href
,
sizeof
(
href
));
mg_printf_data
(
&
de
->
conn
->
mg_conn
,
mg_printf_data
(
&
de
->
conn
->
mg_conn
,
...
...
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