Mirror of the Rel4tion website/wiki source, view at <http://rel4tion.org>
Clone
HTTPS:
git clone https://vervis.peers.community/repos/yEzqv
SSH:
git clone USERNAME@vervis.peers.community:yEzqv
Branches
Tags
2.mdwn
[[!template id=ticket class=task assigned=fr33domlover done=yes]]
[[!meta title=“Persisent connections”]]
Issue
An HTTP connection is made persistent depending on the request the server gets from the client. But the server has a say too. Right now the listener reports a boolean status and it’s mixed with some other value. I’m not even sure it’s correct, and I’d like this to be automated as much as possible, ideally not even take any info from the listener.
Process
Let’s try breaking this down by protocol version.
HTTP 1.0
Request has Keep-Alive | Response has Keep-Live | Persist
---------------------------------------------------------
No No No
No Yes No, this is invalid
Yes No No, listener refuses
Yes Yes Yes
HTTP 1.1
Request has Close | Response has Close | Persist
------------------------------------------------
No No Yes
No Yes No, server refuses
Yes No No
Yes Yes No
So all we need to do is… check the response! But how will the library know whether anything was sent? Options:
- Use an
IORef
orStateT
to get info fromsendResponse
- Make the listener return
Maybe Response
- Rely on the listener to run some function
Decision: Option 2. The listener will return a response, and the library will send it. Also cancel the sendResponse
function, unless it can be used in a lower API layer.
Result
Implemented. Will reopen if any issues arise.