drogonframework / drogonframework/drogon

Header "connection: close" disconnects the client before Response Stream is started

Open
#2,276 2 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
C++
Stars
14.3k
Forks
1.4k
Avg merge
1d 13h
Merged PRs (30d)
14

Description

**Describe the bug**

In our project we use Drogon for HTTP response streaming.
However, when client includes `connection` header that is not `keep-alive`, response stream is immediaitely closed.

Source code: https://github.com/drogonframework/drogon/blob/cbf63f8fc4d849bbb82eeb1c83fcf8ff953f19f3/lib/src/HttpServer.cc#L981-L990

It is common practice to use `connection: close` to indicate that connection should be closed *after processing is finished**, meaning - **after** HTTP response stream is done.

In our setup, we needed to patch drogon like this: https://github.com/openvinotoolkit/model_server/pull/3113/commits/8ca2918c04ae9fab77ad157dcd23673971d84420

**To Reproduce**
Steps to reproduce the behavior:
1. Start drogon with streaming response endpoint defined
2. Request with any client including header `connection: close`
3. Request is immediately rejected

**Expected behavior**
Connection is closed **after** response streaming is finished.

**Desktop (please complete the following information):**
- OS: ubuntu, redhat, windows
- Client: any

**More context**
We are using Continue VSCode plugin as a client for code completions: https://github.com/continuedev/continue
We use drogon to serve http streaming (code completions), however, this plugin (client) sends `connection: close` header.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.