Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
recurls
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Łukasz Nowak
recurls
Commits
bc07ab25
Commit
bc07ab25
authored
Sep 24, 2024
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
recurls: Switch response headers to HTTPMessage
CaseInsensitiveDict resulted with risky situations.
parent
c41d4ef1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
6 deletions
+2
-6
src/recurls/recurls.py
src/recurls/recurls.py
+2
-6
No files found.
src/recurls/recurls.py
View file @
bc07ab25
...
@@ -2,7 +2,6 @@ import json
...
@@ -2,7 +2,6 @@ import json
import
urllib.parse
import
urllib.parse
import
tempfile
import
tempfile
import
subprocess
import
subprocess
from
requests.structures
import
CaseInsensitiveDict
import
gzip
import
gzip
import
os
import
os
import
http.client
import
http.client
...
@@ -136,17 +135,14 @@ class Recurls(object):
...
@@ -136,17 +135,14 @@ class Recurls(object):
raise
raise
with
open
(
response_header_file
)
as
fh
:
with
open
(
response_header_file
)
as
fh
:
response
.
header_text
=
fh
.
read
()
response
.
header_text
=
fh
.
read
()
response
.
headers
=
CaseInsensitiveDict
()
response
.
headers
=
http
.
client
.
HTTPMessage
()
for
line
in
response
.
header_text
.
splitlines
()[
1
:]:
for
line
in
response
.
header_text
.
splitlines
()[
1
:]:
if
line
.
strip
():
if
line
.
strip
():
if
':'
not
in
line
:
if
':'
not
in
line
:
continue
continue
header
,
value
=
line
.
split
(
':'
,
1
)
header
,
value
=
line
.
split
(
':'
,
1
)
value
=
value
.
strip
()
value
=
value
.
strip
()
response
.
headers
.
setdefault
(
header
,
[])
response
.
headers
.
add_header
(
header
,
value
)
response
.
headers
[
header
].
append
(
value
)
for
header
in
response
.
headers
.
keys
():
response
.
headers
[
header
]
=
', '
.
join
(
response
.
headers
[
header
])
if
response
.
headers
.
get
(
'content-encoding'
)
==
'gzip'
:
if
response
.
headers
.
get
(
'content-encoding'
)
==
'gzip'
:
with
gzip
.
GzipFile
(
response_file
)
as
fh
:
with
gzip
.
GzipFile
(
response_file
)
as
fh
:
response
.
text
=
fh
.
read
().
decode
()
response
.
text
=
fh
.
read
().
decode
()
...
...
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