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

[bug] URL parssing error in the web server #489

ghost opened this issue Sep 3, 2015 · 2 comments

[bug] URL parssing error in the web server #489

ghost opened this issue Sep 3, 2015 · 2 comments


Copy link

@ghost ghost commented Sep 3, 2015

If you run this simple server example :

import asyncio
from aiohttp import web

def handle(request):
    return webResponse(body=request.path.encode('utf8'))

def init(loop):
    app = web.Application(loop=loop)
    app.router.add_route('GET', '/', handle)
    srv = yield from loop.create_server(app.make_handler(), '', 5555)
    return srv

loop = asyncio.get_event_loop()

except KeyboardInterrupt:

The following requests will get a 200 OK with the considered path as content :

$ curl -X GET
$ curl -X GET

As you can see, the path of the URL is not well parsed.

This bug resides in the _splitted_path non-data descriptor which uses urlsplit on a path rather than a full URL. The consequence is a second segment interpreted as a network location if the first one is empty.

I've not quite investigated a fix at the moment, but _splitted_path only being used by raw_path and query_string seems to be a plea to use a fake scheme and netloc for urlsplit to behave the expected way.

@asvetlov asvetlov added the bug label Sep 3, 2015
Copy link

@asvetlov asvetlov commented Sep 3, 2015

I'll take a look


@asvetlov asvetlov self-assigned this Sep 3, 2015
@asvetlov asvetlov added this to the 0.18 milestone Sep 3, 2015
@asvetlov asvetlov closed this in 430af0a Sep 4, 2015
asvetlov added a commit that referenced this issue Sep 4, 2015
asvetlov added a commit that referenced this issue Sep 4, 2015
Copy link

@lock lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.


@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant