Uploaded image for project: 'jclouds'
  1. jclouds
  2. JCLOUDS-1513

Blob Cache Control not being set in Google Cloud Storage

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.1.2
    • Fix Version/s: None
    • Component/s: jclouds-blobstore
    • Labels:
      None
    • Environment:
      google-cloud-storage

      Description

      The cacheControl attribute in Blob is not being sent to google cloud storage when uploading the blob (GCS supports the `cacheControl` metadata as stated here: https://cloud.google.com/storage/docs/json_api/v1/objects/insert#request-body).

      The log is as follows:

      19:36:19.634 [main] DEBUG o.j.rest.internal.InvokeHttpMethod - >> invoking Object:multipartUpload
      19:36:19.710 [main] DEBUG o.j.rest.internal.InvokeHttpMethod - >> invoking oauth2:authorize
      19:36:19.711 [main] DEBUG o.j.h.i.JavaUrlHttpCommandExecutorService - Sending request 1139593014: POST https://accounts.google.com/o/oauth2/token HTTP/1.1
      19:36:19.711 [main] DEBUG jclouds.wire - >> "grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=*********"
      19:36:19.712 [main] DEBUG jclouds.headers - >> POST https://accounts.google.com/o/oauth2/token HTTP/1.1
      19:36:19.712 [main] DEBUG jclouds.headers - >> Accept: application/json
      19:36:19.712 [main] DEBUG jclouds.headers - >> Content-Type: application/x-www-form-urlencoded
      19:36:19.712 [main] DEBUG jclouds.headers - >> Content-Length: 747
      19:36:20.563 [main] DEBUG o.j.h.i.JavaUrlHttpCommandExecutorService - Receiving response 1139593014: HTTP/1.1 200 OK
      19:36:20.563 [main] DEBUG jclouds.headers - << HTTP/1.1 200 OK
      19:36:20.563 [main] DEBUG jclouds.headers - << Transfer-Encoding: chunked
      19:36:20.563 [main] DEBUG jclouds.headers - << Accept-Ranges: none
      19:36:20.564 [main] DEBUG jclouds.headers - << X-Frame-Options: SAMEORIGIN
      19:36:20.564 [main] DEBUG jclouds.headers - << Alt-Svc: quic=":443"; ma=2592000; v="46,43,39"
      19:36:20.564 [main] DEBUG jclouds.headers - << Server: ESF
      19:36:20.564 [main] DEBUG jclouds.headers - << X-Content-Type-Options: nosniff
      19:36:20.564 [main] DEBUG jclouds.headers - << Vary: Origin,Accept-Encoding
      19:36:20.564 [main] DEBUG jclouds.headers - << Vary: Referer
      19:36:20.564 [main] DEBUG jclouds.headers - << Vary: X-Origin
      19:36:20.564 [main] DEBUG jclouds.headers - << X-XSS-Protection: 0
      19:36:20.564 [main] DEBUG jclouds.headers - << Date: Wed, 11 Sep 2019 11:36:20 GMT
      19:36:20.564 [main] DEBUG jclouds.headers - << Cache-Control: private
      19:36:20.564 [main] DEBUG jclouds.headers - << Content-Type: application/json; charset=utf-8
      19:36:20.567 [main] DEBUG jclouds.wire - << "{[\n]"
      19:36:20.567 [main] DEBUG jclouds.wire - << "  "access_token": "******"
      19:36:20.567 [main] DEBUG jclouds.wire - << "  "expires_in": 3600,[\n]"
      19:36:20.567 [main] DEBUG jclouds.wire - << "  "token_type": "Bearer"[\n]"
      19:36:20.567 [main] DEBUG jclouds.wire - << "}"
      19:36:20.571 [main] DEBUG o.j.h.i.JavaUrlHttpCommandExecutorService - Sending request -894182501: POST https://www.googleapis.com/upload/storage/v1/b/***************/o?uploadType=multipart HTTP/1.1
      19:36:20.572 [main] DEBUG jclouds.wire - >> "--multipart_boundary[\r][\n]"
      19:36:20.572 [main] DEBUG jclouds.wire - >> "Content-Disposition: form-data; name="Metadata"[\r][\n]"
      19:36:20.572 [main] DEBUG jclouds.wire - >> "Content-Type: application/json[\r][\n]"
      19:36:20.572 [main] DEBUG jclouds.wire - >> "[\r][\n]"
      19:36:20.572 [main] DEBUG jclouds.wire - >> "{"name":"room.jpg","size":13607,"contentType":"application/unknown","storageClass":"STANDARD","metadata":{}}[\r][\n]"
      19:36:20.572 [main] DEBUG jclouds.wire - >> "--multipart_boundary[\r][\n]"
      19:36:20.572 [main] DEBUG jclouds.wire - >> "Content-Disposition: form-data; name="room.jpg"[\r][\n]"
      19:36:20.572 [main] DEBUG jclouds.wire - >> "Content-Type: application/unknown[\r][\n]"
      19:36:20.572 [main] DEBUG jclouds.wire - >> "[\r][\n]"
      19:36:20.572 [main] DEBUG jclouds.wire - >> "[0xff][0xd8][0xff][0xe0][0x0][0x10]JFIF[0x0][0x1][0x1][0x0][0x0]H[0x0]H[......19:36:20.578 [main] DEBUG jclouds.wire - >> "--multipart_boundary--[\r][\n]"
      19:36:20.579 [main] DEBUG jclouds.headers - >> POST https://www.googleapis.com/upload/storage/v1/b/***************/o?uploadType=multipart HTTP/1.1
      19:36:20.579 [main] DEBUG jclouds.headers - >> Accept: application/json
      19:36:20.579 [main] DEBUG jclouds.headers - >> Authorization: Bearer *****************************
      19:36:20.579 [main] DEBUG jclouds.headers - >> Content-Type: multipart/form-data; boundary=multipart_boundary
      19:36:20.579 [main] DEBUG jclouds.headers - >> Content-Length: 13956
      19:36:21.353 [main] DEBUG o.j.h.i.JavaUrlHttpCommandExecutorService - Receiving response 781231910: HTTP/1.1 200 OK
      19:36:21.354 [main] DEBUG jclouds.headers - << HTTP/1.1 200 OK
      19:36:21.354 [main] DEBUG jclouds.headers - << Alt-Svc: quic=":443"; ma=2592000; v="46,43,39"
      19:36:21.354 [main] DEBUG jclouds.headers - << Server: UploadServer
      19:36:21.354 [main] DEBUG jclouds.headers - << ETag: CM6L8fDWyOQCEAE=
      19:36:21.354 [main] DEBUG jclouds.headers - << X-GUploader-UploadID: AEnB2UqnPaZ60MZFrE-X1greCBYZn5MPpKLFIZlQEwUCaEXvcl1kSxbj9j7IMAqxkkMLzI6n_DZMQGlizqfpMTBWLBJ0omt0_w
      19:36:21.354 [main] DEBUG jclouds.headers - << Vary: X-Origin
      19:36:21.354 [main] DEBUG jclouds.headers - << Vary: Origin
      19:36:21.354 [main] DEBUG jclouds.headers - << Pragma: no-cache
      19:36:21.354 [main] DEBUG jclouds.headers - << Date: Wed, 11 Sep 2019 11:36:21 GMT
      19:36:21.354 [main] DEBUG jclouds.headers - << Cache-Control: no-cache, no-store, max-age=0, must-revalidate
      19:36:21.354 [main] DEBUG jclouds.headers - << Content-Type: application/json; charset=UTF-8
      19:36:21.354 [main] DEBUG jclouds.headers - << Content-Length: 784
      19:36:21.354 [main] DEBUG jclouds.headers - << Expires: Mon Jan 01 08:00:00 PHT 1990
      19:36:21.354 [main] DEBUG jclouds.wire - << "{[\n]"
      19:36:21.355 [main] DEBUG jclouds.wire - << " "kind": "storage#object",[\n]"
      19:36:21.355 [main] DEBUG jclouds.wire - << " "id": "****************/room.jpg/1568201781298638",[\n]"
      19:36:21.355 [main] DEBUG jclouds.wire - << " "selfLink": "https://www.googleapis.com/storage/v1/b/***************/o/room.jpg",[\n]"
      19:36:21.355 [main] DEBUG jclouds.wire - << " "name": "room.jpg",[\n]"
      19:36:21.355 [main] DEBUG jclouds.wire - << " "bucket": "***************",[\n]"
      19:36:21.355 [main] DEBUG jclouds.wire - << " "generation": "1568201781298638",[\n]"
      19:36:21.355 [main] DEBUG jclouds.wire - << " "metageneration": "1",[\n]"
      19:36:21.355 [main] DEBUG jclouds.wire - << " "contentType": "application/unknown",[\n]"
      19:36:21.355 [main] DEBUG jclouds.wire - << " "timeCreated": "2019-09-11T11:36:21.298Z",[\n]"
      19:36:21.355 [main] DEBUG jclouds.wire - << " "updated": "2019-09-11T11:36:21.298Z",[\n]"
      19:36:21.355 [main] DEBUG jclouds.wire - << " "storageClass": "STANDARD",[\n]"
      19:36:21.355 [main] DEBUG jclouds.wire - << " "timeStorageClassUpdated": "2019-09-11T11:36:21.298Z",[\n]"
      19:36:21.355 [main] DEBUG jclouds.wire - << " "size": "13607",[\n]"
      19:36:21.355 [main] DEBUG jclouds.wire - << " "md5Hash": "xSF9hqcotKIm+vvOufxoQg==",[\n]"
      19:36:21.355 [main] DEBUG jclouds.wire - << " "mediaLink": "https://www.googleapis.com/download/storage/v1/b/***************/o/room.jpg?generation=1568201781298638&alt=media",[\n]"
      19:36:21.355 [main] DEBUG jclouds.wire - << " "crc32c": "0h4FCA==",[\n]"
      19:36:21.355 [main] DEBUG jclouds.wire - << " "etag": "CM6L8fDWyOQCEAE="[\n]"
      19:36:21.355 [main] DEBUG jclouds.wire - << "}[\n]"
      

      Attached is a sample project which demonstrates this.

        Attachments

        1. gcloud-cachecontrol-upload.zip
          18 kB
          Wilhansen Li

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              wilhansen Wilhansen Li
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: