The Wayback Machine - http://web.archive.org/web/20201006202843/https://github.com/harababurel/gcsf/issues/8
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gzip compression #8

Open
harababurel opened this issue Jun 27, 2018 · 7 comments
Open

gzip compression #8

harababurel opened this issue Jun 27, 2018 · 7 comments

Comments

@harababurel
Copy link
Owner

@harababurel harababurel commented Jun 27, 2018

Google suggests enabling gzip compression before transferring files over the network:

In order to receive a gzip-encoded response you must do two things: Set an Accept-Encoding header, and modify your user agent to contain the string gzip. Here is an example of properly formed HTTP headers for enabling gzip compression:

Accept-Encoding: gzip
User-Agent: my program (gzip)

Find a way to enable this option in GCSF.

@harababurel harababurel changed the title `gzip` compression gzip compression Jun 27, 2018
@briankabiro
Copy link

@briankabiro briankabiro commented Jul 2, 2018

Hi, @harababurel. I would like to pick this up. 😃

@harababurel
Copy link
Owner Author

@harababurel harababurel commented Jul 2, 2018

Great news! Let me know if I can be of any help.

@briankabiro
Copy link

@briankabiro briankabiro commented Jul 6, 2018

Noticed that we use hyper for network requests and that we'll have to pass the headers on every request that we make to Google Drive. Looking at how I can do that now.

Did you have any ideas on the approach to take?

@MatMercer
Copy link

@MatMercer MatMercer commented Jul 7, 2018

type GCDrive = drive3::Drive<GCClient, GCAuthenticator>;

gcsf uses hyper with the google_drive3 Crate, I don't see how we can add the gzip. I've only found something related to gzip in the hyper Crate here:

https://github.com/hyperium/hyper/blob/d42c983e3bfa2983bd563705e4cb76ad865a856c/src/proto/h1/role.rs#L801

I hope this helps!

@briankabiro
Copy link

@briankabiro briankabiro commented Jul 10, 2018

Thanks for the pointer!

I think the link shows that we can indeed use gzip by appending it to the headers when forming the request. The piece of code in the snippet checks that chunked is appended to Transfer Encoding when it is passed in as a header.

Gotten this from req.headers_mut().insert("content-type", HeaderValue::from_str("application/json")?); from the Hyper docs. Looking at how to integrate it with what we have.

@briankabiro
Copy link

@briankabiro briankabiro commented Oct 9, 2018

Haven't gotten any further with this, @harababurel - apologies for not speaking up sooner.

@harababurel
Copy link
Owner Author

@harababurel harababurel commented Oct 10, 2018

No worries -- I haven't had much time lately to work on the project either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.