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
038f8823
Commit
038f8823
authored
Oct 05, 2012
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test to mg_stat(). Fixed set_gpass()
parent
03dd8367
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
mongoose.c
mongoose.c
+7
-1
unit_test.c
test/unit_test.c
+8
-0
No files found.
mongoose.c
View file @
038f8823
...
...
@@ -1331,6 +1331,8 @@ static int mg_stat(struct mg_connection *conn, const char *path,
filep
->
size
=
st
.
st_size
;
filep
->
modification_time
=
st
.
st_mtime
;
filep
->
is_directory
=
S_ISDIR
(
st
.
st_mode
);
}
else
{
filep
->
modification_time
=
(
time_t
)
0
;
}
return
filep
->
membuf
!=
NULL
||
filep
->
modification_time
!=
(
time_t
)
0
;
...
...
@@ -4461,7 +4463,11 @@ static void uninitialize_ssl(struct mg_context *ctx) {
static
int
set_gpass_option
(
struct
mg_context
*
ctx
)
{
struct
file
file
;
const
char
*
path
=
ctx
->
config
[
GLOBAL_PASSWORDS_FILE
];
return
path
==
NULL
||
!
mg_stat
(
fc
(
ctx
),
path
,
&
file
);
if
(
path
!=
NULL
&&
!
mg_stat
(
fc
(
ctx
),
path
,
&
file
))
{
cry
(
fc
(
ctx
),
"Cannot open %s: %s"
,
path
,
strerror
(
ERRNO
));
return
0
;
}
return
1
;
}
static
int
set_acl_option
(
struct
mg_context
*
ctx
)
{
...
...
test/unit_test.c
View file @
038f8823
...
...
@@ -349,6 +349,13 @@ static void test_user_data(void) {
call_user
(
fc
(
ctx
),
MG_NEW_REQUEST
);
}
static
void
test_mg_stat
(
void
)
{
static
struct
mg_context
ctx
;
struct
file
file
;
memset
(
&
file
,
'A'
,
sizeof
(
file
));
ASSERT
(
!
mg_stat
(
fc
(
&
ctx
),
" does not exist "
,
&
file
));
}
int
main
(
void
)
{
test_base64_encode
();
test_match_prefix
();
...
...
@@ -360,6 +367,7 @@ int main(void) {
test_set_throttle
();
test_next_option
();
test_user_data
();
test_mg_stat
();
#ifdef USE_LUA
test_lua
();
#endif
...
...
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