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

URL with # #824

Closed
wanggp3 opened this issue Mar 11, 2016 · 8 comments
Closed

URL with # #824

wanggp3 opened this issue Mar 11, 2016 · 8 comments

Comments

@wanggp3
Copy link

wanggp3 commented Mar 11, 2016

test.py

import asyncio,aiohttp
url = 'http://www.bcbgeneration.com/shop-dresses-day#?start=0&sz=39&format=ajax'
@asyncio.coroutine
def fetch():
session = aiohttp.ClientSession()
      r = yield from session.get(url)
      body = yield from r.read()
      print(r.status)
      session.close()

def get():
      import requests
      r = requests.get(url)
      print(r.status_code)

 get()

 print('===' * 10)

 loop = asyncio.get_event_loop()
 loop.run_until_complete(fetch())
 loop.close()

You can see that when a '#' in the url, aiohttp fail to get the url, but the requests can. I don't know why it , can you tell me

@rutsky
Copy link
Member

rutsky commented Mar 24, 2016

Hash part of address string shouldn't be send on the sever by aiohttp: http://stackoverflow.com/a/3664262/391865

I'm outside of dev environment, so can't test what aiohttp does.
Is aiohttp sends it to the server? Then it's a bug.

@avamsi
Copy link
Contributor

avamsi commented Aug 27, 2016

@asvetlov This behavior is undesirable, right?
Why was #846 closed?

@asvetlov
Copy link
Member

asvetlov commented Aug 27, 2016

It was an accidental mistake.
The PR was committed as 01057dc.
Thank you for raising the question up.

@remort
Copy link

remort commented Jun 25, 2019

I still face this issue with aiohttp version 3.4.4. During Yandex oAuth flow my server get request at 'redirect uri' from yandex. Url parameters within this url are started with # instead of &. And aiohttp's request.query represents an empty multidict object. request.query_string is empty.

@webknjaz
Copy link
Member

@remort fragment part does not reach HTTP servers and is accessible only from the client.

@remort
Copy link

remort commented Jun 25, 2019

@webknjaz, you mean aiohttp server cuts fragment part off the url ?

But, you're right, I used wrong oAuth implicit flow which is intended to be used with JS-apps. Since I use authorization code flow within my server app, I got my customers access code and so on...

But cutting off fragment part from url at the server side is a big question.
Thank you!

@webknjaz
Copy link
Member

webknjaz commented Jun 25, 2019

@remort server doesn't even receive that. Because according to the standard, browsers doesn't send the fragment part at all (it's illegal from the HTTP perspective).

@remort
Copy link

remort commented Jun 25, 2019

@webknjaz, ok, thank you for clarification. My fault then.

@lock lock bot added the outdated label Jun 24, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants