-
Notifications
You must be signed in to change notification settings - Fork 35
Support responses without Content-Length #38
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
Comments
@zvxr What are the headers returned by HUE? Is it a chunked response? |
@tannewt raw response:
|
https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.4 Ok, looks like a bug on my part with HTTP1.1. |
@zvxr hi can you try the latest version we have released? |
@ladyada unfortunately I still receive an error using requests 1.7.4. For a PUT request it successfully executes but has issues reading response:
For a GET request:
ln 343 I tried also upgrading to latest adafruit_esp32spi (1.3.6). |
@zvxr Thanks for the second test! I suspected that it wouldn't work. Any idea how we should know when the response is complete? We could read to |
@tannewt makes sense-- I can't think of another way besides reading For HUE it does looks like all API responses include no whitespace in response. |
Since there's no @zvxr What board is this? ESP32SPI has access to socket state and it could be checked so that Requests and other higher-level protocols could handle this scenario. Something similar would need to be exposed for other socket sources. For CPython compatibility, it looks like |
@anecdata I have a couple projects using both Adafruit AirLift Shield and Adafruit Metro M4 Express AirLift -- both ESP32. |
Hi, i tried the Hue-Example with a PyPortal! i get this error before i can press the button on my hub: Finding bridge address... is ther a solution to overcome this? Many Thanks for Help! |
Closing as fixed by #123 |
Unfortunately HUE light hubs do not return HTTP responses with the
Content-Length
header (!!)Response._remaining
is based on Content-Length header. This inits withNonetype
value which causes comparison issues:Even when coercing or defaulting
Response._remaining
to zero instead, I think all methods now useResponse._remaining
so the actual content is never readable or drained properly.In version 1.6 it looks like the
Content-Length
is used for the content property, butResponse.iter_content
does not (It simply streams data). I believe that this is at least part of why it works when interacting with HUE.The text was updated successfully, but these errors were encountered: