-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
ft:Support HTTPS proxies and SOCKS proxies #2025
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
base: master
Are you sure you want to change the base?
Conversation
|
Thanks for opening this pull request and contributing to the project! The next step is for the maintainers to review your changes. If everything looks good, it will be approved and merged into the main branch. In the meantime, anyone in the community is encouraged to test this pull request and provide feedback. ✅ How to confirm it worksIf you’ve tested this PR, please comment below with: This helps us speed up the review and merge process. 📦 To test this PR locally:If you encounter any issues or have feedback, feel free to comment as well. |
…proxies - Add proxy support for HTTP/HTTPS and SOCKS4/SOCKS5 - Update types for proxy configuration - Add proxy handling in multiple utility files - Update dependencies for proxy support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
sahilashraff
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const getHttpStream = async (url, options = {}) => {
const response = await fetch(url.toString(), {
agent: options.dispatcher,
method: 'GET',
headers: options.headers,
});
if (!response.ok) {
throw new Boom(Failed to fetch stream from ${url}, {
statusCode: response.status,
data: { url },
});
}
const body = response.body;
// ✅ If it's already a Node stream (Gunzip, fs.ReadStream, etc.), return as-is
if (body && typeof body.pipe === 'function') {
return body;
}
// ✅ Otherwise (older Node versions) convert Web ReadableStream to Node Readable
if (typeof Readable.fromWeb === 'function' && body instanceof ReadableStream) {
return Readable.fromWeb(body);
}
// ✅ Fallback: just return whatever it is
return body;
};
the response is already Gunzip, don’t try to re-unzip or re-convert it.
|
This breaks web compatibility. @jlucaso1 any thoughts |
|
There are libraries available for SOCKS proxy support with undici (the Node.js built-in Here's one you can use: |
|
This PR is stale because it has been open for 14 days with no activity. Remove the stale label or comment or this will be closed in 14 days |
|
is it a duplicate of #1877 ? |
|
This PR is stale because it has been open for 14 days with no activity. Remove the stale label or comment or this will be closed in 14 days |
After the framework recently replaced the request library from axios with fetch, it was found that the native fetch only supports HTTPS proxies and cannot be compatible with existing SOCKS proxy scenarios. To address this issue, the current
adjustment plan is as follows: