Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tests/unit/test_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,14 @@ def test_preset_is_sent_by_name(self, fake_lib):
assert fake_lib.sent["withRandomTLSExtensionOrder"] is True
assert "customTlsClient" not in fake_lib.sent

def test_random_extension_order_is_sent_with_a_custom_profile(self, fake_lib):
ja3 = "771,4865-4866-4867,0-23-65281-10-11-35-16-5-13-18-51-45-43-27,29-23-24,0"
with Session(client_identifier=None, ja3_string=ja3, random_tls_extension_order=True) as session:
session.get(URL)

assert "tlsClientIdentifier" not in fake_lib.sent
assert fake_lib.sent["withRandomTLSExtensionOrder"] is True

def test_custom_settings_are_sent_under_the_keys_the_library_expects(self, fake_lib):
ja3 = "771,4865-4866-4867,0-23-65281-10-11-35-16-5-13-18-51-45-43-27,29-23-24,0"
priority_frames = [{"streamID": 3, "priorityParam": {"weight": 201, "streamDep": 0, "exclusive": False}}]
Expand Down
2 changes: 1 addition & 1 deletion tls_client/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ def execute_request(
}
if certificate_pinning:
request_payload["certificatePinningHosts"] = certificate_pinning
request_payload["withRandomTLSExtensionOrder"] = self.random_tls_extension_order
if self.client_identifier is None:
request_payload["customTlsClient"] = {
"ja3String": self.ja3_string,
Expand All @@ -517,7 +518,6 @@ def execute_request(
}
else:
request_payload["tlsClientIdentifier"] = self.client_identifier
request_payload["withRandomTLSExtensionOrder"] = self.random_tls_extension_order

# Sends the request, then with allow_redirects each request a redirect asks for, like requests does.
history: list[Response] = []
Expand Down