mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
fix the ip address is included in SRSServer.API.
e.g. []API := { "127.0.0.1:19851" }
This commit is contained in:
parent
b5036ebdc2
commit
d752a8f5e3
1 changed files with 8 additions and 1 deletions
|
@ -101,7 +101,14 @@ func (v *SRSServer) Format(f fmt.State, c rune) {
|
|||
}
|
||||
|
||||
func (v *SRSServer) ApiRequest(ctx context.Context, r *http.Request, body []byte) ([]byte, error) {
|
||||
url := "http://" + v.IP + ":" + v.API[0] + r.URL.Path
|
||||
var url string
|
||||
// if the v.API[0] contains ip address, e.g. 127.0.0.1:1985, then use it as the ip address
|
||||
if strings.Contains(v.API[0], ":") && strings.Index(v.API[0], ":") > 0 {
|
||||
url = "http://" + v.API[0] + r.URL.Path
|
||||
} else {
|
||||
url = "http://" + v.IP + ":" + v.API[0] + r.URL.Path
|
||||
}
|
||||
|
||||
if r.URL.RawQuery != "" {
|
||||
url += "?" + r.URL.RawQuery
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue