Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Voice
asterisk
Commits
16df1821
Commit
16df1821
authored
6 years ago
by
George Joseph
Committed by
Gerrit Code Review
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge "http.c: Give HTTP error response when received lines are too long."
parents
0d0de25e
e3877501
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main/http.c
+19
-2
19 additions, 2 deletions
main/http.c
with
19 additions
and
2 deletions
main/http.c
+
19
−
2
View file @
16df1821
...
...
@@ -1740,13 +1740,21 @@ static int http_request_headers_get(struct ast_tcptls_session_instance *ser, str
remaining_headers
=
MAX_HTTP_REQUEST_HEADERS
;
for
(;;)
{
ssize_t
len
;
char
*
name
;
char
*
value
;
if
(
ast_iostream_gets
(
ser
->
stream
,
header_line
,
sizeof
(
header_line
))
<=
0
)
{
len
=
ast_iostream_gets
(
ser
->
stream
,
header_line
,
sizeof
(
header_line
));
if
(
len
<=
0
)
{
ast_http_error
(
ser
,
400
,
"Bad Request"
,
"Timeout"
);
return
-
1
;
}
if
(
header_line
[
len
-
1
]
!=
'\n'
)
{
/* We didn't get a full line */
ast_http_error
(
ser
,
400
,
"Bad Request"
,
(
len
==
sizeof
(
header_line
)
-
1
)
?
"Header line too long"
:
"Timeout"
);
return
-
1
;
}
/* Trim trailing characters */
ast_trim_blanks
(
header_line
);
...
...
@@ -1815,9 +1823,11 @@ static int httpd_process_request(struct ast_tcptls_session_instance *ser)
struct
http_worker_private_data
*
request
;
enum
ast_http_method
http_method
=
AST_HTTP_UNKNOWN
;
int
res
;
ssize_t
len
;
char
request_line
[
MAX_HTTP_LINE_LENGTH
];
if
(
ast_iostream_gets
(
ser
->
stream
,
request_line
,
sizeof
(
request_line
))
<=
0
)
{
len
=
ast_iostream_gets
(
ser
->
stream
,
request_line
,
sizeof
(
request_line
));
if
(
len
<=
0
)
{
return
-
1
;
}
...
...
@@ -1825,6 +1835,13 @@ static int httpd_process_request(struct ast_tcptls_session_instance *ser)
request
=
ser
->
private_data
;
http_request_tracking_init
(
request
);
if
(
request_line
[
len
-
1
]
!=
'\n'
)
{
/* We didn't get a full line */
ast_http_error
(
ser
,
400
,
"Bad Request"
,
(
len
==
sizeof
(
request_line
)
-
1
)
?
"Request line too long"
:
"Timeout"
);
return
-
1
;
}
/* Get method */
method
=
ast_skip_blanks
(
request_line
);
uri
=
ast_skip_nonblanks
(
method
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment