forked from pypa/twine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not follow redirects when uploading
PyPI will never redirect a user during an upload. If a redirect is found, either the index URL is incorrect or there could be a malicious redirect at play. requests has well defined behaviour around handling POSTing data and what happens during a redirect. We shouldn't have to think too hard about that and there's probably a problem the user needs to handle if there is a redirect. Requests added 'is_redirect()' to Response objects in 2.3.0. In order to rely on that, we need to bump our minimum version. Closes pypa#92
- Loading branch information
1 parent
8f5a85e
commit 29e8575
Showing
3 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
|
||
install_requires = [ | ||
"pkginfo", | ||
"requests >= 2.0", | ||
"requests >= 2.3.0", | ||
"setuptools >= 0.7.0", | ||
] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright 2015 Ian Cordasco | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
class RedirectDetected(Exception): | ||
"""A redirect was detected that the user needs to resolve. | ||
In some cases, requests refuses to issue a new POST request after a | ||
redirect. In order to prevent a confusing user experience, we raise this | ||
exception to allow users to know the index they're uploading to is | ||
redirecting them. | ||
""" | ||
pass |