Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

how to unCompress gzip request with httpclient?#8909

Unanswered
baloyou asked this question inQ&A
Discussion options

I need to make a GET request via "HTTPClient", but the data is GZIP compressed, how can I decompress it?

This code would have been normal.But the API was changed to gzip form, and the received content became garbled.

if (https.begin(client, "https://devapi.qweather.com/v7/weather/now?location=101070102&key=mykey")) {  // HTTPS      Serial.print("[HTTPS] GET...\n");      int httpCode = https.GET();      if (httpCode > 0) {        Serial.printf("[HTTPS] GET... code: %d\n", httpCode);        if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {          String payload = https.getString();          Serial.println(payload);        }      } else {        Serial.printf("[HTTPS] GET... failed, error: %s\n", https.errorToString(httpCode).c_str());      }            https.end();
You must be logged in to vote

Replies: 1 comment

Comment options

You can't, for most practical purposes. The smallest GZip library out there, uzlib, needs a 32K contiguous dictionary buffer plus a few K of other buffers and structures. You're unlikely to have that much free, contiguous RAM at runtime.

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@baloyou@earlephilhower
Converted from issue

This discussion was converted from issue #8908 on April 16, 2023 17:36.


[8]ページ先頭

©2009-2025 Movatter.jp