mirror of
https://github.com/fatedier/frp.git
synced 2025-07-27 07:35:07 +00:00
tcpmux: support authentication (#3345)
This commit is contained in:
@@ -145,7 +145,10 @@ func (r *Request) Do() (*Response, error) {
|
||||
err error
|
||||
)
|
||||
|
||||
addr := net.JoinHostPort(r.addr, strconv.Itoa(r.port))
|
||||
addr := r.addr
|
||||
if r.port > 0 {
|
||||
addr = net.JoinHostPort(r.addr, strconv.Itoa(r.port))
|
||||
}
|
||||
// for protocol http and https
|
||||
if r.protocol == "http" || r.protocol == "https" {
|
||||
return r.sendHTTPRequest(r.method, fmt.Sprintf("%s://%s%s", r.protocol, addr, r.path),
|
||||
|
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
)
|
||||
|
||||
@@ -22,6 +23,9 @@ func ReadBytes(r io.Reader) ([]byte, error) {
|
||||
if err := binary.Read(r, binary.BigEndian, &length); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if length < 0 || length > 10*1024*1024 {
|
||||
return nil, fmt.Errorf("invalid length")
|
||||
}
|
||||
buffer := make([]byte, length)
|
||||
n, err := io.ReadFull(r, buffer)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user