fix: resolve Bing 301 redirect and Baidu TLS handshake failure#94
Open
sublatesublate-design wants to merge 1 commit into
Open
fix: resolve Bing 301 redirect and Baidu TLS handshake failure#94sublatesublate-design wants to merge 1 commit into
sublatesublate-design wants to merge 1 commit into
Conversation
- Change BING_BASE_URL from cn.bing.com to www.bing.com to fix 301 redirect (cn.bing.com now permanently redirects to www.bing.com) - Update parser.ts relative URL base to match - Add TLS 1.2 maxVersion agent for trustedStaticHost requests, fixing Baidu CDN TLS 1.3 incompatibility on Node.js v24+ Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Owner
|
lgtm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Bing and Baidu search engines are broken:
Bing:
cn.bing.com/searchnow returns a 301 redirect towww.bing.com. SincetrustedStaticHost=trueenforcesmaxRedirects=0, the redirect is thrown as an error instead of being followed.Baidu: Node.js v24 defaults to TLS 1.3, but Baidu's CDN does not support TLS 1.3 (returns a TLS alert). The TLS handshake hangs or fails with
ECONNRESET. TLS 1.2 works fine.Changes
Bing fix (
src/engines/bing/bing.ts,src/engines/bing/parser.ts)BING_BASE_URLfromhttps://cn.bing.com/searchtohttps://www.bing.com/searchcn.bing.cominparser.tsfor relative URL reconstruction to matchwww.bing.com(BING_HOME_URL), andisBingUrl()accepts*.bing.comBaidu fix (
src/utils/httpRequest.ts)getTrustedStaticHttpsAgent()that creates anhttps.AgentwithmaxVersion: 'TLSv1.2'trustedStaticHostbranch ofbuildAxiosRequestOptions, always assign anhttpsAgent(previously only assigned whenallowInsecureTls=true)Testing
🤖 Generated with Claude Code