-
Notifications
You must be signed in to change notification settings - Fork 465
Gzip support #69
Comments
👍 Same here. Gzipping and fingerprinting the assets on cordova-hcp build, deploying only those files to S3 and then unzipping them in the app would be really awesome! |
Nice suggestion, thanks for the idea! |
You can do a gzip compression on your server side. That's not enought ? |
There are no guarantees that the plugin code knows how to ungzip files, and I haven't checked if it does. Perhaps @nikDemyankov can clarify. |
There is no need to handle unzipping in the app if you set the correct headers on the file S3 upload, it will be handled transparently by the networking component since this is supported behaviour in HTTP protocol. |
According to http://stackoverflow.com/questions/7139268/automatically-handling-gzip-http-responses-in-android it is not automatic on Android. |
I see. What I have done on the S3 side before in other projects is simply to gzip files before uploading them (without changing the filename, i.e. not appending the .gz extension) and then setting the header "content-encoding:gzip" on each uploaded file. Works like a charm in browsers and webviews. I only wrote the chcp-cli and not the native code, but by looking at @nikDemyankov s code I think you are right @andreialecu, it will not currently be supported on Android. I'm no Android dev so I could be way off, but after a quick glance at the code I think the easiest fix is to check for content-type gzip in the response and if it's there pipe the input stream via GZIPInputStream. See http://www.rgagnon.com/javadetails/java-HttpUrlConnection-with-GZIP-encoding.html NSURLSession on iOS should support it right out of the box though, so I don't expect any changes to be needed there. We should probably verify that though :) |
Haven't checked this yet, so can't do any clarification on the question. But I think @hassellof is right. Will look into that after fixing some bugs. |
I'm using gzip compression on my web server. |
Hmm, maybe :) Good to hear, that it worked for you. But I will still add code to handle gzip compression on Android side. No changes are required for iOS, though. |
Hmm, actually, Android also supports it by default - http://developer.android.com/intl/ru/reference/java/net/HttpURLConnection.html . So, probably, no changes are required :) |
Closing it, since no code update is required. Gzip should work out of the box for both platforms. If not - please, reopen the issue. |
would be nice if cli automatically gzips content before uploading them to s3. |
This may be useful ? I've never used gulp so, not sure how to implement with cli. |
@seme1 it might be, thanks :) Although, this should go to nordnet/cordova-hot-code-push-cli#33 , not current thread. |
In my app's case, JS updates are rather big, 1 MB+. They would greatly benefit from being gzipped, but I'm not sure if the plugin supports this or not.
Would also be cool if the cli would have an option to gzip the files before uploading them to s3.
The text was updated successfully, but these errors were encountered: