|
@@ -8,7 +8,6 @@ import (
|
|
|
"net/http"
|
|
"net/http"
|
|
|
"net/url"
|
|
"net/url"
|
|
|
"sync"
|
|
"sync"
|
|
|
- "time"
|
|
|
|
|
|
|
|
|
|
"golang.org/x/net/http2"
|
|
"golang.org/x/net/http2"
|
|
|
|
|
|
|
@@ -23,6 +22,7 @@ import (
|
|
|
"github.com/v2fly/v2ray-core/v5/common/signal"
|
|
"github.com/v2fly/v2ray-core/v5/common/signal"
|
|
|
"github.com/v2fly/v2ray-core/v5/common/task"
|
|
"github.com/v2fly/v2ray-core/v5/common/task"
|
|
|
"github.com/v2fly/v2ray-core/v5/features/policy"
|
|
"github.com/v2fly/v2ray-core/v5/features/policy"
|
|
|
|
|
+ "github.com/v2fly/v2ray-core/v5/proxy"
|
|
|
"github.com/v2fly/v2ray-core/v5/transport"
|
|
"github.com/v2fly/v2ray-core/v5/transport"
|
|
|
"github.com/v2fly/v2ray-core/v5/transport/internet"
|
|
"github.com/v2fly/v2ray-core/v5/transport/internet"
|
|
|
"github.com/v2fly/v2ray-core/v5/transport/internet/tls"
|
|
"github.com/v2fly/v2ray-core/v5/transport/internet/tls"
|
|
@@ -83,11 +83,11 @@ func (c *Client) Process(ctx context.Context, link *transport.Link, dialer inter
|
|
|
var firstPayload []byte
|
|
var firstPayload []byte
|
|
|
|
|
|
|
|
if reader, ok := link.Reader.(buf.TimeoutReader); ok {
|
|
if reader, ok := link.Reader.(buf.TimeoutReader); ok {
|
|
|
- // 0-RTT optimization for HTTP/2: If the payload comes within 50 ms, it can be
|
|
|
|
|
|
|
+ // 0-RTT optimization for HTTP/2: If the payload comes very soon, it can be
|
|
|
// transmitted together. Note we should not get stuck here, as the payload may
|
|
// transmitted together. Note we should not get stuck here, as the payload may
|
|
|
// not exist (considering to access MySQL database via a HTTP proxy, where the
|
|
// not exist (considering to access MySQL database via a HTTP proxy, where the
|
|
|
// server sends hello to the client first).
|
|
// server sends hello to the client first).
|
|
|
- if mbuf, _ := reader.ReadMultiBufferTimeout(50 * time.Millisecond); mbuf != nil {
|
|
|
|
|
|
|
+ if mbuf, _ := reader.ReadMultiBufferTimeout(proxy.FirstPayloadTimeout); mbuf != nil {
|
|
|
mlen := mbuf.Len()
|
|
mlen := mbuf.Len()
|
|
|
firstPayload = bytespool.Alloc(mlen)
|
|
firstPayload = bytespool.Alloc(mlen)
|
|
|
mbuf, _ = buf.SplitBytes(mbuf, firstPayload)
|
|
mbuf, _ = buf.SplitBytes(mbuf, firstPayload)
|