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
d369f316
Commit
d369f316
authored
Mar 26, 2014
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return 404 for non-existent propfind URIs
parent
d4b14ca3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
mongoose.c
mongoose.c
+14
-4
No files found.
mongoose.c
View file @
d369f316
...
@@ -3159,7 +3159,7 @@ static void print_props(struct connection *conn, const char *uri,
...
@@ -3159,7 +3159,7 @@ static void print_props(struct connection *conn, const char *uri,
}
}
static
void
handle_propfind
(
struct
connection
*
conn
,
const
char
*
path
,
static
void
handle_propfind
(
struct
connection
*
conn
,
const
char
*
path
,
file_stat_t
*
stp
)
{
file_stat_t
*
stp
,
int
exists
)
{
static
const
char
header
[]
=
"HTTP/1.1 207 Multi-Status
\r\n
"
static
const
char
header
[]
=
"HTTP/1.1 207 Multi-Status
\r\n
"
"Connection: close
\r\n
"
"Connection: close
\r\n
"
"Content-Type: text/xml; charset=utf-8
\r\n\r\n
"
"Content-Type: text/xml; charset=utf-8
\r\n\r\n
"
...
@@ -3173,10 +3173,20 @@ static void handle_propfind(struct connection *conn, const char *path,
...
@@ -3173,10 +3173,20 @@ static void handle_propfind(struct connection *conn, const char *path,
ns_send
(
conn
->
ns_conn
,
header
,
sizeof
(
header
)
-
1
);
ns_send
(
conn
->
ns_conn
,
header
,
sizeof
(
header
)
-
1
);
// Print properties for the requested resource itself
// Print properties for the requested resource itself
if
(
exists
)
{
print_props
(
conn
,
conn
->
mg_conn
.
uri
,
stp
);
print_props
(
conn
,
conn
->
mg_conn
.
uri
,
stp
);
}
else
{
mg_printf
(
&
conn
->
mg_conn
,
"<d:response>"
"<d:href>%s</d:href>"
"<d:propstat>"
"<d:status>HTTP/1.1 404 Not Found</d:status>"
"</d:propstat>"
"</d:response>
\n
"
,
path
);
}
// If it is a directory, print directory entries too if Depth is not 0
// If it is a directory, print directory entries too if Depth is not 0
if
(
S_ISDIR
(
stp
->
st_mode
)
&&
!
mg_strcasecmp
(
list_dir
,
"yes"
)
&&
if
(
exists
&&
S_ISDIR
(
stp
->
st_mode
)
&&
!
mg_strcasecmp
(
list_dir
,
"yes"
)
&&
(
depth
==
NULL
||
strcmp
(
depth
,
"0"
)
!=
0
))
{
(
depth
==
NULL
||
strcmp
(
depth
,
"0"
)
!=
0
))
{
struct
dir_entry
*
arr
=
NULL
;
struct
dir_entry
*
arr
=
NULL
;
int
i
,
num_entries
=
scan_directory
(
conn
,
path
,
&
arr
);
int
i
,
num_entries
=
scan_directory
(
conn
,
path
,
&
arr
);
...
@@ -3936,7 +3946,7 @@ static void open_local_endpoint(struct connection *conn, int skip_user) {
...
@@ -3936,7 +3946,7 @@ static void open_local_endpoint(struct connection *conn, int skip_user) {
#endif
#endif
#ifndef MONGOOSE_NO_DAV
#ifndef MONGOOSE_NO_DAV
}
else
if
(
!
strcmp
(
conn
->
mg_conn
.
request_method
,
"PROPFIND"
))
{
}
else
if
(
!
strcmp
(
conn
->
mg_conn
.
request_method
,
"PROPFIND"
))
{
handle_propfind
(
conn
,
path
,
&
st
);
handle_propfind
(
conn
,
path
,
&
st
,
exists
);
}
else
if
(
!
strcmp
(
conn
->
mg_conn
.
request_method
,
"MKCOL"
))
{
}
else
if
(
!
strcmp
(
conn
->
mg_conn
.
request_method
,
"MKCOL"
))
{
handle_mkcol
(
conn
,
path
);
handle_mkcol
(
conn
,
path
);
}
else
if
(
!
strcmp
(
conn
->
mg_conn
.
request_method
,
"DELETE"
))
{
}
else
if
(
!
strcmp
(
conn
->
mg_conn
.
request_method
,
"DELETE"
))
{
...
...
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