1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For #1638, #307, use short-term http connection for rtc to use new cid.

This commit is contained in:
winlin 2020-03-17 12:10:42 +08:00
parent 6118ca382a
commit 29b9203428
2 changed files with 7 additions and 1 deletions

View file

@ -800,6 +800,10 @@ srs_error_t SrsGoApiSdp::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage*
// method: POST // method: POST
// e.g. /api/v1/sdp/ args = json:{"sdp":"sdp...", "app":"webrtc", "stream":"test"} // e.g. /api/v1/sdp/ args = json:{"sdp":"sdp...", "app":"webrtc", "stream":"test"}
// For each RTC session, we use short-term HTTP connection.
SrsHttpHeader* hdr = w->header();
hdr->set("Connection", "Close");
string req_json; string req_json;
if ((err = r->body_read_all(req_json)) != srs_success) { if ((err = r->body_read_all(req_json)) != srs_success) {
return srs_api_response_code(w, r, SRS_CONSTS_HTTP_BadRequest); return srs_api_response_code(w, r, SRS_CONSTS_HTTP_BadRequest);

View file

@ -907,7 +907,9 @@ srs_error_t SrsHttpResponseWriter::send_header(char* data, int size)
} }
// keep alive to make vlc happy. // keep alive to make vlc happy.
if (hdr->get("Connection").empty()) {
hdr->set("Connection", "Keep-Alive"); hdr->set("Connection", "Keep-Alive");
}
// Filter the header before writing it. // Filter the header before writing it.
if (hf && ((err = hf->filter(hdr)) != srs_success)) { if (hf && ((err = hf->filter(hdr)) != srs_success)) {