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
113c9d5a
Commit
113c9d5a
authored
Dec 24, 2012
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix keep-alive handling in process_new_connection()
parent
05fa6773
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
mongoose.c
mongoose.c
+9
-2
No files found.
mongoose.c
View file @
113c9d5a
...
...
@@ -4759,10 +4759,11 @@ static int is_valid_uri(const char *uri) {
static
void
process_new_connection
(
struct
mg_connection
*
conn
)
{
struct
mg_request_info
*
ri
=
&
conn
->
request_info
;
int
keep_alive_enabled
,
discard_len
;
int
keep_alive_enabled
,
keep_alive
,
discard_len
;
const
char
*
cl
;
keep_alive_enabled
=
!
strcmp
(
conn
->
ctx
->
config
[
ENABLE_KEEP_ALIVE
],
"yes"
);
keep_alive
=
0
;
// Important: on new connection, reset the receiving buffer. Credit goes
// to crule42.
...
...
@@ -4808,6 +4809,12 @@ static void process_new_connection(struct mg_connection *conn) {
free
((
void
*
)
ri
->
remote_user
);
}
// NOTE(lsm): order is important here. should_keep_alive() call
// is using parsed request, which will be invalid after memmove's below.
// Therefore, memorize should_keep_alive() result now for later use
// in loop exit condition.
keep_alive
=
should_keep_alive
(
conn
);
// Discard all buffered data for this request
discard_len
=
conn
->
content_len
>=
0
&&
conn
->
request_len
+
conn
->
content_len
<
(
int64_t
)
conn
->
data_len
?
...
...
@@ -4820,7 +4827,7 @@ static void process_new_connection(struct mg_connection *conn) {
}
while
(
conn
->
ctx
->
stop_flag
==
0
&&
keep_alive_enabled
&&
conn
->
content_len
>=
0
&&
should_keep_alive
(
conn
)
);
keep_alive
);
}
// Worker threads take accepted socket from the queue
...
...
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