1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00
This commit is contained in:
Jacob Su 2025-02-20 14:29:46 +07:00 committed by GitHub
commit c542fe76e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 449 additions and 11 deletions

View file

@ -82,7 +82,7 @@ func (v *srsHTTPAPIServer) Run(ctx context.Context) error {
logger.Df(ctx, "Handle /rtc/v1/whip/ by %v", addr)
mux.HandleFunc("/rtc/v1/whip/", func(w http.ResponseWriter, r *http.Request) {
if err := v.rtc.HandleApiForWHIP(ctx, w, r); err != nil {
apiError(ctx, w, r, err)
apiError(ctx, w, r, err, http.StatusInternalServerError)
}
})
@ -90,10 +90,15 @@ func (v *srsHTTPAPIServer) Run(ctx context.Context) error {
logger.Df(ctx, "Handle /rtc/v1/whep/ by %v", addr)
mux.HandleFunc("/rtc/v1/whep/", func(w http.ResponseWriter, r *http.Request) {
if err := v.rtc.HandleApiForWHEP(ctx, w, r); err != nil {
apiError(ctx, w, r, err)
apiError(ctx, w, r, err, http.StatusInternalServerError)
}
})
logger.Df(ctx, "Proxy /api/ to srs")
mux.HandleFunc("/api/", func(w http.ResponseWriter, r *http.Request) {
srsLoadBalancer.ProxyHTTPAPI(ctx, w, r)
})
// Run HTTP API server.
v.wg.Add(1)
go func() {
@ -239,7 +244,7 @@ func (v *systemAPI) Run(ctx context.Context) error {
logger.Df(ctx, "Register SRS media server, %+v", server)
return nil
}(); err != nil {
apiError(ctx, w, r, err)
apiError(ctx, w, r, err, http.StatusInternalServerError)
}
type Response struct {