Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve http response when err happens. #4073

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion trunk/src/app/srs_app_rtc_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,13 @@ srs_error_t SrsGoApiRtcWhip::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessa

SrsRtcUserConfig ruc;
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()) {
return srs_go_http_error(w, SRS_CONSTS_HTTP_InternalServerError);
Expand Down
4 changes: 3 additions & 1 deletion trunk/src/protocol/srs_protocol_http_stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,9 @@ srs_error_t SrsHttpServeMux::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessa

srs_assert(h);
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;
Expand Down
Loading