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
97392645
Commit
97392645
authored
Jun 07, 2012
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored read_request()
parent
995d7bd1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
16 deletions
+10
-16
mongoose.c
mongoose.c
+10
-16
No files found.
mongoose.c
View file @
97392645
...
...
@@ -2648,18 +2648,15 @@ static int parse_http_request(char *buf, struct mg_request_info *ri) {
// Upon every read operation, increase nread by the number of bytes read.
static
int
read_request
(
FILE
*
fp
,
SOCKET
sock
,
SSL
*
ssl
,
char
*
buf
,
int
bufsiz
,
int
*
nread
)
{
int
n
,
request_len
;
int
request_len
,
n
=
0
;
request_len
=
0
;
while
(
*
nread
<
bufsiz
&&
request_len
==
0
)
{
n
=
pull
(
fp
,
sock
,
ssl
,
buf
+
*
nread
,
bufsiz
-
*
nread
);
if
(
n
<=
0
)
{
break
;
}
else
{
*
nread
+=
n
;
do
{
request_len
=
get_request_len
(
buf
,
*
nread
);
if
(
request_len
==
0
&&
(
n
=
pull
(
fp
,
sock
,
ssl
,
buf
+
*
nread
,
bufsiz
-
*
nread
))
>
0
)
{
*
nread
+=
n
;
}
}
}
while
(
*
nread
<
bufsiz
&&
request_len
==
0
&&
n
>
0
);
return
request_len
;
}
...
...
@@ -3892,12 +3889,9 @@ static void process_new_connection(struct mg_connection *conn) {
do
{
reset_per_request_attributes
(
conn
);
// If next request is not pipelined, read it in
if
((
conn
->
request_len
=
get_request_len
(
conn
->
buf
,
conn
->
data_len
))
==
0
)
{
conn
->
request_len
=
read_request
(
NULL
,
conn
->
client
.
sock
,
conn
->
ssl
,
conn
->
buf
,
conn
->
buf_size
,
&
conn
->
data_len
);
}
conn
->
buf
,
conn
->
buf_size
,
&
conn
->
data_len
);
assert
(
conn
->
data_len
>=
conn
->
request_len
);
if
(
conn
->
request_len
==
0
&&
conn
->
data_len
==
conn
->
buf_size
)
{
send_http_error
(
conn
,
413
,
"Request Too Large"
,
""
);
...
...
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