Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page is served when the server is stopped! #19

Open
stupidly-logical opened this issue Sep 29, 2019 · 10 comments
Open

Page is served when the server is stopped! #19

stupidly-logical opened this issue Sep 29, 2019 · 10 comments

Comments

@stupidly-logical
Copy link

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?

@shrinidhi111
Copy link

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.

@benrady
Copy link
Owner

benrady commented Jul 20, 2020

I was able to reproduce this problem as well.

@bendem
Copy link

bendem commented Aug 20, 2020

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

@benrady
Copy link
Owner

benrady commented Aug 20, 2020 via email

@bendem
Copy link

bendem commented Aug 20, 2020

You should set it to close, not remove it. Otherwise it means you are accepting the browser's setting which is keep-alive.

@bendem
Copy link

bendem commented Aug 20, 2020

Sorry, I realise I had removed it in my example, added it back.

@janglapuk
Copy link

Replace nc with ncat from NMAP package should work even in keep-alive or close connection mode.

@JeremyLARDENOIS
Copy link

like it #23 ?

@janglapuk
Copy link

like it #23 ?

ncat still needs p or --source-port argument to define the port.

@JeremyLARDENOIS
Copy link

No, you can give a port without the argument cause ncat take ports in parameter already

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants