Skip to content

XHTTP client: Avoid panic when host is invalid#6316

Merged
RPRX merged 1 commit into
XTLS:mainfrom
bytecategory:main
Jun 18, 2026
Merged

XHTTP client: Avoid panic when host is invalid#6316
RPRX merged 1 commit into
XTLS:mainfrom
bytecategory:main

Conversation

@bytecategory

Copy link
Copy Markdown
Contributor

光速解决了 #6315
新增了sanitizeHost 用于把它们规范化成host:port的格式 不过不太健壮 如果还有其它奇怪的输入欢迎提出

@bytecategory

Copy link
Copy Markdown
Contributor Author

return host多了个空格 现在删掉了

@Fangliding

Copy link
Copy Markdown
Member

sanitizeHost 没必要(强行修正非法输入我们一般不这样做)
只正确处理err返回就行了

@bytecategory

bytecategory commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

sanitizeHost 没必要(强行修正非法输入我们一般不这样做) 只正确处理err返回就行了

也就是用户的配置错了直接报错?(不panic) 过几分钟我弄一下

@bytecategory bytecategory left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

正确处理http.NewRequestWithContext的error返回就不panic了 @和/?都没有 在风扇提醒下找到的更简洁的方案

@bytecategory

Copy link
Copy Markdown
Contributor Author

#6315 (comment)
根据用户反馈 问题已经解决

@RPRX

RPRX commented Jun 16, 2026

Copy link
Copy Markdown
Member

服务端写非法形式的 host 会咋样

@RPRX

RPRX commented Jun 17, 2026

Copy link
Copy Markdown
Member

@bytecategory @Fangliding

@Fangliding

Copy link
Copy Markdown
Member

服务端我没记错的话只是拿着这个string比较一下 撑死也就没办法连上 属于常规配置错误问题 这个改动只是为了避免panic

@bytecategory

Copy link
Copy Markdown
Contributor Author

服务端写非法形式的 host 会咋样

看来是没有问题的. Unix socket就可以有多个@而不崩溃 此前已经有测试了.

@RPRX RPRX changed the title Fixed a crash that occurred after entering @ and /. XHTTP client: Avoid panic when host is invalid Jun 18, 2026
@RPRX RPRX merged commit 986c512 into XTLS:main Jun 18, 2026
40 checks passed
Maolaohei added a commit to Maolaohei/Bray-Core that referenced this pull request Jun 19, 2026
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

Successfully merging this pull request may close these issues.

3 participants