mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 18:17:52 -05:00
fix: always send Trojan header
This commit is contained in:
parent
62bef88a19
commit
72475c2924
@ -146,7 +146,14 @@ func (c *Client) Process(ctx context.Context, link *transport.Link, dialer inter
|
||||
}
|
||||
|
||||
// write some request payload to buffer
|
||||
if err = buf.CopyOnceTimeout(link.Reader, bodyWriter, proxy.FirstPayloadTimeout); err != nil && err != buf.ErrNotTimeoutReader && err != buf.ErrReadTimeout {
|
||||
err = buf.CopyOnceTimeout(link.Reader, bodyWriter, proxy.FirstPayloadTimeout)
|
||||
switch err {
|
||||
case buf.ErrNotTimeoutReader, buf.ErrReadTimeout:
|
||||
if err := connWriter.WriteHeader(); err != nil {
|
||||
return newError("failed to write request header").Base(err).AtWarning()
|
||||
}
|
||||
case nil:
|
||||
default:
|
||||
return newError("failed to write a request payload").Base(err).AtWarning()
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ type ConnWriter struct {
|
||||
// Write implements io.Writer
|
||||
func (c *ConnWriter) Write(p []byte) (n int, err error) {
|
||||
if !c.headerSent {
|
||||
if err := c.writeHeader(); err != nil {
|
||||
if err := c.WriteHeader(); err != nil {
|
||||
return 0, newError("failed to write request header").Base(err)
|
||||
}
|
||||
}
|
||||
@ -60,7 +60,7 @@ func (c *ConnWriter) WriteMultiBuffer(mb buf.MultiBuffer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *ConnWriter) writeHeader() error {
|
||||
func (c *ConnWriter) WriteHeader() error {
|
||||
buffer := buf.StackNew()
|
||||
defer buffer.Release()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user