Skip to content

Commit

Permalink
FIX: httpd module: don't keep opened connection if client (like Reb…
Browse files Browse the repository at this point in the history
…ol2) don't want it
  • Loading branch information
Oldes committed Dec 1, 2021
1 parent cc1025d commit a09ee2f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/modules/httpd.reb
Original file line number Diff line number Diff line change
Expand Up @@ -763,10 +763,12 @@ sys/make-scheme [
Do-log ctx
clients: ctx/parent/locals/clients
keep-alive: ctx/config/keep-alive

either all [
keep-alive
open? port
ctx/requests <= keep-alive/2 ; limit to max requests
"close" <> select port/locals/inp/Header 'Connection ; client don't want or cannot handle persistent connection
][
ctx/requests: ctx/requests + 1
sys/log/info 'HTTPD ["Keep-alive:^[[22m" ctx/remote "requests:" ctx/requests]
Expand Down
1 change: 1 addition & 0 deletions src/tests/test-httpd.r3
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ secure [%../modules/ allow]
do %../modules/httpd.reb

system/options/log/httpd: 3 ; for verbose output
system/options/quiet: false

; make sure that there is the directory for logs
make-dir/deep %httpd-root/logs/
Expand Down

0 comments on commit a09ee2f

Please # to comment.