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

Conform to RFC3986 - do not include url fragments in requests #1174

Merged
merged 2 commits into from
Sep 15, 2016
Merged

Conform to RFC3986 - do not include url fragments in requests #1174

merged 2 commits into from
Sep 15, 2016

Conversation

bmuller
Copy link
Contributor

@bmuller bmuller commented Sep 15, 2016

What do these changes do?

This strips fragments from URLs before making requests. This is the behavior of all major browsers and is described in RFC3986 Section 3.5.

Are there changes in behavior for the user?

Nope.

Related issue number

None.

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • Add yourself to CONTRIBUTORS.txt
  • Add a new entry to CHANGES.rst
    • Choose any open position to avoid merge conflicts with other PRs.
    • Add a link to the issue you are fixing (if any) using #isuue_number format at the end of changelog message. Use Pull Request number if there are no issues for PR or PR covers the issue only partially.

@codecov-io
Copy link

codecov-io commented Sep 15, 2016

Current coverage is 98.40% (diff: 100%)

Merging #1174 into master will increase coverage by <.01%

@@             master      #1174   diff @@
==========================================
  Files            29         29          
  Lines          6514       6515     +1   
  Methods           0          0          
  Messages          0          0          
  Branches       1092       1092          
==========================================
+ Hits           6410       6411     +1   
  Misses           54         54          
  Partials         50         50          

Powered by Codecov. Last update da03eef...9d08b9b

@bmuller
Copy link
Contributor Author

bmuller commented Sep 15, 2016

As an example of why this is needed, right now aiohttp can't be used to download any post pages from tumblr.com because their server goes into an infinite redirect loop when a fragment is included. Here's an example script:

import aiohttp
import asyncio

async def fetch(url):
    async with aiohttp.ClientSession() as session:
        async with session.get(url) as resp:
            print(resp.history)

url = "http://best-of-tumblr.tumblr.com/post/150420362886"
asyncio.get_event_loop().run_until_complete(fetch(url))

The history that's output is just a list max_redirects long showing an infinite redirect loop. If you use my fork, then there's only one redirect and everything works fine.

Copy link
Member

@asvetlov asvetlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!
We already drop fragments on server side redirection, supporting the feature on client is very important addition.
Please add yourself to CONTRIBUTORS.txt and file a new entry to CHANGES.rst

@bmuller
Copy link
Contributor Author

bmuller commented Sep 15, 2016

Done! Let me know if you need anything else.

@asvetlov asvetlov merged commit 94d08ac into aio-libs:master Sep 15, 2016
@asvetlov
Copy link
Member

Nothing more -- your PR is very clean and obvious.
Thanks!

@bmuller
Copy link
Contributor Author

bmuller commented Sep 15, 2016

Thanks so much for the quick turnaround!

@lock
Copy link

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.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants