Fix: vmess http broken
This commit is contained in:
parent
5da1b2a8aa
commit
784c28266c
1 changed files with 6 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
||||||
package vmess
|
package vmess
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
@ -12,7 +13,7 @@ import (
|
||||||
type httpConn struct {
|
type httpConn struct {
|
||||||
net.Conn
|
net.Conn
|
||||||
cfg *HTTPConfig
|
cfg *HTTPConfig
|
||||||
rhandshake bool
|
reader *bufio.Reader
|
||||||
whandshake bool
|
whandshake bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,8 +26,8 @@ type HTTPConfig struct {
|
||||||
|
|
||||||
// Read implements net.Conn.Read()
|
// Read implements net.Conn.Read()
|
||||||
func (hc *httpConn) Read(b []byte) (int, error) {
|
func (hc *httpConn) Read(b []byte) (int, error) {
|
||||||
if hc.rhandshake {
|
if hc.reader != nil {
|
||||||
n, err := hc.Conn.Read(b)
|
n, err := hc.reader.Read(b)
|
||||||
return n, err
|
return n, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,8 +41,8 @@ func (hc *httpConn) Read(b []byte) (int, error) {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
hc.rhandshake = true
|
hc.reader = reader.R
|
||||||
return hc.Conn.Read(b)
|
return reader.R.Read(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write implements io.Writer.
|
// Write implements io.Writer.
|
||||||
|
|
Loading…
Reference in a new issue