Skip to content

http1.1: support half closed clients #2066

Closed
@ldemailly

Description

@ldemailly

In http1.1 a client can choose to add "Connection: close" to the header and half close their (write) end of the socket and wait for the answer

What happens is envoy does forward the request but then immediately closes both end (probably because it reads the EOF/readability of 0 as an error instead of normal)

Repro

$ fortio curl -loglevel=debug -keepalive=false -halfclose http://echosrv2:8080/debug
18:41:30 D http.go:290> Created client:
{IP:10.39.255.58 Port:8080 Zone:}
GET /debug HTTP/1.1
Host: echosrv2:8080
Connection: close
User-Agent: istio/fortio-0.3.6

18:41:30 D http.go:504> Half closed ok after sending request &{{0xc4200e25b0}} {10.39.255.58 8080 }
18:41:30 E http.go:545> EOF before reading anything on &{{0xc4200e25b0}} {10.39.255.58 8080 }
18:41:30 V fortio_main.go:141> Fetch result code -1, data len 0, headerlen 0

envoy log

[2017-11-16T18:41:30.081Z] "GET /debug HTTP/1.1" 0 - 0 0 0 - "-" "istio/fortio-0.3.6" "e16c359b-048a-47a5-b5ab-b5e917bd2f72" "echosrv2:8080" "10.36.2.8:8080"

Spec extract

Servers SHOULD always respond to at least one request per connection, if at all possible. Servers SHOULD NOT close a connection in the middle of transmitting a response, unless a network or client failure is suspected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/httpstalestalebot believes this issue/PR has not been touched recently

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions