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
4ea3eade
Kaydet (Commit)
4ea3eade
authored
Mar 03, 2005
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Patch #1117339: Add cookielib special name tests.
Backported to 2.4.
üst
9b62b390
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
5 deletions
+30
-5
cookielib.py
Lib/cookielib.py
+2
-2
test_cookielib.py
Lib/test/test_cookielib.py
+26
-3
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/cookielib.py
Dosyayı görüntüle @
4ea3eade
...
...
@@ -447,7 +447,7 @@ def parse_ns_headers(ns_headers):
for
ns_header
in
ns_headers
:
pairs
=
[]
version_set
=
False
for
param
in
re
.
split
(
r";\s*"
,
ns_header
):
for
ii
,
param
in
enumerate
(
re
.
split
(
r";\s*"
,
ns_header
)
):
param
=
param
.
rstrip
()
if
param
==
""
:
continue
if
"="
not
in
param
:
...
...
@@ -459,7 +459,7 @@ def parse_ns_headers(ns_headers):
else
:
k
,
v
=
re
.
split
(
r"\s*=\s*"
,
param
,
1
)
k
=
k
.
lstrip
()
if
k
is
not
None
:
if
ii
!=
0
:
lc
=
k
.
lower
()
if
lc
in
known_attrs
:
k
=
lc
...
...
Lib/test/test_cookielib.py
Dosyayı görüntüle @
4ea3eade
...
...
@@ -103,13 +103,23 @@ class HeaderTests(TestCase):
from
cookielib
import
parse_ns_headers
# quotes should be stripped
expected
=
[[(
'expires'
,
2209069412L
),
(
'version'
,
'0'
)]]
expected
=
[[(
'
foo'
,
'bar'
),
(
'
expires'
,
2209069412L
),
(
'version'
,
'0'
)]]
for
hdr
in
[
'expires=01 Jan 2040 22:23:32 GMT'
,
'expires="01 Jan 2040 22:23:32 GMT"'
,
'
foo=bar;
expires=01 Jan 2040 22:23:32 GMT'
,
'
foo=bar;
expires="01 Jan 2040 22:23:32 GMT"'
,
]:
self
.
assertEquals
(
parse_ns_headers
([
hdr
]),
expected
)
def
test_parse_ns_headers_special_names
(
self
):
# names such as 'expires' are not special in first name=value pair
# of Set-Cookie: header
from
cookielib
import
parse_ns_headers
# Cookie with name 'expires'
hdr
=
'expires=01 Jan 2040 22:23:32 GMT'
expected
=
[[(
"expires"
,
"01 Jan 2040 22:23:32 GMT"
),
(
"version"
,
"0"
)]]
self
.
assertEquals
(
parse_ns_headers
([
hdr
]),
expected
)
def
test_join_header_words
(
self
):
from
cookielib
import
join_header_words
...
...
@@ -370,6 +380,19 @@ class CookieTests(TestCase):
self
.
assert_
(
foo
.
expires
is
None
)
self
.
assert_
(
spam
.
expires
is
None
)
def
test_ns_parser_special_names
(
self
):
# names such as 'expires' are not special in first name=value pair
# of Set-Cookie: header
from
cookielib
import
CookieJar
c
=
CookieJar
()
interact_netscape
(
c
,
"http://www.acme.com/"
,
'expires=eggs'
)
interact_netscape
(
c
,
"http://www.acme.com/"
,
'version=eggs; spam=eggs'
)
cookies
=
c
.
_cookies
[
"www.acme.com"
][
"/"
]
self
.
assert_
(
'expires'
in
cookies
)
self
.
assert_
(
'version'
in
cookies
)
def
test_expires
(
self
):
from
cookielib
import
time2netscape
,
CookieJar
...
...
Misc/NEWS
Dosyayı görüntüle @
4ea3eade
...
...
@@ -61,6 +61,8 @@ Extension Modules
Library
-------
- Patch #1117339: Add cookielib special name tests.
- Patch #1112812: Make bsddb/__init__.py more friendly for modulefinder.
- Patch #1110248: SYNC_FLUSH the zlib buffer for GZipFile.flush.
...
...
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