lwthiker / curl-impersonate

curl-impersonate: A special build of curl that can impersonate Chrome & Firefox
MIT License
3.45k stars 229 forks source link

How to increment stream_id and change weight for Chrome persistent connections #183

Open A-Posthuman opened 9 months ago

A-Posthuman commented 9 months ago

When using this library with node-libcurl, I'd like my Chrome impersonation sessions to act as closely to the real Chrome as possible, particularly when making multiple requests using the same curl instance. The real Chrome seems to increment the stream_id in a multiplexed session as odd numbers, and the weight seems to often be 220 or 147 when requesting the sub-parts of a webpage.

My understanding (which might be wrong) of node-libcurl is that when using its asnyc "curly" object to make requests with, it is maintaining a cache of persistent connections. However when I try to test this by using a test program with single curly instance to make repeated requests to https://tls.peet.ws/api/all I don't see the stream_id incrementing.

It doesn't appear node-libcurl currently supports modifying these http2 parameters, when I try to pass it a "STREAM_WEIGHT" parameter it says it's unsupported. Anyway, wondering what might be the best approach to impersonating this aspect of Chrome, or if this project might add some features to assist with it.