Using swift3/test/functional/s3curl.pl "copySrc" option returns "411 Length Required"

Bug #1381787 reported by ariday
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Swift3
Incomplete
Undecided
Unassigned

Bug Description

--On Swift3 Implemented Operations - using https://github.com/stackforge/swift3/blob/master/swift3/test/functional/s3curl.pl script (to interface with S3) using copySrc option returns error: MissingContentLength- You must provide the Content-Length HTTP header.

e.g: ./s3curl.pl --id personal_ks --copySrc container1/openrc -- -v http://9.18.76.57:8080/container1/openrc11
* About to connect() to 9.18.76.57 port 8080 (#0)
* Trying 9.18.76.57...
* Connected to 9.18.76.57 (9.18.76.57) port 8080 (#0)
> PUT /container1/openrc11 HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 9.18.76.57:8080
> Accept: */*
> Date: Thu, 09 Oct 2014 16:21:38 +0000
> Authorization: AWS 24ebedc0e10f400b9ebdc33b05cc322b:M/SjbxRgzYtyvYO+Is3OW53UIhU=
> x-amz-copy-source: container1/openrc
>
< HTTP/1.1 411 Length Required
< x-amz-id-2: txf3d3adb9b4304fc8872d6-005436b612
< x-amz-request-id: txf3d3adb9b4304fc8872d6-005436b612
< Content-Type: text/xml
< X-Trans-Id: txf3d3adb9b4304fc8872d6-005436b612
< Date: Thu, 09 Oct 2014 16:21:38 GMT
< Transfer-Encoding: chunked
<
<?xml version='1.0' encoding='UTF-8'?>
* Connection #0 to host 9.18.76.57 left intact
<Error><Code>MissingContentLength</Code><Message>You must provide the Content-Length HTTP header.</Message><RequestId>txf3d3adb9b4304fc8872d6-005436b612</RequestId></Error>

--Try to set the right Content-Length of the source object and returns: InternalError- We encountered an internal error. Please try again. Reason: Copy requests require a zero byte body.
e.g : # ./s3curl.pl --id personal_ks --copySrc container1/openrc -- -H "Content-Length:131" -v http://9.18.76.57:8080/container1/openrc11
* About to connect() to 9.18.76.57 port 8080 (#0)
* Trying 9.18.76.57...
* Connected to 9.18.76.57 (9.18.76.57) port 8080 (#0)
> PUT /container1/openrc11 HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 9.18.76.57:8080
> Accept: */*
> Date: Thu, 09 Oct 2014 16:36:56 +0000
> Authorization: AWS 24ebedc0e10f400b9ebdc33b05cc322b:oxYLIwsoSPcsk3ehn8ULfbNBvp8=
> x-amz-copy-source: container1/openrc
> Content-Length:131
>
< HTTP/1.1 500 Internal Server Error
< x-amz-id-2: tx0ff450cf4ea848d58f43a-005436b9a8
< x-amz-request-id: tx0ff450cf4ea848d58f43a-005436b9a8
< Content-Type: text/xml
< X-Trans-Id: tx0ff450cf4ea848d58f43a-005436b9a8
< Date: Thu, 09 Oct 2014 16:36:56 GMT
< Transfer-Encoding: chunked
<
<?xml version='1.0' encoding='UTF-8'?>
* Connection #0 to host 9.18.76.57 left intact
<Error><Code>InternalError</Code><Message>We encountered an internal error. Please try again.</Message><RequestId>tx0ff450cf4ea848d58f43a-005436b9a8</RequestId><Reason>Copy requests require a zero byte body</Reason></Error>

--Swift constraint.py from 165 to167 line of code indicates Content-length should be 0:
 if 'X-Copy-From' in req.headers and req.content_length:
        return HTTPBadRequest(body='Copy requests require a zero byte body',
                              request=req, content_type='text/plain')

--For this reason the alternative requests form would be:
./s3curl.pl --id personal_ks --copySrc=<source-bucket-name/source-key-name> -- -H "Content-Length:0" http://<AWS endpoint>:8080/<bucket_name>/<key_name>
./s3curl.pl --id personal_ks -- -X PUT -H 'x-amz-copy-source:<source-bucket-name/source-key-name>' -H "Content-Length:0" http://<AWS endpoint>:8080/<bucket_name>/<key_name>

--But it would be expected that the requirement of Content-Length could be handled by the s3curl script.

Revision history for this message
Kota Tsuyuzaki (tsuyuzaki-kota) wrote :

Hi, ariday. We've already no longer used s3curl for the functional tests so I guess we can close this issue. Is that ok for you?

Revision history for this message
Kota Tsuyuzaki (tsuyuzaki-kota) wrote :

We need more information about this report.

Changed in swift3:
status: New → Incomplete
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.