Actions
Fix #41757
openWrong length of message when CORS header is involved.
Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
% Done:
0%
Description
If I exeucted the following command.
# s3cmd ws-info s3://test2 Bucket s3://test2/: Unable to receive website configuration.
the http response is captured as follows:
# ngrep -d lo port 7480 -W byline … ## T 10.231.252.119:7480 -> 10.231.252.119:46904 [AP] #6 HTTP/1.1 404 Not Found. Content-Length: 233. x-amz-request-id: tx000000000000000000003-005d789467-2e7306-default. Accept-Ranges: bytes. Content-Type: application/xml. Date: Wed, 11 Sep 2019 06:30:00 GMT. Connection: Keep-Alive. . ## T 10.231.252.119:7480 -> 10.231.252.119:46904 [AP] #8 <?xml version="1.0" encoding="UTF-8"?><Error><Code>NoSuchWebsiteConfiguration</Code><BucketName>test2</BucketName><RequestId>tx000000000000000000003-005d789467-2e7306-default</RequestId><HostId>2e7306-default-default</HostId></Error> ## T 10.231.252.119:7480 -> 10.231.252.119:46904 [AP] #10 <WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"></WebsiteConfiguration> ## …
The last part(separated by ##) of the message is generated in RGWGetBucketWebsite_ObjStore_S3::send_response method, which should not be generated in this case.
If the http request contains an HTTP_ORIGIN header, the op_ret is changed to 0 in the RGWOp :: generate_cors_headers method, and RGWGetBucketWebsite_ObjStore_S3 :: appends the success response after the failure response.
Nevertheless, in most cases, there is no problem because a http client cuts the message by a content-length header. However, sometimes when I use it with a reverse proxy, I get an bad gateway error.
No data to display
Actions