Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-29796

Don't use http status 308 for batch upload's "Resume Incomplete"

    XMLWordPrintable

    Details

    • Release Notes Summary:
      Batch upload "Resume Incomplete" returns HTTP 202
    • Impact type:
      API change
    • Upgrade notes:
      Hide

      When doing a

      POST /nuxeo/api/v1/upload/{batchId}/{fileIdx}
      

      to upload a chunk (i.e., with header X-Upload-Type: chunked), the server will now return 202 instead of 308 when not all chunks have been uploaded.

      The same applies to

      GET /nuxeo/api/v1/upload/{batchId}/{fileIdx}
      

      which gets the status of an upload.

      Show
      When doing a POST /nuxeo/api/v1/upload/{batchId}/{fileIdx} to upload a chunk (i.e., with header X-Upload-Type: chunked ), the server will now return 202 instead of 308 when not all chunks have been uploaded. The same applies to GET /nuxeo/api/v1/upload/{batchId}/{fileIdx} which gets the status of an upload.
    • Team:
      FG
    • Sprint:
      nxplatform #46
    • Story Points:
      2

      Description

      Our BatchUpload mechanism uses code 308 to express "Resume Incomplete" which means that a chunked upload is not yet finished (see class BatchUploadObject). This use of 308 was inspired by the Google Drive REST API, however it was non-standard and now 308 has another official meaning of Permanent Redirect (yet another variant).

      RFC 7238 has normalized this meaning of "Permanent Redirect".

      Some libraries (like Apache httpclient 4.5.12) now therefore expect any 308 response to have a Location header, which our 308 responses don't have.

      This will cause problems in the future (in actually prevents us from upgrading to httpclient 4.5.12 without test code changes, see below), so we should think about another status code for this use in chunked upload, and change our client sdks to understand a new one.

      httpclient 4.5.13
      com.sun.jersey.api.client.ClientHandlerException: org.apache.http.client.ClientProtocolException
      	at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187)
      	at com.sun.jersey.api.client.filter.HTTPBasicAuthFilter.handle(HTTPBasicAuthFilter.java:105)
      	at com.sun.jersey.api.client.Client.handle(Client.java:652)
      	at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)
      	at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
      	at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:509)
      	at org.nuxeo.ecm.restapi.test.BaseTest.getResponse(BaseTest.java:178)
      	at org.nuxeo.ecm.restapi.test.BaseTest.getResponse(BaseTest.java:125)
      	at org.nuxeo.ecm.restapi.test.BatchUploadFixture.testChunkedUpload(BatchUploadFixture.java:464)
      Caused by: org.apache.http.client.ClientProtocolException
      	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:187)
      	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
      	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
      	at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:171)
      	... 70 more
      Caused by: org.apache.http.ProtocolException: Received redirect response HTTP/1.1 308  but no location header
      	at org.apache.http.impl.client.DefaultRedirectStrategy.getLocationURI(DefaultRedirectStrategy.java:148)
      	at org.apache.http.impl.client.DefaultRedirectStrategy.getRedirect(DefaultRedirectStrategy.java:223)
      	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:126)
      	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
      	... 73 more
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 30 minutes
                  30m