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
ac093604
Commit
ac093604
authored
Nov 29, 2010
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accept * URI
parent
9bda69f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
mongoose.c
mongoose.c
+7
-1
test.pl
test/test.pl
+2
-0
No files found.
mongoose.c
View file @
ac093604
...
@@ -3730,6 +3730,12 @@ static void handle_proxy_request(struct mg_connection *conn) {
...
@@ -3730,6 +3730,12 @@ static void handle_proxy_request(struct mg_connection *conn) {
}
}
}
}
static
int
is_valid_uri
(
const
char
*
uri
)
{
// Conform to http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2
// URI can be an asterisk (*) or should start with slash.
return
(
uri
[
0
]
==
'/'
||
(
uri
[
0
]
==
'*'
&&
uri
[
1
]
==
'\0'
));
}
static
void
process_new_connection
(
struct
mg_connection
*
conn
)
{
static
void
process_new_connection
(
struct
mg_connection
*
conn
)
{
struct
mg_request_info
*
ri
=
&
conn
->
request_info
;
struct
mg_request_info
*
ri
=
&
conn
->
request_info
;
int
keep_alive_enabled
;
int
keep_alive_enabled
;
...
@@ -3756,7 +3762,7 @@ static void process_new_connection(struct mg_connection *conn) {
...
@@ -3756,7 +3762,7 @@ static void process_new_connection(struct mg_connection *conn) {
// Nul-terminate the request cause parse_http_request() uses sscanf
// Nul-terminate the request cause parse_http_request() uses sscanf
conn
->
buf
[
conn
->
request_len
-
1
]
=
'\0'
;
conn
->
buf
[
conn
->
request_len
-
1
]
=
'\0'
;
if
(
!
parse_http_request
(
conn
->
buf
,
ri
)
||
if
(
!
parse_http_request
(
conn
->
buf
,
ri
)
||
(
!
conn
->
client
.
is_proxy
&&
ri
->
uri
[
0
]
!=
'/'
))
{
(
!
conn
->
client
.
is_proxy
&&
!
is_valid_uri
(
ri
->
uri
)
))
{
// Do not put garbage in the access log, just send it back to the client
// Do not put garbage in the access log, just send it back to the client
send_http_error
(
conn
,
400
,
"Bad Request"
,
send_http_error
(
conn
,
400
,
"Bad Request"
,
"Cannot parse HTTP request: [%.*s]"
,
conn
->
data_len
,
conn
->
buf
);
"Cannot parse HTTP request: [%.*s]"
,
conn
->
data_len
,
conn
->
buf
);
...
...
test/test.pl
View file @
ac093604
...
@@ -231,6 +231,8 @@ o("GET /ta/x/ HTTP/1.0\n\n", "SCRIPT_NAME=/ta/x/index.cgi",
...
@@ -231,6 +231,8 @@ o("GET /ta/x/ HTTP/1.0\n\n", "SCRIPT_NAME=/ta/x/index.cgi",
# 'HTTP/1.1 200.+keep-alive.+HTTP/1.1 200.+close',
# 'HTTP/1.1 200.+keep-alive.+HTTP/1.1 200.+close',
# 'Request pipelining', 2);
# 'Request pipelining', 2);
o
(
"GET * HTTP/1.0\n\n"
,
"^HTTP/1.1 404"
,
'* URI'
);
my
$mime_types
=
{
my
$mime_types
=
{
html
=>
'text/html'
,
html
=>
'text/html'
,
htm
=>
'text/html'
,
htm
=>
'text/html'
,
...
...
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