Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
surykatka
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
surykatka
Commits
3b097c11
Commit
3b097c11
authored
Apr 19, 2023
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XXX Switch to recurls
XXX: Do moar!
parent
d900458e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
src/surykatka/http.py
src/surykatka/http.py
+8
-8
No files found.
src/surykatka/http.py
View file @
3b097c11
...
...
@@ -18,6 +18,7 @@
# See https://www.nexedi.com/licensing for rationale and options.
import
re
import
recurls
import
requests
import
sys
import
traceback
...
...
@@ -55,8 +56,8 @@ def request(
url
,
timeout
=
TIMEOUT
,
headers
=
None
,
session
=
requests
,
contact
=
None
,
ip
=
None
,
version
=
0
,
):
...
...
@@ -69,16 +70,18 @@ def request(
headers
[
"User-Agent"
]
=
getUserAgent
(
version
,
contact
)
kwargs
=
{}
kwargs
[
"stream"
]
=
False
kwargs
[
"timeout"
]
=
timeout
kwargs
[
"allow_redirects"
]
=
False
kwargs
[
"verify"
]
=
True
if
ip
is
not
None
:
kwargs
[
"ip"
]
=
ip
args
=
[
"GET"
,
url
]
kwargs
[
"headers"
]
=
headers
try
:
response
=
session
.
request
(
*
args
,
**
kwargs
)
mimikra
=
recurls
.
Recurls
()
response
=
mimikra
.
request
(
*
args
,
**
kwargs
)
except
requests
.
exceptions
.
SSLError
:
# XXX Enter into unknown host
response
=
requests
.
models
.
Response
()
...
...
@@ -206,16 +209,13 @@ def checkHttpStatus(
parsed_url
=
urlparse
(
url
)
hostname
=
parsed_url
.
hostname
request_kw
=
{
"timeout"
:
timeout
}
session
=
requests
.
Session
()
session
.
trust_env
=
False
request_kw
[
"session"
]
=
session
# SNI Support
if
parsed_url
.
scheme
==
"https"
:
# Provide SNI support
base_url
=
urlunsplit
(
(
parsed_url
.
scheme
,
parsed_url
.
netloc
,
""
,
""
,
""
)
)
session
.
mount
(
base_url
,
ForcedIPHTTPSAdapter
(
dest_ip
=
ip
))
request_kw
[
'ip'
]
=
ip
ip_url
=
url
elif
parsed_url
.
scheme
==
"http"
:
# Force IP location
...
...
@@ -296,7 +296,7 @@ def checkHttpStatus(
url
,
response
.
status_code
,
header_dict
,
response
.
elapsed
.
total_seconds
()
,
response
.
elapsed
,
elapsed_fast
,
elapsed_moderate
,
status_id
,
...
...
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