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
60a2f49c
Kaydet (Commit)
60a2f49c
authored
Ock 26, 2015
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge 3.4 (#19996)
üst
b335dfe7
155ceaa4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
1 deletion
+29
-1
feedparser.py
Lib/email/feedparser.py
+10
-1
test_email.py
Lib/test/test_email/test_email.py
+6
-0
test_httplib.py
Lib/test/test_httplib.py
+10
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/email/feedparser.py
Dosyayı görüntüle @
60a2f49c
...
...
@@ -33,7 +33,7 @@ NLCRE_eol = re.compile('(\r\n|\r|\n)\Z')
NLCRE_crack
=
re
.
compile
(
'(
\r\n
|
\r
|
\n
)'
)
# RFC 2822 $3.6.8 Optional fields. ftext is %d33-57 / %d59-126, Any character
# except controls, SP, and ":".
headerRE
=
re
.
compile
(
r'^(From |[\041-\071\073-\176]
{1,}
:|[\t ])'
)
headerRE
=
re
.
compile
(
r'^(From |[\041-\071\073-\176]
*
:|[\t ])'
)
EMPTYSTRING
=
''
NL
=
'
\n
'
...
...
@@ -511,6 +511,15 @@ class FeedParser:
# There will always be a colon, because if there wasn't the part of
# the parser that calls us would have started parsing the body.
i
=
line
.
find
(
':'
)
# If the colon is on the start of the line the header is clearly
# malformed, but we might be able to salvage the rest of the
# message. Track the error but keep going.
if
i
==
0
:
defect
=
errors
.
InvalidHeaderDefect
(
"Missing header name."
)
self
.
_cur
.
defects
.
append
(
defect
)
continue
assert
i
>
0
,
"_parse_headers fed line with no : and no leading WS"
lastheader
=
line
[:
i
]
lastvalue
=
[
line
]
...
...
Lib/test/test_email/test_email.py
Dosyayı görüntüle @
60a2f49c
...
...
@@ -3393,6 +3393,12 @@ class TestFeedParsers(TestEmailBase):
feedparser
.
feed
(
chunk
)
return
feedparser
.
close
()
def
test_empty_header_name_handled
(
self
):
# Issue 19996
msg
=
self
.
parse
(
"First: val
\n
: bad
\n
Second: val"
)
self
.
assertEqual
(
msg
[
'First'
],
'val'
)
self
.
assertEqual
(
msg
[
'Second'
],
'val'
)
def
test_newlines
(
self
):
m
=
self
.
parse
([
'a:
\n
b:
\r
c:
\r\n
d:
\n
'
])
self
.
assertEqual
(
m
.
keys
(),
[
'a'
,
'b'
,
'c'
,
'd'
])
...
...
Lib/test/test_httplib.py
Dosyayı görüntüle @
60a2f49c
...
...
@@ -190,6 +190,16 @@ class HeaderTests(TestCase):
conn
.
request
(
'GET'
,
'/foo'
)
self
.
assertTrue
(
sock
.
data
.
startswith
(
expected
))
def
test_malformed_headers_coped_with
(
self
):
# Issue 19996
body
=
"HTTP/1.1 200 OK
\r\n
First: val
\r\n
: nval
\r\n
Second: val
\r\n\r\n
"
sock
=
FakeSocket
(
body
)
resp
=
client
.
HTTPResponse
(
sock
)
resp
.
begin
()
self
.
assertEqual
(
resp
.
getheader
(
'First'
),
'val'
)
self
.
assertEqual
(
resp
.
getheader
(
'Second'
),
'val'
)
class
BasicTest
(
TestCase
):
def
test_status_lines
(
self
):
...
...
Misc/NEWS
Dosyayı görüntüle @
60a2f49c
...
...
@@ -215,6 +215,9 @@ Core and Builtins
Library
-------
-
Issue
#
19996
:
:
class
:`
email
.
feedparser
.
FeedParser
`
now
handles
(
malformed
)
headers
with
no
key
rather
than
amusing
the
body
has
started
.
-
Issue
#
20188
:
Support
Application
-
Layer
Protocol
Negotiation
(
ALPN
)
in
the
ssl
module
.
...
...
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