@@ -22,16 +22,19 @@ def __init__(
22
22
h2_settings : Optional [dict ] = None , # Optional[dict[str, int]]
23
23
h2_settings_order : Optional [list ] = None , # Optional[list[str]]
24
24
supported_signature_algorithms : Optional [list ] = None , # Optional[list[str]]
25
+ supported_delegated_credentials_algorithms : Optional [list ] = None , # Optional[list[str]]
25
26
supported_versions : Optional [list ] = None , # Optional[list[str]]
26
27
key_share_curves : Optional [list ] = None , # Optional[list[str]]
27
28
cert_compression_algo : str = None ,
29
+ additionalDecode : str = None ,
28
30
pseudo_header_order : Optional [list ] = None , # Optional[list[str]
29
31
connection_flow : Optional [int ] = None ,
30
32
priority_frames : Optional [list ] = None ,
31
33
header_order : Optional [list ] = None , # Optional[list[str]]
32
34
header_priority : Optional [dict ] = None , # Optional[list[str]]
33
35
random_tls_extension_order : Optional = False ,
34
36
force_http1 : Optional = False ,
37
+ catch_panics : Optional = False ,
35
38
) -> None :
36
39
self ._session_id = str (uuid .uuid4 ())
37
40
# --- Standard Settings ----------------------------------------------------------------------------------------
@@ -131,6 +134,33 @@ def __init__(
131
134
# ]
132
135
self .supported_signature_algorithms = supported_signature_algorithms
133
136
137
+ # Supported Delegated Credentials Algorithms
138
+ # Possible Settings:
139
+ # PKCS1WithSHA256
140
+ # PKCS1WithSHA384
141
+ # PKCS1WithSHA512
142
+ # PSSWithSHA256
143
+ # PSSWithSHA384
144
+ # PSSWithSHA512
145
+ # ECDSAWithP256AndSHA256
146
+ # ECDSAWithP384AndSHA384
147
+ # ECDSAWithP521AndSHA512
148
+ # PKCS1WithSHA1
149
+ # ECDSAWithSHA1
150
+ #
151
+ # Example:
152
+ # [
153
+ # "ECDSAWithP256AndSHA256",
154
+ # "PSSWithSHA256",
155
+ # "PKCS1WithSHA256",
156
+ # "ECDSAWithP384AndSHA384",
157
+ # "PSSWithSHA384",
158
+ # "PKCS1WithSHA384",
159
+ # "PSSWithSHA512",
160
+ # "PKCS1WithSHA512",
161
+ # ]
162
+ self .supported_delegated_credentials_algorithms = supported_delegated_credentials_algorithms
163
+
134
164
# Supported Versions
135
165
# Possible Settings:
136
166
# GREASE
@@ -166,6 +196,11 @@ def __init__(
166
196
# Examples: "zlib", "brotli", "zstd"
167
197
self .cert_compression_algo = cert_compression_algo
168
198
199
+ # Additional Decode
200
+ # Make sure the go code decodes the response body once explicit by provided algorithm.
201
+ # Examples: null, "gzip", "br", "deflate"
202
+ self .additionalDecode = additionalDecode
203
+
169
204
# Pseudo Header Order (:authority, :method, :path, :scheme)
170
205
# Example:
171
206
# [
@@ -225,6 +260,10 @@ def __init__(
225
260
# force HTTP1
226
261
self .force_http1 = force_http1
227
262
263
+ # catch panics
264
+ # avoid the tls client to print the whole stacktrace when a panic (critical go error) happens
265
+ self .catch_panics = catch_panics
266
+
228
267
def execute_request (
229
268
self ,
230
269
method : str ,
@@ -277,14 +316,11 @@ def execute_request(
277
316
cookies = cookies or {}
278
317
# Merge with session cookies
279
318
cookies = merge_cookies (self .cookies , cookies )
280
-
281
- cookie_header = get_cookie_header (
282
- request_url = url ,
283
- request_headers = headers ,
284
- cookie_jar = cookies
285
- )
286
- if cookie_header is not None :
287
- headers ["Cookie" ] = cookie_header
319
+ # turn cookie jar into dict
320
+ request_cookies = [
321
+ {'domain' : c .domain , 'expires' : c .expires , 'name' : c .name , 'path' : c .path , 'value' : c .value }
322
+ for c in cookies
323
+ ]
288
324
289
325
# --- Proxy ----------------------------------------------------------------------------------------------------
290
326
proxy = proxy or self .proxies
@@ -302,15 +338,17 @@ def execute_request(
302
338
"sessionId" : self ._session_id ,
303
339
"followRedirects" : allow_redirects ,
304
340
"forceHttp1" : self .force_http1 ,
341
+ "catchPanics" : self .catch_panics ,
305
342
"headers" : dict (headers ),
306
343
"headerOrder" : self .header_order ,
307
344
"insecureSkipVerify" : insecure_skip_verify ,
308
345
"isByteRequest" : is_byte_request ,
346
+ "additionalDecode" : self .additionalDecode ,
309
347
"proxyUrl" : proxy ,
310
348
"requestUrl" : url ,
311
349
"requestMethod" : method ,
312
350
"requestBody" : base64 .b64encode (request_body ).decode () if is_byte_request else request_body ,
313
- "requestCookies" : [], # Empty because it's handled in python
351
+ "requestCookies" : request_cookies ,
314
352
"timeoutSeconds" : timeout_seconds ,
315
353
}
316
354
if self .client_identifier is None :
@@ -325,6 +363,7 @@ def execute_request(
325
363
"certCompressionAlgo" : self .cert_compression_algo ,
326
364
"supportedVersions" : self .supported_versions ,
327
365
"supportedSignatureAlgorithms" : self .supported_signature_algorithms ,
366
+ "supportedDelegatedCredentialsAlgorithms" : self .supported_delegated_credentials_algorithms ,
328
367
"keyShareCurves" : self .key_share_curves ,
329
368
}
330
369
else :
0 commit comments