SWIFT operation COPY fails when content-length header contains extra spaces

Bug #890118 reported by Nithya Ganesan
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Invalid
Undecided
Unassigned

Bug Description

Swift Version Used:
================
Swift 1.4.3 Diablo

Problem
=======
While performing COPY operation of objects from one container to another, if we add additional spaces in the header content-length, the header does not get recognized and gives the following error. Please note that removing the spaces solves the problem

With Spaces in Content-Length header:
================================
curl --insecure -X PUT -D - -H "X-Auth-Token: <AUTHTOKEN>" -H "X-Copy-From : CONTAINER1/FILE1" -H "Content-Length : 0" <SWIFT-ENDPOINT>/CONTAINER2/FILE1

HTTP/1.1 411 Length Required
Content-Length: 165
Content-Type: text/html; charset=UTF-8
X-Trans-Id: <TRANS ID>
Date: Mon, 14 Nov 2011 07:49:55 GMT

<html>
 <head>
  <title>411 Length Required</title>
 </head>
 <body>
  <h1>411 Length Required</h1>
  Content-Length header required.<br /><br />
 </body>
</html>

Without Spaces in Content-Length header:
===================================
curl --insecure -X PUT -D - -H "X-Auth-Token: <AUTHTOKEN>" -H "X-Copy-From : CONTAINER1/FILE1" -H "Content-Length:0" <SWIFT-ENDPOINT>/CONTAINER2/FILE1
HTTP/1.1 201 Created
Content-Length: 118
Content-Type: text/html; charset=UTF-8
Etag: <etag>
Last-Modified: Mon, 14 Nov 2011 08:05:28 GMT
X-Trans-Id: <TRANSID>
Date: Mon, 14 Nov 2011 08:05:28 GMT

<html>
 <head>
  <title>201 Created</title>
 </head>
 <body>
  <h1>201 Created</h1>
  <br /><br />

 </body>
</html>r

summary: - COPY command fails when content-length header contains extra spaces
+ SWIFT operation COPY fails when content-length header contains extra
+ spaces
Revision history for this message
Donagh McCabe (donagh-mccabe) wrote :

This applies to any request header (x-auth-token, etc) -- a space in the field-name will cause the header to be unrecognised.

 From http://tools.ietf.org/html/rfc2616:

       message-header = field-name ":" [ field-value ]

and
      field-name = token

and
       token = 1*<any CHAR except CTLs or separators>

Hence, the header field name should not have any spaces in it.

This should be closed as invalid of won't fix.

Changed in swift:
status: New → Invalid
Revision history for this message
Michał Kamiński (michal-kaminski) wrote :

The problem is not connected in space in field name but generaly with valid content length header:

34 > PUT http://localhost:8888/v1/AUTH_793ed4a516324c0a9782015144080490/testcontainer/newobject.txt
34 > X-Copy-From: /testcontainer/swift-test-file
34 > Content-Length: 28
34 > X-Auth-Token: f872ea66d392461bb64e36dd46d7d45e
34 > Accept: application/json
34 > Content-Type: text/plain

maj 21, 2013 11:04:12 AM com.sun.jersey.api.client.filter.LoggingFilter log
INFO: 34 * Client in-bound response
34 < 411
34 < Date: Tue, 21 May 2013 08:56:02 GMT
34 < Content-Length: 57
34 < Connection: keep-alive
34 < Content-Type: text/plain; charset=UTF-8
34 <
411 Length Required

Changed in swift:
status: Invalid → New
Revision history for this message
Michał Kamiński (michal-kaminski) wrote :

Sorry the problem was with my jersey client which ignored seted content-lengh header. Whole functionality works fine with valid header.

Changed in swift:
status: New → Invalid
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.