Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's up with _unixOptions? #75

Closed
pimterry opened this issue Aug 3, 2022 · 2 comments
Closed

What's up with _unixOptions? #75

pimterry opened this issue Aug 3, 2022 · 2 comments

Comments

@pimterry
Copy link

pimterry commented Aug 3, 2022

I'm looking at ways to improve my request fingerprints to avoid blocks, and I ran into this project. Lots of interesting tricks here! Excellent work.

One that I found interesting was setting _unixOptions with additional TLS settings:

options._unixOptions = {
// @ts-expect-error Private use
...options._unixOptions,
secureOptions: secureOptions[browser],
requestOCSP: requestOCSP[browser],
};
. I can't find any info about this anywhere, even in Node's source, and it's not mentioned in your docs. Can you explain at all what this does?

@szmarczak
Copy link
Contributor

It's a Got internal option. Got parses UNIX socket path into options._unixOptions which is just a plain object that is later merged with other options. It's used to enable insecure HTTP parser. For example Insomnia was sending broken (non-spec) headers to check whether the parser is lenient or not. Node.js' by default is not, but browser allow broken headers. I don't think they do that anymore.

https://github.com/sindresorhus/got/blob/e032b60ff3285403b8f9627dcdd32aae39867d7a/source/core/options.ts#L1442
https://github.com/sindresorhus/got/blob/e032b60ff3285403b8f9627dcdd32aae39867d7a/source/core/options.ts#L2428

@pimterry
Copy link
Author

pimterry commented Aug 3, 2022

Super helpful, thanks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants