cloudserver icon indicating copy to clipboard operation
cloudserver copied to clipboard

Executing HEAD request never completes 223 bytes left

Open matusnovak opened this issue 2 years ago • 0 comments

Bug report information

Executing a HEAD request via curl or any http client library will cause the request to time out.

Description

I have found this by accident. I understand that the HEAD request via curl does not make sense from a functional perspective, but the request should gracefully return error 405 but instead it does not return anything.

Steps to reproduce the issue

docker run -d --name zenko -e SCALITY_ACCESS_KEY_ID=admin -e SCALITY_SECRET_ACCESS_KEY=Password1 -e S3BACKEND=mem -p 8000:8000 zenko/cloudserver:latest

curl -X HEAD -u admin:Password1 -v -k "http://127.0.0.1:8000/"
# Stuck

Actual result

The request gets stuck and eventually times out. Notice the "Content-Length: 223". The curl is waiting for 223 more bytes from Zenko but those are never transmitted.

$ curl -X HEAD -u admin:Password1 -v -k "http://127.0.0.1:8000/"
*   Trying 127.0.0.1:8000...
* Connected to 127.0.0.1 (127.0.0.1) port 8000 (#0)
* Server auth using Basic with user 'admin'
> HEAD / HTTP/1.1
> Authorization: Basic YWRtaW46UGFzc3dvcmQx
> User-Agent: curl/7.82.0
> Host: 127.0.0.1:8000
> Accept: */*
> 
< HTTP/1.1 405 Method Not Allowed
* Server S3 Server is not blacklisted
< server: S3 Server
< x-amz-id-2: 8455a4e76245b14eb6dd
< x-amz-request-id: 8455a4e76245b14eb6dd
< Content-Type: application/xml
< Content-Length: 223
< Date: Fri, 10 Jun 2022 12:19:34 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5
< 
* transfer closed with 223 bytes remaining to read
* Closing connection 0
curl: (18) transfer closed with 223 bytes remaining to read

Expected result

Return HTTP 405 response without timing out.

Additional information

Docker version: latest as of writing this issue. Digest: b53e57829cf7.

matusnovak avatar Jun 10 '22 12:06 matusnovak