Handle keep-alive requests #4
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mike/bash-web-server!4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "Wonshtrum/patch-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Process pipelined requests of a client in a loop instead of closing after each request.
This should resolve/attenuate the built-in accept problem.
This is a crude PoC, not intended to be merged, TODO:
@ -237,0 +221,4 @@"$path/index.html""$path/index.htm")local try fileis this how we know a keep-alive request is done? (genuine question - idk keep-alive semantics)
bash has some builtins for
stat. i think it hasfinfoas well to stat the file and get information like file size in bytes.i threw some comments on this PR. i'm going to look into keep-alive myself more later but i think it should be possible and could be really useful.
oh this could break. this gets the length of the string, but length might != byte count. for example:
I don't immediately know a way to get the raw byte count from bash so we'd have to figure that out.
@ -237,0 +221,4 @@"$path/index.html""$path/index.htm")local try fileThe HTTP protocol is a mess, to be 100% compliant with all RFCs, you would need to parse some headers and the bodies. A simpler approach that would work for "body less" requests is to consider that requests directly follow each other until the connection is closed. Here I "detect" the connection close when the method field (the first to be parsed) is not set, meaning the parse-request function returned because it got EOF (not because it finished parsing a request). It would be cleaner to return an error code or a state, since I do not know bash at all, I chose a lazy option.
That's an interesting problem. I do not know if bash can count bytes in a string.
Right now, I see two solutions:
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.