-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
XHTTP client: Move x_padding
into Referer
header
#4298
Conversation
I think this change is acceptable (if others don't think the refer header is too odd) |
我觉得不用加选项,这项改变应当逐步变成默认的,甚至可以要求服务端及时升级,v25 直接 breaking 也很合理 由于旧服务端会要求 path padding,正好新客户端连不上旧服务端,#4253 修 #4113 (comment) 都方便了 |
就是说最近在给 stream-up 加这个 014f5e6 ,从而引入了 x_version,这里 breaking 的话就不需要它了,有点想把它删掉 还有我想要求 xPaddingBytes 不得设为负数,不确定是这个 PR 一起改了还是 |
你先这样改一下:
|
89616a1
to
1f5b32a
Compare
1f5b32a
to
d4d87e7
Compare
"Referer" is a misspelling of "referrer". This thing is usually referred as "referrer" in code (e.g. in |
paddingInHeader
Referer
header
😊
сб, 18 янв. 2025 г., 11:07 AM rPDmYQ ***@***.***>:
… 变量名用 referer
"Referer" is a misspelling
<https://en.wikipedia.org/wiki/HTTP_referer#Etymology> of "referrer".
This thing is usually referred as "referrer" in code (e.g. in fetch's
parameter), and "referer" is only used when in HTTP header.
—
Reply to this email directly, view it on GitHub
<#4298 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/BORZMM3SAGHIRFOFIF7NSFD2LIDTDAVCNFSM6AAAAABVKCAEYKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOJZGYYDEOJTGY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
// 'X' is assigned an 8 bit code, so HPACK compression won't change actual padding length on the wire. | ||
// https://www.rfc-editor.org/rfc/rfc9204.html#section-4.1.2-2 | ||
// h3's similar QPACK feature uses the same huffman table. | ||
header.Set("Referer", referrerHeaderPaddingPrefix+strings.Repeat("X", int(paddingLen))) |
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.
Great
感谢 @rPDmYQ 的贡献,我觉得把 x_padding 放
我打算先合并这个 PR,并发起另一个 PR 完成剩下的修改 |
Referer
headerx_padding
into Referer
header
对了,你有空的话可以研究下给 browser dialer 加 stream-up,此前我的研究:#4148 (comment) 到时服务端可能得通过 Referer host 来判断要不要及时响应 stream-up 并发保活包,因为 Chrome 还不支持 bidirectional streaming |
记录一下针对这个 PR 我想改的地方: |
Move the padding into
Referer
header, to not bloat the reverse proxy access log.From browser, the path part of
Referer
header can be controlled withfetch
:The actual sent
Referer
header value would behttp://<xray.browser.dialer>/?x_padding=000
, and it won't trigger CORS preflight, even if the URL is long (no 128 length limit of "safelisted headers").Therefore it's fully compatible with browser as dialer without overhead. The only downside would be some browsers may strip the path under privacy-protection mode (I see Firefox doing that, but it can be disabled by user for specific sites).