mirror of
https://github.com/aler9/gortsplib
synced 2025-10-06 23:52:46 +08:00
increase maximum length of urls, header keys and values
This commit is contained in:
@@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
_MAX_HEADER_COUNT = 255
|
_MAX_HEADER_COUNT = 255
|
||||||
_MAX_HEADER_KEY_LENGTH = 255
|
_MAX_HEADER_KEY_LENGTH = 1024
|
||||||
_MAX_HEADER_VALUE_LENGTH = 255
|
_MAX_HEADER_VALUE_LENGTH = 1024
|
||||||
)
|
)
|
||||||
|
|
||||||
// Header is a RTSP reader, present in both Requests and Responses.
|
// Header is a RTSP reader, present in both Requests and Responses.
|
||||||
|
14
request.go
14
request.go
@@ -5,6 +5,12 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
_MAX_METHOD_LENGTH = 128
|
||||||
|
_MAX_PATH_LENGTH = 1024
|
||||||
|
_MAX_PROTOCOL_LENGTH = 128
|
||||||
|
)
|
||||||
|
|
||||||
// Request is a RTSP request.
|
// Request is a RTSP request.
|
||||||
type Request struct {
|
type Request struct {
|
||||||
Method string
|
Method string
|
||||||
@@ -16,7 +22,7 @@ type Request struct {
|
|||||||
func readRequest(br *bufio.Reader) (*Request, error) {
|
func readRequest(br *bufio.Reader) (*Request, error) {
|
||||||
req := &Request{}
|
req := &Request{}
|
||||||
|
|
||||||
byts, err := readBytesLimited(br, ' ', 255)
|
byts, err := readBytesLimited(br, ' ', _MAX_METHOD_LENGTH)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -26,17 +32,17 @@ func readRequest(br *bufio.Reader) (*Request, error) {
|
|||||||
return nil, fmt.Errorf("empty method")
|
return nil, fmt.Errorf("empty method")
|
||||||
}
|
}
|
||||||
|
|
||||||
byts, err = readBytesLimited(br, ' ', 255)
|
byts, err = readBytesLimited(br, ' ', _MAX_PATH_LENGTH)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
req.Url = string(byts[:len(byts)-1])
|
req.Url = string(byts[:len(byts)-1])
|
||||||
|
|
||||||
if len(req.Url) == 0 {
|
if len(req.Url) == 0 {
|
||||||
return nil, fmt.Errorf("empty path")
|
return nil, fmt.Errorf("empty url")
|
||||||
}
|
}
|
||||||
|
|
||||||
byts, err = readBytesLimited(br, '\r', 255)
|
byts, err = readBytesLimited(br, '\r', _MAX_PROTOCOL_LENGTH)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user