mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-17 00:51:09 +02:00
Add first version of 4xx HTTP code handlers for nitify submodule
This commit is contained in:
parent
854d5142df
commit
c39589c5ea
|
@ -860,6 +860,8 @@ ngx_rtmp_notify_parse_http_retcode(ngx_rtmp_session_t *s,
|
|||
return NGX_OK;
|
||||
case (u_char) '3':
|
||||
return NGX_AGAIN;
|
||||
case (u_char) '4':
|
||||
return NGX_DECLINED;
|
||||
default:
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
@ -1005,10 +1007,31 @@ ngx_rtmp_notify_connect_handle(ngx_rtmp_session_t *s,
|
|||
static ngx_str_t location = ngx_string("location");
|
||||
|
||||
rc = ngx_rtmp_notify_parse_http_retcode(s, in);
|
||||
|
||||
/* HTTP 5xx or unknown/unsupprted */
|
||||
|
||||
if (rc == NGX_ERROR) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
/* HTTP 4xx */
|
||||
|
||||
if (rc == NGX_DECLINED) {
|
||||
|
||||
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
|
||||
"notify: connection denyed by callback return code 4xx");
|
||||
|
||||
ngx_rtmp_send_status("NetConnection.Connect.Rejected", "error",
|
||||
"Cennection denyed by notify event handler and callback return code");
|
||||
|
||||
// Something by rtmpdump lib
|
||||
send = ngx_rtmp_send_close_method(s, "close");
|
||||
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
|
||||
"notify: connect send(e) close method = '%ui'", send == NGX_OK);
|
||||
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
if (rc != NGX_AGAIN) {
|
||||
goto next;
|
||||
}
|
||||
|
@ -1116,11 +1139,34 @@ ngx_rtmp_notify_publish_handle(ngx_rtmp_session_t *s,
|
|||
static ngx_str_t location = ngx_string("location");
|
||||
|
||||
rc = ngx_rtmp_notify_parse_http_retcode(s, in);
|
||||
|
||||
/* HTTP 5xx or unknown/unsupprted */
|
||||
|
||||
if (rc == NGX_ERROR) {
|
||||
ngx_rtmp_notify_clear_flag(s, NGX_RTMP_NOTIFY_PUBLISHING);
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
/* HTTP 4xx */
|
||||
|
||||
if (rc == NGX_DECLINED) {
|
||||
|
||||
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
|
||||
"notify: publishing denyed by callback return code 4xx");
|
||||
|
||||
ngx_rtmp_send_status("NetConnection.Connect.Rejected", "error",
|
||||
"Publishing denyed by notify event handler and callback return code");
|
||||
|
||||
ngx_rtmp_notify_clear_flag(s, NGX_RTMP_NOTIFY_PUBLISHING);
|
||||
|
||||
// Something by rtmpdump lib
|
||||
send = ngx_rtmp_send_close_method(s, "close");
|
||||
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
|
||||
"notify: connect send(e) close method = '%ui'", send == NGX_OK);
|
||||
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
if (rc != NGX_AGAIN) {
|
||||
goto next;
|
||||
}
|
||||
|
@ -1239,11 +1285,34 @@ ngx_rtmp_notify_play_handle(ngx_rtmp_session_t *s,
|
|||
static ngx_str_t location = ngx_string("location");
|
||||
|
||||
rc = ngx_rtmp_notify_parse_http_retcode(s, in);
|
||||
|
||||
/* HTTP 5xx or unknown/unsupprted */
|
||||
|
||||
if (rc == NGX_ERROR) {
|
||||
ngx_rtmp_notify_clear_flag(s, NGX_RTMP_NOTIFY_PLAYING);
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
/* HTTP 4xx */
|
||||
|
||||
if (rc == NGX_DECLINED) {
|
||||
|
||||
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
|
||||
"notify: playing denyed by callback return code 4xx");
|
||||
|
||||
ngx_rtmp_send_status("NetConnection.Connect.Rejected", "error",
|
||||
"Playing denyed by notify event handler and callback return code");
|
||||
|
||||
ngx_rtmp_notify_clear_flag(s, NGX_RTMP_NOTIFY_PLAYING);
|
||||
|
||||
// Something by rtmpdump lib
|
||||
send = ngx_rtmp_send_close_method(s, "close");
|
||||
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
|
||||
"notify: connect send(e) close method = '%ui'", send == NGX_OK);
|
||||
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
if (rc != NGX_AGAIN) {
|
||||
goto next;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue