-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Allow content compression with gzip #137
Comments
Not yet! |
Any news regarding this feature ? |
Previously bgm.tv is used because it's behind cdn and, theoretically, can provide a better user experience. However it looks like cloudflare is blocking non-standard way to access html files. On iOS munin is able to download and parse files, however on Android(Pixel, Android 9) munin is blocked by cloudflare(error: https://support.cloudflare.com/hc/en-us/articles/200171806-Error-1010-The-owner-of-this-website-has-banned-your-access-based-on-your-browser-s-signature). Changing user agent/adding browser-like headers don't work. Cloudflare must be using some super advanced machine learning algorithms to identify browser/non-browser... Workarounds I can think of 1. Use bangumi.tv to authorize user and parsing html(bangumi.tv is not officially documented as the oauth server but it works. Well, we are now officially entering the uncharted territory) 2. Let user directly enter emails/password in our app, and munin will handle login for them(this should always work but it might freaks users out since we are asking account/password directly) We opt for 1 for now. Side note: I suspect this is related to DIO, some preliminary experiments showed dart plain http client is not blocked by cf Side note2: it seems like DIO currently doesn't support gzip, cfug/dio#137 while plain http client does. Maybe we should stick with old-school dart http client...
Any news after 2 years? Thanks! @wendux |
Is it possible now? |
It can be simply implemented as requestEncoder: var dio = Dio(BaseOptions(
requestEncoder: gzipEncoder,
));
// gzip request
List<int> gzipEncoder(String request, RequestOptions options) {
options.headers.putIfAbsent("Content-Encoding", () => "gzip");
return gzip.encode(utf8.encode(request));
} |
I tried this solution. But this throws FormatException. bad data. This is the code I tried.
|
This worked for me! And I'm guessing that Dio automatically handles the decompression when the response is received in gzip format!
|
Is it possible to compress POST request with gzip ?
The text was updated successfully, but these errors were encountered: