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
518a7f8a
Commit
518a7f8a
authored
Dec 07, 2015
by
Alexander Alashkin
Committed by
rojer
Dec 08, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix MG DAV
PUBLISHED_FROM=132db6ed9c9e1eb9ec19b4f9299448b901b92231
parent
31323b01
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
Makefile
examples/simplest_web_server/Makefile
+1
-1
simplest_web_server.c
examples/simplest_web_server/simplest_web_server.c
+1
-0
mongoose.c
mongoose.c
+14
-1
No files found.
examples/simplest_web_server/Makefile
View file @
518a7f8a
PROG
=
simplest_web_server
SOURCES
=
$(PROG)
.c ../../mongoose.c
CFLAGS
=
-W
-Wall
-I
../..
$(CFLAGS_EXTRA)
CFLAGS
=
-W
-Wall
-I
../..
$(CFLAGS_EXTRA)
-DMG_DISABLE_DAV_AUTH
all
:
$(PROG)
...
...
examples/simplest_web_server/simplest_web_server.c
View file @
518a7f8a
...
...
@@ -22,6 +22,7 @@ int main(void) {
// Set up HTTP server parameters
mg_set_protocol_http_websocket
(
nc
);
s_http_server_opts
.
document_root
=
"."
;
// Serve current directory
s_http_server_opts
.
dav_document_root
=
"."
;
// Allow access via WebDav
s_http_server_opts
.
enable_directory_listing
=
"yes"
;
printf
(
"Starting web server on port %s
\n
"
,
s_http_port
);
...
...
mongoose.c
View file @
518a7f8a
...
...
@@ -5196,7 +5196,7 @@ static int is_authorized(struct http_message *hm, const char *path,
#ifndef MG_DISABLE_DIRECTORY_LISTING
static
size_t
mg_url_encode
(
const
char
*
src
,
size_t
s_len
,
char
*
dst
,
size_t
dst_len
)
{
static
const
char
*
dont_escape
=
"._-$,;~()"
;
static
const
char
*
dont_escape
=
"._-$,;~()
/
"
;
static
const
char
*
hex
=
"0123456789abcdef"
;
size_t
i
=
0
,
j
=
0
;
...
...
@@ -6133,6 +6133,17 @@ static void mg_send_digest_auth_request(struct mg_connection *c,
domain
,
(
unsigned
long
)
time
(
NULL
));
}
static
void
send_options
(
struct
mg_connection
*
nc
)
{
mg_printf
(
nc
,
"%s"
,
"HTTP/1.1 200 OK
\r\n
Allow: GET, POST, HEAD, CONNECT, PUT, "
"DELETE, OPTIONS, MKCOL,"
#ifndef MG_DISABLE_DAV
"PROPFIND
\r\n
DAV: 1"
#endif
"
\r\n\r\n
"
);
nc
->
flags
|=
MG_F_SEND_AND_CLOSE
;
}
void
mg_send_http_file
(
struct
mg_connection
*
nc
,
char
*
path
,
size_t
path_buf_len
,
struct
http_message
*
hm
,
struct
mg_serve_http_opts
*
opts
)
{
...
...
@@ -6178,6 +6189,8 @@ void mg_send_http_file(struct mg_connection *nc, char *path,
}
else
if
(
!
mg_vcmp
(
&
hm
->
method
,
"PUT"
))
{
handle_put
(
nc
,
path
,
hm
);
#endif
}
else
if
(
!
mg_vcmp
(
&
hm
->
method
,
"OPTIONS"
))
{
send_options
(
nc
);
}
else
if
(
S_ISDIR
(
st
.
st_mode
)
&&
!
find_index_file
(
path
,
path_buf_len
,
opts
->
index_files
,
&
st
))
{
if
(
strcmp
(
opts
->
enable_directory_listing
,
"yes"
)
==
0
)
{
...
...
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