Mehdisouid / google-api-java-client

Automatically exported from code.google.com/p/google-api-java-client
0 stars 0 forks source link

Support for gzip media content on resumable media upload #691

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
External references, such as a standards document, or specification?

http://javadoc.google-api-java-client.googlecode.com/hg/1.12.0-beta/com/google/a
pi/client/googleapis/media/MediaHttpUploader.html

Java environments (e.g. Java 6, Android 2.3, App Engine, or All)?

All

Please describe the feature requested.

Currently we do not gzip media content chunks on resumable media upload.  To be 
consistent, we should gzip it.  In 1.13 we had to disable that functionality 
because the media content length wasn't being computed correctly.  So we should 
fix that.

Original issue reported on code.google.com by yan...@google.com on 20 Dec 2012 at 4:55

GoogleCodeExporter commented 9 years ago

Original comment by rmis...@google.com on 18 Jan 2013 at 6:27

GoogleCodeExporter commented 9 years ago
The problem I am running into is (using example values):

Original content length - 10000
Gzipped content length -   8000
Minimum chunk size -       2000

Initiation request says x-upload-content-length will be 8000

We start uploading a chunk of 2000 from the original content of 10000.
The chunk gets gzipped in HttpRequest and is now 1500.

This 1500 is below the minimum chunk length allowed and an exception is thrown.

We do not know what chunk size to use to get a gzipped chunk that is equal to 
the specified chunk size.

Original comment by rmis...@google.com on 24 Jan 2013 at 6:35

GoogleCodeExporter commented 9 years ago
Given the above comment I upped the chunk size to 
MediaHttpUploader.MINIMUM_CHUNK_SIZE * 2 and calculated the gzipped size of 
each chunk but I still end up with an IOException:

CONFIG: -------------- REQUEST  --------------
PUT 
https://www.googleapis.com/upload/drive/v2/files?uploadType=resumable&upload_id=
AEnB2UpVOG2pvLe4WvfDg6h4DbVv2FuaKP89LWVPOiy24dIIPuma3OffEhCqKe1ahYSdHQ16i18nhW8X
ty_EpXXXRKtJsNEfrQ
Accept-Encoding: gzip
Authorization: <Not Logged>
Content-Range: bytes 0-523351/523670
User-Agent: Google-HTTP-Java-Client/1.14.0-beta-SNAPSHOT (gzip)
Content-Type: image/jpeg
Content-Length: 523352

java.io.IOException: insufficient data written
        at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.close(HttpURLConnection.java:3120)
        at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:241)
        at com.google.api.client.http.GZipEncoding.encode(GZipEncoding.java:38)
        at com.google.api.client.http.HttpEncodingStreamingContent.writeTo(HttpEncodingStreamingContent.java:51)
        at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:80)
        at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1084)
        at com.google.api.client.googleapis.media.MediaHttpUploader.upload(MediaHttpUploader.java:358)
        at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:438)
        at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:363)

I am not sure what is going on, I expected the above to work.

Original comment by rmis...@google.com on 24 Jan 2013 at 6:44

GoogleCodeExporter commented 9 years ago
Doesn't seem worth the effort right now.

Original comment by yan...@google.com on 26 Jan 2013 at 5:46

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 7 Feb 2013 at 12:05

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 10 Jun 2013 at 1:21

GoogleCodeExporter commented 9 years ago

Original comment by pele...@google.com on 29 Jul 2013 at 6:10

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 27 Sep 2013 at 12:05