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

wsgiserver: implement parse_headers #115

Merged
merged 3 commits into from Jun 6, 2021
Merged

Conversation

Anton-2
Copy link

@Anton-2 Anton-2 commented Nov 12, 2020

This PR implements parse_headers, which is not available in adafruit_requests anymore.

It also adds a default return status of 500 Internal Server Error, this helped me when debugging an app using Adafruit_CircuitPython_WSGI.

Lastly, we always add a Connection: close header. The server is not ready to handle keep-alive requests, it seems better to make it clear for the client.

…en the wsgi application misbehaves, and make sure nobody think we can handle keep-alive requests.
@astrilchuk
Copy link

Thanks @Anton-2 for this fix. I hope it gets merged soon since the wsgiserver is currently broken.

@siddacious siddacious self-requested a review November 18, 2020 11:39
Copy link
Contributor

@siddacious siddacious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Anton-2 Apologies for the delay; parse_headers exists in request as _parse_headers a private-ish method of the class, WSGIServer needs to be updated to not try to parse the headers itself and instead access the parsed headers with Response.headers.

@jposada202020
Copy link
Contributor

@Anton-2 this is a long time (I know) are you still interested on working on this, if so, could you take intro consideration the comments above. let us know thanks :)

@Neradoc
Copy link
Contributor

Neradoc commented Jun 3, 2021

wsgiserver does not make requests, it only uses the parse_headers function to pass them to the application. I might be missing something, but I don't see how or why we would want to use the Response class here instead of just duplicating the function from the old requests (and drop the dependency) like the PR does.

@jposada202020
Copy link
Contributor

@brentru Hello :) what are your thoughts on this?
Thanks

@brentru
Copy link
Member

brentru commented Jun 4, 2021

The proposed changes make sense to me.

@jposada202020
Copy link
Contributor

Good Thanks, if that is the case I think this is settled, I will let some day to merge to see after bumping this PR other folks have comments. Thanks

@jposada202020 jposada202020 merged commit 6fa5901 into adafruit:master Jun 6, 2021
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jun 12, 2021
Updating https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI to 3.5.11 from 3.5.10:
  > Moved default branch to main
  > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#115 from Anton-2/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_Seesaw to 1.9.1 from 1.9.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_seesaw#74 from jposada202020/adding_new_example
  > Merge pull request adafruit/Adafruit_CircuitPython_seesaw#73 from kattni/rotary-neopixel-example
  > Merge pull request adafruit/Adafruit_CircuitPython_seesaw#71 from jposada202020/adding_new_guides

Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1325 to 1.2.5 from 1.2.4:
  > Moved default branch to main
  > Moved CI to Python 3.7
  > Added help text and problem matcher
  > Added pull request template
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k to 1.10.3 from 1.10.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_Wiznet5k#38 from bjnhur/master
  > Redoing adafruit/Adafruit_CircuitPython_Wiznet5k#37

Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE to 8.0.2 from 8.0.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE#116 from alexwhittemore/master
  > Moved default branch to main
  > Added help text and problem matcher
  > Added pull request template

Updating https://github.com/adafruit/Adafruit_CircuitPython_ImageLoad to 0.14.2 from 0.14.1:
  > Moved default branch to main
  > Moved CI to Python 3.7
  > Added help text and problem matcher
  > Added pull request template

Updating https://github.com/adafruit/Adafruit_CircuitPython_Simple_Text_Display to 1.0.1 from 1.0.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_Simple_Text_Display#1 from jposada202020/testing_readthedocs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants