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
ad898685
Commit
ad898685
authored
Jan 22, 2014
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved must_hide_file to under #ifndef MONGOOSE_NO_FILESYSTEM
parent
976f2861
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
mongoose.c
mongoose.c
+13
-9
No files found.
mongoose.c
View file @
ad898685
...
@@ -1514,6 +1514,13 @@ static int match_prefix(const char *pattern, int pattern_len, const char *str) {
...
@@ -1514,6 +1514,13 @@ static int match_prefix(const char *pattern, int pattern_len, const char *str) {
return
j
;
return
j
;
}
}
static
int
must_hide_file
(
struct
connection
*
conn
,
const
char
*
path
)
{
const
char
*
pw_pattern
=
"**"
PASSWORDS_FILE_NAME
"$"
;
const
char
*
pattern
=
conn
->
server
->
config_options
[
HIDE_FILES_PATTERN
];
return
match_prefix
(
pw_pattern
,
strlen
(
pw_pattern
),
path
)
>
0
||
(
pattern
!=
NULL
&&
match_prefix
(
pattern
,
strlen
(
pattern
),
path
)
>
0
);
}
// Return 1 if real file has been found, 0 otherwise
// Return 1 if real file has been found, 0 otherwise
static
int
convert_uri_to_file_name
(
struct
connection
*
conn
,
char
*
buf
,
static
int
convert_uri_to_file_name
(
struct
connection
*
conn
,
char
*
buf
,
size_t
buf_len
,
file_stat_t
*
st
)
{
size_t
buf_len
,
file_stat_t
*
st
)
{
...
@@ -2234,7 +2241,7 @@ static void call_uri_handler_if_data_is_buffered(struct connection *conn) {
...
@@ -2234,7 +2241,7 @@ static void call_uri_handler_if_data_is_buffered(struct connection *conn) {
}
}
}
}
#if !defined(NO_DIRECTORY_LISTING) || !defined(MONGOOSE_NO_DAV)
#if !defined(
MONGOOSE_
NO_DIRECTORY_LISTING) || !defined(MONGOOSE_NO_DAV)
#ifdef _WIN32
#ifdef _WIN32
struct
dirent
{
struct
dirent
{
...
@@ -2316,13 +2323,6 @@ static struct dirent *readdir(DIR *dir) {
...
@@ -2316,13 +2323,6 @@ static struct dirent *readdir(DIR *dir) {
}
}
#endif // _WIN32 POSIX opendir/closedir/readdir implementation
#endif // _WIN32 POSIX opendir/closedir/readdir implementation
static
int
must_hide_file
(
struct
connection
*
conn
,
const
char
*
path
)
{
const
char
*
pw_pattern
=
"**"
PASSWORDS_FILE_NAME
"$"
;
const
char
*
pattern
=
conn
->
server
->
config_options
[
HIDE_FILES_PATTERN
];
return
match_prefix
(
pw_pattern
,
strlen
(
pw_pattern
),
path
)
>
0
||
(
pattern
!=
NULL
&&
match_prefix
(
pattern
,
strlen
(
pattern
),
path
)
>
0
);
}
static
int
scan_directory
(
struct
connection
*
conn
,
const
char
*
dir
,
static
int
scan_directory
(
struct
connection
*
conn
,
const
char
*
dir
,
struct
dir_entry
**
arr
)
{
struct
dir_entry
**
arr
)
{
char
path
[
MAX_PATH_SIZE
];
char
path
[
MAX_PATH_SIZE
];
...
@@ -3368,7 +3368,11 @@ static void open_local_endpoint(struct connection *conn) {
...
@@ -3368,7 +3368,11 @@ static void open_local_endpoint(struct connection *conn) {
}
}
#ifdef MONGOOSE_NO_FILESYSTEM
#ifdef MONGOOSE_NO_FILESYSTEM
send_http_error
(
conn
,
404
,
NULL
);
if
(
!
strcmp
(
conn
->
mg_conn
.
request_method
,
"OPTIONS"
))
{
send_options
(
conn
);
}
else
{
send_http_error
(
conn
,
404
,
NULL
);
}
#else
#else
exists
=
convert_uri_to_file_name
(
conn
,
path
,
sizeof
(
path
),
&
st
);
exists
=
convert_uri_to_file_name
(
conn
,
path
,
sizeof
(
path
),
&
st
);
is_directory
=
S_ISDIR
(
st
.
st_mode
);
is_directory
=
S_ISDIR
(
st
.
st_mode
);
...
...
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