Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
39029e35
Commit
39029e35
authored
Dec 30, 1994
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add hacks for switching protocol and path but leaving host unchanged
parent
3631bb4a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
Lib/urllib.py
Lib/urllib.py
+2
-2
Lib/urlparse.py
Lib/urlparse.py
+12
-0
No files found.
Lib/urllib.py
View file @
39029e35
...
...
@@ -350,13 +350,13 @@ class addinfo(addbase):
def
basejoin
(
base
,
url
):
type
,
path
=
splittype
(
url
)
if
type
:
return
url
host
,
path
=
splithost
(
path
)
if
type
and
host
:
return
url
basetype
,
basepath
=
splittype
(
base
)
basehost
,
basepath
=
splithost
(
basepath
)
basepath
,
basetag
=
splittag
(
basepath
)
basepath
,
basequery
=
splitquery
(
basepath
)
type
=
basetype
or
'file'
if
not
type
:
type
=
basetype
or
'file'
if
path
[:
1
]
!=
'/'
:
i
=
string
.
rfind
(
basepath
,
'/'
)
if
i
<
0
:
basepath
=
'/'
...
...
Lib/urlparse.py
View file @
39029e35
...
...
@@ -88,6 +88,18 @@ def urljoin(base, url, allow_framents = 1):
urlparse
(
base
,
''
,
allow_framents
)
scheme
,
netloc
,
path
,
params
,
query
,
fragment
=
\
urlparse
(
url
,
bscheme
,
allow_framents
)
# XXX Unofficial hack: default netloc to bnetloc even if
# schemes differ
if
scheme
!=
bscheme
and
not
netloc
and
\
scheme
in
uses_relative
and
bscheme
in
uses_relative
and
\
scheme
in
uses_netloc
and
bscheme
in
uses_netloc
:
netloc
=
bnetloc
# Strip the port number
i
=
string
.
find
(
netloc
,
'@'
)
if
i
<
0
:
i
=
0
i
=
string
.
find
(
netloc
,
':'
,
i
)
if
i
>=
0
:
netloc
=
netloc
[:
i
]
if
scheme
!=
bscheme
or
scheme
not
in
uses_relative
:
return
urlunparse
((
scheme
,
netloc
,
path
,
params
,
query
,
fragment
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment