Comcast / Comcast/RestfulHttpsProxy
[Bug] Requests fail after keepalive timeout.
- Dominant language
- Go
- Stars
- 14
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
## Description
When the `CLIENT` made a request and got a response back and it was agreed between everyone to keep the TCP connection(s) alive, the state looks something like this:
```
CLIENT <-----> PROXY <-----> SERVER
```
The server may timeout after being in this state for some time.
```
CLIENT <-----> PROXY <--/--> SERVER
```
If the server times out, the client will still have a connection to the proxy, thinking the connection to the server is still open. It will begin transmitting the response and it will fail. The proxy needs to try to send the request to the server, and if it fails, it needs to retry. It currently does not do the retry, and the client gets confused and thinks the request was rejected.
## To Reproduce
To reliably reproduce this, you would need to write code on both the client and server side.
## Expected behavior
It should reopen the connection to the server and try sending again.
## Additional Context
The straight forward solution for closing both connections at the same time wont work, since there is no way to know if a tcp connection was closed without writing or reading from it. The body might be consumed when trying to write to a closed connection, in that case it makes no sense to retry (since it failed after it transmitted the header). In this case it is OK to not retry, the behavior would have been the same without the proxy. The problem is that it is impossible to know if the body was consumed/closed. A wrapper class needs to be made that will keep track of the state of the body.
Contributor guide
Assessment
This issue has not been assessed yet.