cheroot icon indicating copy to clipboard operation
cheroot copied to clipboard

Defer HTTP/1.1 parsing to Hyper (h11 project)

Open webknjaz opened this issue 5 years ago • 14 comments

I suggest merging our HTTP implementation with Hyper/H11: https://github.com/python-hyper/h11 / https://h11.readthedocs.io/.

This would contribute to having a well-made parser shared with others.

I've also declared the intent @ https://github.com/python-hyper/h11/issues/84

I'm submitting a ...

  • [ ] 🐞 bug report
  • [X] 🐣 feature request
  • [ ] ❓ question about the decisions made in the repository

🐞 Is your feature request related to a problem? Please describe.

Currently, CherryPy team has to maintain its own HTTP parser implementation which doesn't scale.

🐣 Describe the solution you'd like

We should contribute to one well-designed upstream parser implementation instead of maintaining our own thing. Shared responsibility is the key to having a healthy open source project :)

📋 Describe alternatives you've considered

N/A

📋 Additional context

Hyper is a bring-your-own-I/O set of principles encouraging users to rely on protocol implementations which do not hit the network. It also potentially offers testability improvements.

It'll also prevent problems like https://github.com/cherrypy/cheroot/pull/74

webknjaz avatar May 15 '19 19:05 webknjaz

Agreed this sounds like a good idea. The trick will be - can it be implemented without causing too much disruption.

jaraco avatar May 15 '19 19:05 jaraco

I hope yes, but it'll require extensive testing anyway and maybe it'll also require some changes on their side. But I hope that I'll be able to dedicate some time to this.

I think I've also asked @duper51 to look into this earlier...

webknjaz avatar May 15 '19 19:05 webknjaz

I would tend to agree with this issue, we should probably move parsing logic out of this project, as it introduces complexity that doesn't need to be here.

Agreed this sounds like a good idea. The trick will be - can it be implemented without causing too much disruption.

If there is disruption, it will be on projects relying on quirks of the existing parser (which isn't the best in terms of overall RFC compliance). I'd say if it breaks something in a dependent project, the reduced complexity will make any fixes easier.

ian-otto avatar May 19 '19 04:05 ian-otto

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 23 '19 14:07 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 21 '19 16:09 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 21 '19 20:11 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 20 '20 22:01 stale[bot]

Reviving this, as I have some more free time to deal with it.

Quick update, I've started work on a replacement HTTPRequest class to be a relatively "drop-in" replacement for the existing one. That said, we will likely see changes in some of the attributes that are available post-request. This is due to removing some error handling related attributes since they are now handled in h11. More updates soon (mostly just wanted to remove the stale tag).

ian-otto avatar Jan 21 '20 06:01 ian-otto

@ian-otto it'd be great if you could start a draft PR. It doesn't have to be completed but it's useful to see the progress even in the initial versions...

webknjaz avatar Jan 21 '20 07:01 webknjaz

Created! See #262

ian-otto avatar Jan 22 '20 00:01 ian-otto

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 22 '20 00:03 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 22 '20 07:05 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 25 '20 03:07 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 04 '20 03:10 stale[bot]