Open stupidly-logical opened 4 years ago
Same issue here..
After I start the server and open the page in Firefox, it keeps loading forever. But as soon as I CTRL+C the server, the response loads.
I was able to reproduce this problem as well.
That would be the keepalive setting. You really want to close the connection after sending the response to have a consistent behavior in browsers:
-N shutdown(2) the network socket after EOF on the input. Some servers require this to finish their work.
while nc -Nl 8082 <<< 'HTTP/1.1 200 OK
Connection: close
Content-Type: text/plain
OK'; do ; done
see #16
That makes sense, but removing the Connection: keep-alive
does not seem
to fix the issue (at least, in the browsers I've tried).
On Thu, Aug 20, 2020 at 8:12 AM bendem notifications@github.com wrote:
That would be the keepalive setting. You really want to close the connection after sending the response to have a consistent behavior in browsers:
while nc -Nl 8082 <<< 'HTTP/1.1 200 OKContent-Type: text/plainOK'; do ; done
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/benrady/shinatra/issues/19#issuecomment-677656208, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAN4YHC4NLYKTJS7EKMF3TSBUOMJANCNFSM4I3RO3GA .
-- Ben
You should set it to close
, not remove it. Otherwise it means you are accepting the browser's setting which is keep-alive
.
Sorry, I realise I had removed it in my example, added it back.
Replace nc
with ncat
from NMAP package should work even in keep-alive
or close
connection mode.
like it #23 ?
like it #23 ?
ncat
still needs p
or --source-port
argument to define the port.
No, you can give a port without the argument cause ncat take ports in parameter already
When I run it like:
./shinatra.sh 8080 index.html
the page keeps loading. As soon as I terminate it with Ctrl+C, the content is served. Is this the intended behaviour?