Repository navigation
add port back to host arguments (sends correct host-header, fixes redirects) - #218
Conversation
|
Can someone check this please? It seems the tests are confused by the additional port information. The PR could be changed to only include the port if the port is not a standard port, but this would bloat the code without functional benefits. |
|
@bablokb you'll need to update all the tests. Random example: Adafruit_CircuitPython_Requests/tests/reuse_test.py Lines 175 to 182 in 82a656a If we sent the port on all of these, then we'll need to update all the tests. I also don't think a single if statement for a non-standard port would add that much bloat |
|
@justmobilize I changed the code: the hostname is passed as is (except to the socket-constructor), so the tests don't fail since they don't see the port anymore. |
|
@bablokb is it possible to add a test that hits that block? |
|
For someone who knows how to write and verify tests, certainly. But this is currently beyond my reach. From what the code does, it would be sufficient to pass a hostname:port combination, e.g. www.adafruit.com:80 or www.adadruit.com:443. Although these are the default ports, they get passed since the port is provided explicitly. |
|
I just don't understand why this is not merged. Just do the maths: you have two known serious bugs now and no tests, and with this PR you have no (known) bugs and still no tests, which seems like a huge improvement to me. I always thought this is one of the core libraries, but Adafruit seems to prefer to keep bugs and kill community involvement. |
Of course we don't prefer to keep bugs. This seems to have slipped under the radar because we were hoping for a test. We can have an LLM make a test quickly. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dhalbert
left a comment
There was a problem hiding this comment.
Thanks for the fix. A ping rather than anger would be preferred.
Updating https://github.com/adafruit/Adafruit_CircuitPython_Requests to 4.1.18 from 4.1.17: > Merge pull request adafruit/Adafruit_CircuitPython_Requests#218 from bablokb/fix-host-header > Merge pull request adafruit/Adafruit_CircuitPython_Requests#219 from MakerClassCZ/response-raw Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Added the following libraries: Adafruit_CircuitPython_JamPacked
The current version of
request()strips the port from the host-part of the url. Subsequently,_send_request()sends a wrong host-header. Also when relative redirects are processed, the missing original port will redirect to a wrong url.