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 # in response #1314

Closed
Fahreeve opened this issue Oct 14, 2016 · 19 comments
Closed

URL with # in response #1314

Fahreeve opened this issue Oct 14, 2016 · 19 comments
Labels
Milestone

Comments

@Fahreeve
Copy link

Long story short

url address of original response looks like http://someurl.bla/test.html#access_token=blabla&ab=1 but in aiohttp response.url I can see only http://someurl.bla/test.html

Expected behaviour

I want to have a full address in response.url

Actual behaviour

response.url has only this part: http://someurl.bla/test.html

@asvetlov
Copy link
Member

This is intended behavior.
See #846

@Fahreeve
Copy link
Author

have I simple way how to change it back?

@asvetlov
Copy link
Member

No response contains real URL sent to server.
If you want keep unmodified version -- please save it in your own storage manually.

@Fahreeve
Copy link
Author

I don't agree with you
You can see an example in this page:
https://vk.com/dev/implicit_flow_user in point 3

@asvetlov asvetlov reopened this Oct 16, 2016
@Fahreeve
Copy link
Author

For my library I'm using this code:

class CustomClientResponse(aiohttp.ClientResponse):

    async def start(self, connection, read_until_eof=False):
        await super().start(connection, read_until_eof)
        headers = CIMultiDict(self.headers)
        location = headers.get(hdrs.LOCATION, None)
        if location is not None:
            headers[hdrs.LOCATION] = location.replace('#', '?')
        self.headers = CIMultiDictProxy(headers)
        self.raw_headers = tuple(headers.items())
        return self

@asvetlov
Copy link
Member

asvetlov commented Oct 19, 2016

Please correct me if I'm wrong: VK API does rely on fragment data and there is no way to do it via current aiohttp client API.
Is it correct?

@Fahreeve
Copy link
Author

Fahreeve commented Oct 19, 2016

VK API does relay on fragment data

я не могу понять эту фразу на английском, но полагаю, что вы поймете меня на русском
проблема в том, что при успешной авторизации в соц. сети происходит перенаправление на адрес
https://oauth.vk.com/blank.html#access_token= 533bacf01e11f55b536a565b57531ad114461ae8736d6506a3&expires_in=86400&user_id=8492&state=123456 в версии 0.21.6 все работало, но потом я обновился до 1.0.3 и все что после # перестало было доступным в переменных history или url объекта response

@rutsky
Copy link
Member

rutsky commented Oct 19, 2016

I think @asvetlov intended to say "VK API does rely on fragment data" ("VK API зависит от передачи фрагмента (части после #) браузером серверу").

@Fahreeve I believe you missed somewhere escaping of # in URI.
Can you show the code that you use for step 1 in mentined docs, e.g. to construct URI such as this?

https://oauth.vk.com/authorize?client_id=1&display=page&redirect_uri=http://example.com/callback&scope=friends&response_type=token&v=5.59

@Fahreeve
Copy link
Author

@fafhrd91
Copy link
Member

fafhrd91 commented Feb 2, 2017

fixed in master

@fafhrd91 fafhrd91 closed this as completed Feb 2, 2017
@vladarts
Copy link

vladarts commented Feb 9, 2017

Hello!

I have same problem with VK api. version 1.3.0 - I dont see fragment in result. Checked hack from @Fahreeve - it works.

@fafhrd91 fafhrd91 reopened this Feb 9, 2017
@fafhrd91
Copy link
Member

fafhrd91 commented Feb 9, 2017

@asvetlov we need to fix this sh..

@fafhrd91 fafhrd91 added this to the 1.4 milestone Feb 9, 2017
@fafhrd91 fafhrd91 modified the milestones: 2.1, 2.0 Mar 15, 2017
@fafhrd91
Copy link
Member

is this still a problem? do we have any idea what needs to be fixed?

@asvetlov
Copy link
Member

asvetlov commented Feb 9, 2018

Close as outdated

@asvetlov asvetlov closed this as completed Feb 9, 2018
@webknjaz
Copy link
Member

webknjaz commented Feb 9, 2018

@asvetlov you should really consider enabling stale bot integration: https://github.com/apps/stale

@asvetlov
Copy link
Member

asvetlov commented Feb 9, 2018

We can manage our all 100 open issues without bots.
There are many very old ones which should stay in tracker as an appointment at least, I don't want to be very aggressive on issues rejecting

@webknjaz
Copy link
Member

webknjaz commented Feb 9, 2018

@asvetlov that bot supports ignoring issues marked with certain labels :) It's pretty configurable

@asvetlov
Copy link
Member

asvetlov commented Feb 9, 2018

You can try to setup it and let's look how things are going.

@lock
Copy link

lock bot commented Oct 28, 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].
[new issue]: https://github.com/aio-libs/aiohttp/issues/new

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

No branches or pull requests

6 participants