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
e6eca173
Commit
e6eca173
authored
Jul 27, 2014
by
Pavel Pimenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
80 characters limit + remove tabs
parent
2108ec5a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
mongoose.c
mongoose.c
+12
-7
No files found.
mongoose.c
View file @
e6eca173
...
@@ -3502,7 +3502,8 @@ void mg_send_digest_auth_request(struct mg_connection *c) {
...
@@ -3502,7 +3502,8 @@ void mg_send_digest_auth_request(struct mg_connection *c) {
// Use the global passwords file, if specified by auth_gpass option,
// Use the global passwords file, if specified by auth_gpass option,
// or search for .htpasswd in the requested directory.
// or search for .htpasswd in the requested directory.
static
FILE
*
open_auth_file
(
struct
connection
*
conn
,
const
char
*
path
,
int
is_directory
)
{
static
FILE
*
open_auth_file
(
struct
connection
*
conn
,
const
char
*
path
,
int
is_directory
)
{
char
name
[
MAX_PATH_SIZE
];
char
name
[
MAX_PATH_SIZE
];
const
char
*
p
,
*
gpass
=
conn
->
server
->
config_options
[
GLOBAL_AUTH_FILE
];
const
char
*
p
,
*
gpass
=
conn
->
server
->
config_options
[
GLOBAL_AUTH_FILE
];
FILE
*
fp
=
NULL
;
FILE
*
fp
=
NULL
;
...
@@ -3800,7 +3801,8 @@ int mg_authorize_digest(struct mg_connection *c, FILE *fp) {
...
@@ -3800,7 +3801,8 @@ int mg_authorize_digest(struct mg_connection *c, FILE *fp) {
// Return 1 if request is authorised, 0 otherwise.
// Return 1 if request is authorised, 0 otherwise.
static
int
is_authorized
(
struct
connection
*
conn
,
const
char
*
path
,
int
is_directory
)
{
static
int
is_authorized
(
struct
connection
*
conn
,
const
char
*
path
,
int
is_directory
)
{
FILE
*
fp
;
FILE
*
fp
;
int
authorized
=
MG_TRUE
;
int
authorized
=
MG_TRUE
;
...
@@ -4143,7 +4145,8 @@ static void proxify_connection(struct connection *conn) {
...
@@ -4143,7 +4145,8 @@ static void proxify_connection(struct connection *conn) {
}
}
#ifndef MONGOOSE_NO_FILESYSTEM
#ifndef MONGOOSE_NO_FILESYSTEM
void
mg_send_file_internal
(
struct
mg_connection
*
c
,
const
char
*
file_name
,
file_stat_t
*
st
,
int
exists
)
{
void
mg_send_file_internal
(
struct
mg_connection
*
c
,
const
char
*
file_name
,
file_stat_t
*
st
,
int
exists
)
{
struct
connection
*
conn
=
MG_CONN_2_CONN
(
c
);
struct
connection
*
conn
=
MG_CONN_2_CONN
(
c
);
char
path
[
MAX_PATH_SIZE
];
char
path
[
MAX_PATH_SIZE
];
const
int
is_directory
=
S_ISDIR
(
st
->
st_mode
);
const
int
is_directory
=
S_ISDIR
(
st
->
st_mode
);
...
@@ -4267,7 +4270,8 @@ static void open_local_endpoint(struct connection *conn, int skip_user) {
...
@@ -4267,7 +4270,8 @@ static void open_local_endpoint(struct connection *conn, int skip_user) {
}
else
if
(
conn
->
server
->
config_options
[
DOCUMENT_ROOT
]
==
NULL
)
{
}
else
if
(
conn
->
server
->
config_options
[
DOCUMENT_ROOT
]
==
NULL
)
{
send_http_error
(
conn
,
404
,
NULL
);
send_http_error
(
conn
,
404
,
NULL
);
#ifndef MONGOOSE_NO_AUTH
#ifndef MONGOOSE_NO_AUTH
}
else
if
((
!
is_dav_request
(
conn
)
&&
!
is_authorized
(
conn
,
path
,
exists
&&
S_ISDIR
(
st
.
st_mode
)))
||
}
else
if
((
!
is_dav_request
(
conn
)
&&
!
is_authorized
(
conn
,
path
,
exists
&&
S_ISDIR
(
st
.
st_mode
)))
||
(
is_dav_request
(
conn
)
&&
!
is_authorized_for_dav
(
conn
)))
{
(
is_dav_request
(
conn
)
&&
!
is_authorized_for_dav
(
conn
)))
{
mg_send_digest_auth_request
(
&
conn
->
mg_conn
);
mg_send_digest_auth_request
(
&
conn
->
mg_conn
);
close_local_endpoint
(
conn
);
close_local_endpoint
(
conn
);
...
@@ -4354,7 +4358,8 @@ static void on_recv_data(struct connection *conn) {
...
@@ -4354,7 +4358,8 @@ static void on_recv_data(struct connection *conn) {
}
}
try_parse
(
conn
);
try_parse
(
conn
);
DBG
((
"%p %d %lu %d"
,
conn
,
conn
->
request_len
,
(
unsigned
long
)
io
->
len
,
conn
->
ns_conn
->
flags
));
DBG
((
"%p %d %lu %d"
,
conn
,
conn
->
request_len
,
(
unsigned
long
)
io
->
len
,
conn
->
ns_conn
->
flags
));
if
(
conn
->
request_len
<
0
||
if
(
conn
->
request_len
<
0
||
(
conn
->
request_len
>
0
&&
!
is_valid_uri
(
conn
->
mg_conn
.
uri
)))
{
(
conn
->
request_len
>
0
&&
!
is_valid_uri
(
conn
->
mg_conn
.
uri
)))
{
send_http_error
(
conn
,
400
,
NULL
);
send_http_error
(
conn
,
400
,
NULL
);
...
...
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