mirror of
https://github.com/aler9/gortsplib
synced 2025-10-06 15:46:51 +08:00
request: insert Content-Length automatically
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -128,6 +129,10 @@ func (req *Request) Write(bw *bufio.Writer) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(req.Content) != 0 {
|
||||||
|
req.Header["Content-Length"] = HeaderValue{strconv.FormatInt(int64(len(req.Content)), 10)}
|
||||||
|
}
|
||||||
|
|
||||||
err = req.Header.write(bw)
|
err = req.Header.write(bw)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Reference in New Issue
Block a user