mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
improve http response when err happens.
1. response 200 with code when rtc/v1 remote sdp parse error; 2. response 500 when no handled err.
This commit is contained in:
parent
282d94d7bb
commit
6c1aeb1809
2 changed files with 10 additions and 2 deletions
|
@ -645,7 +645,13 @@ srs_error_t SrsGoApiRtcWhip::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessa
|
||||||
|
|
||||||
SrsRtcUserConfig ruc;
|
SrsRtcUserConfig ruc;
|
||||||
if ((err = do_serve_http(w, r, &ruc)) != srs_success) {
|
if ((err = do_serve_http(w, r, &ruc)) != srs_success) {
|
||||||
return srs_error_wrap(err, "serve");
|
if (srs_error_code(err) == ERROR_RTC_SDP_EXCHANGE) {
|
||||||
|
srs_warn("RTC error %s", srs_error_desc(err).c_str());
|
||||||
|
srs_freep(err);
|
||||||
|
return srs_api_response_code(w, r, SRS_CONSTS_HTTP_BadRequest);
|
||||||
|
} else {
|
||||||
|
return srs_error_wrap(err, "serve");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ruc.local_sdp_str_.empty()) {
|
if (ruc.local_sdp_str_.empty()) {
|
||||||
return srs_go_http_error(w, SRS_CONSTS_HTTP_InternalServerError);
|
return srs_go_http_error(w, SRS_CONSTS_HTTP_InternalServerError);
|
||||||
|
|
|
@ -765,7 +765,9 @@ srs_error_t SrsHttpServeMux::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessa
|
||||||
|
|
||||||
srs_assert(h);
|
srs_assert(h);
|
||||||
if ((err = h->serve_http(w, r)) != srs_success) {
|
if ((err = h->serve_http(w, r)) != srs_success) {
|
||||||
return srs_error_wrap(err, "serve http");
|
srs_error("serve_http %s", srs_error_desc(err).c_str());
|
||||||
|
srs_freep(err);
|
||||||
|
return srs_go_http_error(w, SRS_CONSTS_HTTP_InternalServerError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue