bogdanfinn / tls-client

net/http.Client like HTTP Client with options to select specific client TLS Fingerprints to use for requests.
BSD 4-Clause "Original" or "Old" License
667 stars 133 forks source link

Error when running example code: tls: error decoding message[Bug]: #111

Closed phoenix6111 closed 2 months ago

phoenix6111 commented 2 months ago

TLS client version

v1.3

System information

Win10 system version

Issue description

Hello, I was trying to run the example code provided in the repository for the tls-client at index_custom_client.js (link: index_custom_client.js). However, I encountered an error when attempting to make a request to "https://microsoft.com". The error message is: "failed to do request: Get "https://microsoft.com": remote error: tls: error decoding message"

Could you please help me understand what might be causing this issue and how to resolve it? Any guidance or updates to the code that might help resolve this error would be greatly appreciated. Thank you for your assistance.

Steps to reproduce / Code Sample

failed to do request: Get "https://microsoft.com": remote error: tls: error decoding message. like this: 微信图片_20240426162633

bogdanfinn commented 2 months ago

@phoenix6111 i forgot to update the examples. in the last couple updates we introduced some more flexibility for the custom client options ... that means on the other hand some values need to be explicit defined.

So for chrome custom client (and for the provided examples to work) you need to define in addition the following custom client values:

"alpnProtocols": ["h2", "http/1.1"],
"alpsProtocols": ["h2"],

next to for example supportedVersions

I will update the examples in the next commit.

phoenix6111 commented 2 months ago

I got it, thank you very much for your help!