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
ce60379a
Commit
ce60379a
authored
Jun 16, 2014
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sending 405 for proxy request if connect is not allowed
parent
e0b9e4ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
mongoose.c
mongoose.c
+9
-6
No files found.
mongoose.c
View file @
ce60379a
...
@@ -4200,7 +4200,6 @@ static void open_local_endpoint(struct connection *conn, int skip_user) {
...
@@ -4200,7 +4200,6 @@ static void open_local_endpoint(struct connection *conn, int skip_user) {
file_stat_t
st
;
file_stat_t
st
;
int
exists
=
0
;
int
exists
=
0
;
#endif
#endif
const
char
*
pxy
=
conn
->
server
->
config_options
[
ENABLE_PROXY
];
// If EP_USER was set in a prev call, reset it
// If EP_USER was set in a prev call, reset it
conn
->
endpoint_type
=
EP_NONE
;
conn
->
endpoint_type
=
EP_NONE
;
...
@@ -4229,10 +4228,14 @@ static void open_local_endpoint(struct connection *conn, int skip_user) {
...
@@ -4229,10 +4228,14 @@ static void open_local_endpoint(struct connection *conn, int skip_user) {
return
;
return
;
}
}
if
(
pxy
!=
NULL
&&
!
strcmp
(
pxy
,
"yes"
)
&&
if
(
strcmp
(
conn
->
mg_conn
.
request_method
,
"CONNECT"
)
==
0
||
(
strcmp
(
conn
->
mg_conn
.
request_method
,
"CONNECT"
)
==
0
||
mg_strncasecmp
(
conn
->
mg_conn
.
uri
,
"http"
,
4
)
==
0
)
{
memcmp
(
conn
->
mg_conn
.
uri
,
"http"
,
4
)
==
0
))
{
const
char
*
enp
=
conn
->
server
->
config_options
[
ENABLE_PROXY
];
proxify_connection
(
conn
);
if
(
enp
==
NULL
||
strcmp
(
enp
,
"yes"
)
!=
0
)
{
send_http_error
(
conn
,
405
,
NULL
);
}
else
{
proxify_connection
(
conn
);
}
return
;
return
;
}
}
...
@@ -4286,7 +4289,7 @@ static int is_valid_uri(const char *uri) {
...
@@ -4286,7 +4289,7 @@ static int is_valid_uri(const char *uri) {
unsigned
short
n
;
unsigned
short
n
;
return
uri
[
0
]
==
'/'
||
return
uri
[
0
]
==
'/'
||
strcmp
(
uri
,
"*"
)
==
0
||
// OPTIONS method can use asterisk URI
strcmp
(
uri
,
"*"
)
==
0
||
// OPTIONS method can use asterisk URI
m
emcmp
(
uri
,
"http"
,
4
)
==
0
||
// Naive check for the absolute URI
m
g_strncasecmp
(
uri
,
"http"
,
4
)
==
0
||
// Naive check for the absolute URI
sscanf
(
uri
,
"%*[^ :]:%hu"
,
&
n
)
>
0
;
// CONNECT method can use host:port
sscanf
(
uri
,
"%*[^ :]:%hu"
,
&
n
)
>
0
;
// CONNECT method can use host:port
}
}
...
...
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