x-versions-enabled objects do not support if-match conditional GET

Bug #1880239 reported by clayg
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Invalid
Undecided
Unassigned

Bug Description

I think I have some understanding of how if-match conditional GET requests are supposed to work.

Given an object with both a dynamic and static link:

vagrant@saio:~$ swift list test --json
[
  {
    "bytes": 0,
    "content_type": "application/symlink",
    "hash": "d41d8cd98f00b204e9800998ecf8427e",
    "last_modified": "2020-05-22T20:08:43.386630",
    "name": "hardlink",
    "symlink_path": "/v1/AUTH_test/test/test"
  },
  {
    "bytes": 0,
    "content_type": "application/symlink",
    "hash": "d41d8cd98f00b204e9800998ecf8427e",
    "last_modified": "2020-05-22T20:07:38.942880",
    "name": "link",
    "symlink_path": "/v1/AUTH_test/test/test"
  },
  {
    "bytes": 8,
    "content_type": "application/octet-stream",
    "hash": "70c1db56f301c9e337b0099bd4174b28",
    "last_modified": "2020-05-22T20:09:50.082480",
    "name": "test"
  }
]

You can make GET/HEAD requests with if-match: <etag> header and swift will only respond 200 if the etag matches:

vagrant@saio:~$ curl -s -H 'x-auth-token: AUTH_tkc0d886a2e02547778f9a3494967b53d0' http://saio:8080/v1/AUTH_test/test/test -I -H 'if-match: 70c1db56f301c9e337b0099bd4174b28' | head -n1
HTTP/1.1 200 OK
vagrant@saio:~$ curl -s -H 'x-auth-token: AUTH_tkc0d886a2e02547778f9a3494967b53d0' http://saio:8080/v1/AUTH_test/test/link -I -H 'if-match: 70c1db56f301c9e337b0099bd4174b28' | head -n1
HTTP/1.1 200 OK
vagrant@saio:~$ curl -s -H 'x-auth-token: AUTH_tkc0d886a2e02547778f9a3494967b53d0' http://saio:8080/v1/AUTH_test/test/hardlink -I -H 'if-match: 70c1db56f301c9e337b0099bd4174b28' | head -n1
HTTP/1.1 200 OK
vagrant@saio:~$ curl -s -H 'x-auth-token: AUTH_tkc0d886a2e02547778f9a3494967b53d0' http://saio:8080/v1/AUTH_test/test/test -I -H 'if-match: not-the-etag' | head -n1
HTTP/1.1 412 Precondition Failed
vagrant@saio:~$ curl -s -H 'x-auth-token: AUTH_tkc0d886a2e02547778f9a3494967b53d0' http://saio:8080/v1/AUTH_test/test/link -I -H 'if-match: not-the-etag' | head -n1
HTTP/1.1 412 Precondition Failed
vagrant@saio:~$ curl -s -H 'x-auth-token: AUTH_tkc0d886a2e02547778f9a3494967b53d0' http://saio:8080/v1/AUTH_test/test/hardlink -I -H 'if-match: not-the-etag' | head -n1
HTTP/1.1 412 Precondition Failed

This API behavior doesn't seem to follow on versioned objects:

vagrant@saio:~$ swift list vtest --json --versions
[
  {
    "bytes": 8,
    "content_type": "application/octet-stream",
    "hash": "70c1db56f301c9e337b0099bd4174b28",
    "is_latest": true,
    "last_modified": "2020-05-22T20:09:52.841630",
    "name": "test",
    "version_id": "1590178192.84163"
  }
]
vagrant@saio:~$ curl -s -H 'x-auth-token: AUTH_tkc0d886a2e02547778f9a3494967b53d0' http://saio:8080/v1/AUTH_test/vtest/test -I -H 'if-match: 70c1db56f301c9e337b0099bd4174b28' | head -n1
HTTP/1.1 200 OK
vagrant@saio:~$ curl -s -H 'x-auth-token: AUTH_tkc0d886a2e02547778f9a3494967b53d0' http://saio:8080/v1/AUTH_test/vtest/test -I -H 'if-match: not-the-etag' | head -n1
HTTP/1.1 200 OK

Which seems surprising.

Revision history for this message
clayg (clay-gerrard) wrote :

This bug only exists in https://review.opendev.org/#/c/724393/2 and we'll fix it before we merge it

summary: - x-versions-enabled objects do not support if-matchc conditional GET
+ x-versions-enabled objects do not support if-match conditional GET
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.