-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
How to override HTTP CONNECT #4571
Comments
aiohttp is a framework for writing web apps, not HTTP proxies. I don't think we'll ever support that. |
OK. But the header must be processed correctly. For example, give the code 405 Method Not Allowed |
I agree the CONNECT support would be nice to have (while 99% of users don't need it). Pull Request is welcome! |
I've written the test to reproduce: async def test_view_connect(aiohttp_client: Any) -> None:
class MyView(web.View):
async def connect(self) -> web.StreamResponse:
return web.Response(text="OK")
app = web.Application()
app.router.add_route("CONNECT", "/", MyView)
client = await aiohttp_client(app)
resp = await client.request("CONNECT", "/")
assert await resp.text() == "OK" |
Hello, @andrey-oparin, there is no activity here for the last 3 years, let's close this issue for now and reopen if needed. |
Does the test still reproduce? |
No, I didn't manage to do that |
Well, if that test is failing, then it's still an issue. As far as I can see, the documentation says that should work. |
OK, so the URL for CONNECT gets changed to the authority-form (https://datatracker.ietf.org/doc/html/rfc7230#section-5.3.3), which then causes the resolve() algorithm to not match any endpoints. Given that CONNECT should only be used for proxies and we don't intend to support this, maybe it makes the most sense to just remove the connect() method and update the documentation? |
🐞 Describe the bug
I implement HTTP/HTTPS Proxy based on aiohttp and I need override HTTP connect method in subclass of aiohttp.web.View such as this guide
https://aiohttp.readthedocs.io/en/latest/web_reference.html
Overridable coroutine methods: connect(), delete(), get(), head(), options(), patch(), post(), put(), trace().
In this sample code, HTTP connect handler never called
💡 To Reproduce
The text was updated successfully, but these errors were encountered: