Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
2a91ce89
Kaydet (Commit)
2a91ce89
authored
Tem 25, 2010
tarafından
Gregory P. Smith
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixes issue #3704: cookielib was not properly handling URLs with a / in the
parameters.
üst
137e0b12
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
18 deletions
+30
-18
cookielib.py
Lib/cookielib.py
+6
-11
test_cookielib.py
Lib/test/test_cookielib.py
+21
-7
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/cookielib.py
Dosyayı görüntüle @
2a91ce89
...
...
@@ -607,19 +607,14 @@ def eff_request_host(request):
return
req_host
,
erhn
def
request_path
(
request
):
"""request-URI, as defined by RFC 2965."""
"""
Path component of
request-URI, as defined by RFC 2965."""
url
=
request
.
get_full_url
()
#scheme, netloc, path, parameters, query, frag = urlparse.urlparse(url)
#req_path = escape_path("".join(urlparse.urlparse(url)[2:]))
path
,
parameters
,
query
,
frag
=
urlparse
.
urlparse
(
url
)[
2
:]
if
parameters
:
path
=
"
%
s;
%
s"
%
(
path
,
parameters
)
path
=
escape_path
(
path
)
req_path
=
urlparse
.
urlunparse
((
""
,
""
,
path
,
""
,
query
,
frag
))
if
not
req_path
.
startswith
(
"/"
):
parts
=
urlparse
.
urlsplit
(
url
)
path
=
escape_path
(
parts
.
path
)
if
not
path
.
startswith
(
"/"
):
# fix bad RFC 2396 absoluteURI
req_path
=
"/"
+
req_
path
return
req_
path
path
=
"/"
+
path
return
path
def
request_port
(
request
):
host
=
request
.
get_host
()
...
...
Lib/test/test_cookielib.py
Dosyayı görüntüle @
2a91ce89
# -*- coding: latin-1 -*-
"""Tests for cookielib.py."""
import
re
,
os
,
time
import
cookielib
import
os
import
re
import
time
from
unittest
import
TestCase
from
test
import
test_support
class
DateTimeTests
(
TestCase
):
def
test_time2isoz
(
self
):
...
...
@@ -563,6 +568,16 @@ class CookieTests(TestCase):
interact_netscape
(
c
,
"http://www.acme.com/blah/rhubarb/"
,
'eggs="bar"'
)
self
.
assertIn
(
"/blah/rhubarb"
,
c
.
_cookies
[
"www.acme.com"
])
def
test_default_path_with_query
(
self
):
cj
=
cookielib
.
CookieJar
()
uri
=
"http://example.com/?spam/eggs"
value
=
'eggs="bar"'
interact_netscape
(
cj
,
uri
,
value
)
# default path does not include query, so is "/", not "/?spam"
self
.
assertIn
(
"/"
,
cj
.
_cookies
[
"example.com"
])
# cookie is sent back to the same URI
self
.
assertEquals
(
interact_netscape
(
cj
,
uri
),
value
)
def
test_escape_path
(
self
):
from
cookielib
import
escape_path
cases
=
[
...
...
@@ -591,15 +606,14 @@ class CookieTests(TestCase):
from
urllib2
import
Request
from
cookielib
import
request_path
# with parameters
req
=
Request
(
"http://www.example.com/rheum/rhaponicum;"
req
=
Request
(
"http://www.example.com/rheum/rhapon
t
icum;"
"foo=bar;sing=song?apples=pears&spam=eggs#ni"
)
self
.
assertEquals
(
request_path
(
req
),
"/rheum/rhaponicum;"
"foo=bar;sing=song?apples=pears&spam=eggs#ni
"
)
self
.
assertEquals
(
request_path
(
req
),
"/rheum/rhaponticum;foo=bar;sing=song
"
)
# without parameters
req
=
Request
(
"http://www.example.com/rheum/rhaponicum?"
req
=
Request
(
"http://www.example.com/rheum/rhapon
t
icum?"
"apples=pears&spam=eggs#ni"
)
self
.
assertEquals
(
request_path
(
req
),
"/rheum/rhaponicum?"
"apples=pears&spam=eggs#ni"
)
self
.
assertEquals
(
request_path
(
req
),
"/rheum/rhaponticum"
)
# missing final slash
req
=
Request
(
"http://www.example.com"
)
self
.
assertEquals
(
request_path
(
req
),
"/"
)
...
...
Misc/NEWS
Dosyayı görüntüle @
2a91ce89
...
...
@@ -18,6 +18,9 @@ Core and Builtins
Library
-------
- Issue #3704: cookielib was not properly handling URLs with a / in the
parameters.
- Issue #9032: XML-RPC client retries the request on EPIPE error. The EPIPE
error occurs when the server closes the socket and the client sends a big
XML-RPC request.
...
...
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