mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-08-19 03:57:21 +00:00
preliminary support for RTSP
This commit is contained in:
@@ -48,6 +48,8 @@ struct uwsgi_http {
|
||||
int enable_proxy_protocol;
|
||||
|
||||
int proto_http;
|
||||
|
||||
int manage_rtsp;
|
||||
};
|
||||
|
||||
struct http_session {
|
||||
@@ -140,6 +142,8 @@ struct http_session {
|
||||
char *proxy_src_port;
|
||||
uint16_t proxy_src_len;
|
||||
uint16_t proxy_src_port_len;
|
||||
|
||||
int is_rtsp;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -67,6 +67,8 @@ struct uwsgi_option http_options[] = {
|
||||
{"http-enable-proxy-protocol", optional_argument, 0, "manage PROXY protocol requests", uwsgi_opt_true, &uhttp.enable_proxy_protocol, 0},
|
||||
|
||||
{"http-backend-http", no_argument, 0, "use plain http protocol instead of uwsgi for backend nodes", uwsgi_opt_true, &uhttp.proto_http, 0},
|
||||
|
||||
{"http-manage-rtsp", no_argument, 0, "manage RTSP sessions", uwsgi_opt_true, &uhttp.manage_rtsp, 0},
|
||||
{0, 0, 0, 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
@@ -469,6 +471,10 @@ static int http_headers_parse_dumb(struct corerouter_peer *peer, int skip) {
|
||||
if (uhttp.keepalive && !uwsgi_strncmp("HTTP/1.1", 8, base, ptr-base)) {
|
||||
hr->session.can_keepalive = 1;
|
||||
}
|
||||
if (uhttp.manage_rtsp && !uwsgi_strncmp("RTSP/1.0", 8, base, ptr-base)) {
|
||||
hr->session.can_keepalive = 1;
|
||||
hr->is_rtsp = 1;
|
||||
}
|
||||
ptr += 2;
|
||||
found = 1;
|
||||
break;
|
||||
@@ -653,6 +659,10 @@ int http_headers_parse(struct corerouter_peer *peer, int skip) {
|
||||
if (uhttp.keepalive && !uwsgi_strncmp("HTTP/1.1", 8, base, ptr-base)) {
|
||||
hr->session.can_keepalive = 1;
|
||||
}
|
||||
if (uhttp.manage_rtsp && !uwsgi_strncmp("RTSP/1.0", 8, base, ptr-base)) {
|
||||
hr->session.can_keepalive = 1;
|
||||
hr->is_rtsp = 1;
|
||||
}
|
||||
ptr += 2;
|
||||
found = 1;
|
||||
break;
|
||||
|
||||
@@ -17,7 +17,7 @@ int http_response_parse(struct http_session *hr, struct uwsgi_buffer *ub, size_t
|
||||
// protocol
|
||||
for(i=0;i<len;i++) {
|
||||
if (buf[i] == ' ') {
|
||||
if (hr->session.can_keepalive && uwsgi_strncmp("HTTP/1.1", 8, buf, i)) {
|
||||
if (!hr->is_rtsp && hr->session.can_keepalive && uwsgi_strncmp("HTTP/1.1", 8, buf, i)) {
|
||||
goto end;
|
||||
}
|
||||
if (i+1 >= len) return -1;;
|
||||
@@ -34,6 +34,15 @@ int http_response_parse(struct http_session *hr, struct uwsgi_buffer *ub, size_t
|
||||
for(i=next;i<len;i++) {
|
||||
if (buf[i] == '\r' || buf[i] == '\n') {
|
||||
// status ready
|
||||
// if we are in RTSP mode we need to ensure a 200 is returned
|
||||
if (hr->is_rtsp) {
|
||||
if (next + 3 >= len) return -1;
|
||||
char *code = buf + next;
|
||||
if (code[0] != '2' || code[1] != '0' || code[2] != '0') {
|
||||
hr->is_rtsp = 0;
|
||||
hr->session.can_keepalive = 0;
|
||||
}
|
||||
}
|
||||
if (i+1 >= len) return -1;
|
||||
next = i + 1;
|
||||
found = 1;
|
||||
@@ -116,7 +125,7 @@ int http_response_parse(struct http_session *hr, struct uwsgi_buffer *ub, size_t
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_size) {
|
||||
if (!has_size && !hr->is_rtsp) {
|
||||
#ifdef UWSGI_ZLIB
|
||||
if (hr->has_gzip) {
|
||||
hr->force_gzip = 1;
|
||||
|
||||
Reference in New Issue
Block a user