mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
For #1110, Support params in http callback. 3.0.36
This commit is contained in:
parent
68a1656e07
commit
29b74c7220
5 changed files with 25 additions and 15 deletions
|
@ -184,6 +184,7 @@ Please select according to languages:
|
||||||
|
|
||||||
### V3 changes
|
### V3 changes
|
||||||
|
|
||||||
|
* v3.0, 2018-08-04, For [#1110][bug #1110], Support params in http callback. 3.0.36
|
||||||
* v3.0, 2018-08-02, Always use vhost in stream query, the unify uri. 3.0.35
|
* v3.0, 2018-08-02, Always use vhost in stream query, the unify uri. 3.0.35
|
||||||
* v3.0, 2018-08-02, For [#1031][bug #1031], SRS edge support douyu.com. 3.0.34
|
* v3.0, 2018-08-02, For [#1031][bug #1031], SRS edge support douyu.com. 3.0.34
|
||||||
* v3.0, 2018-07-22, Replace hex to string to match MIT license. 3.0.33
|
* v3.0, 2018-07-22, Replace hex to string to match MIT license. 3.0.33
|
||||||
|
@ -226,6 +227,7 @@ Please select according to languages:
|
||||||
|
|
||||||
### V2 changes
|
### V2 changes
|
||||||
|
|
||||||
|
* v2.0, 2018-08-04, For [#1110][bug #1110], Support params in http callback. 2.0.251
|
||||||
* v2.0, 2018-08-02, For [#1031][bug #1031], SRS edge support douyu.com. 2.0.250
|
* v2.0, 2018-08-02, For [#1031][bug #1031], SRS edge support douyu.com. 2.0.250
|
||||||
* v2.0, 2018-07-21, Merge [#1119][bug #1119], fix memory leak. 2.0.249
|
* v2.0, 2018-07-21, Merge [#1119][bug #1119], fix memory leak. 2.0.249
|
||||||
* <strong>v2.0, 2018-07-18, [2.0 release3(2.0.248)][r2.0r3] released. 86775 lines.</strong>
|
* <strong>v2.0, 2018-07-18, [2.0 release3(2.0.248)][r2.0r3] released. 86775 lines.</strong>
|
||||||
|
@ -1434,6 +1436,7 @@ Winlin
|
||||||
[bug #1176]: https://github.com/ossrs/srs/issues/1176
|
[bug #1176]: https://github.com/ossrs/srs/issues/1176
|
||||||
[bug #1119]: https://github.com/ossrs/srs/issues/1119
|
[bug #1119]: https://github.com/ossrs/srs/issues/1119
|
||||||
[bug #1031]: https://github.com/ossrs/srs/issues/1031
|
[bug #1031]: https://github.com/ossrs/srs/issues/1031
|
||||||
|
[bug #1110]: https://github.com/ossrs/srs/issues/1110
|
||||||
[bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx
|
[bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx
|
||||||
|
|
||||||
[bug #735]: https://github.com/ossrs/srs/issues/735
|
[bug #735]: https://github.com/ossrs/srs/issues/735
|
||||||
|
|
|
@ -851,7 +851,7 @@ vhost hooks.callback.srs.com {
|
||||||
# "action": "on_unpublish",
|
# "action": "on_unpublish",
|
||||||
# "client_id": 1985,
|
# "client_id": 1985,
|
||||||
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
|
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
|
||||||
# "stream": "livestream"
|
# "stream": "livestream", "param":"?token=xxx&salt=yyy"
|
||||||
# }
|
# }
|
||||||
# if valid, the hook must return HTTP code 200(Status OK) and response
|
# if valid, the hook must return HTTP code 200(Status OK) and response
|
||||||
# an int value specifies the error code(0 corresponding to success):
|
# an int value specifies the error code(0 corresponding to success):
|
||||||
|
@ -865,7 +865,7 @@ vhost hooks.callback.srs.com {
|
||||||
# "action": "on_play",
|
# "action": "on_play",
|
||||||
# "client_id": 1985,
|
# "client_id": 1985,
|
||||||
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
|
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
|
||||||
# "stream": "livestream",
|
# "stream": "livestream", "param":"?token=xxx&salt=yyy",
|
||||||
# "pageUrl": "http://www.test.com/live.html"
|
# "pageUrl": "http://www.test.com/live.html"
|
||||||
# }
|
# }
|
||||||
# if valid, the hook must return HTTP code 200(Status OK) and response
|
# if valid, the hook must return HTTP code 200(Status OK) and response
|
||||||
|
@ -880,7 +880,7 @@ vhost hooks.callback.srs.com {
|
||||||
# "action": "on_stop",
|
# "action": "on_stop",
|
||||||
# "client_id": 1985,
|
# "client_id": 1985,
|
||||||
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
|
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
|
||||||
# "stream": "livestream"
|
# "stream": "livestream", "param":"?token=xxx&salt=yyy"
|
||||||
# }
|
# }
|
||||||
# if valid, the hook must return HTTP code 200(Status OK) and response
|
# if valid, the hook must return HTTP code 200(Status OK) and response
|
||||||
# an int value specifies the error code(0 corresponding to success):
|
# an int value specifies the error code(0 corresponding to success):
|
||||||
|
@ -894,7 +894,7 @@ vhost hooks.callback.srs.com {
|
||||||
# "action": "on_dvr",
|
# "action": "on_dvr",
|
||||||
# "client_id": 1985,
|
# "client_id": 1985,
|
||||||
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
|
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
|
||||||
# "stream": "livestream",
|
# "stream": "livestream", "param":"?token=xxx&salt=yyy",
|
||||||
# "cwd": "/usr/local/srs",
|
# "cwd": "/usr/local/srs",
|
||||||
# "file": "./objs/nginx/html/live/livestream.1420254068776.flv"
|
# "file": "./objs/nginx/html/live/livestream.1420254068776.flv"
|
||||||
# }
|
# }
|
||||||
|
@ -908,7 +908,7 @@ vhost hooks.callback.srs.com {
|
||||||
# "action": "on_hls",
|
# "action": "on_hls",
|
||||||
# "client_id": 1985,
|
# "client_id": 1985,
|
||||||
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
|
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
|
||||||
# "stream": "livestream",
|
# "stream": "livestream", "param":"?token=xxx&salt=yyy",
|
||||||
# "duration": 9.36, // in seconds
|
# "duration": 9.36, // in seconds
|
||||||
# "cwd": "/usr/local/srs",
|
# "cwd": "/usr/local/srs",
|
||||||
# "file": "./objs/nginx/html/live/livestream/2015-04-23/01/476584165.ts",
|
# "file": "./objs/nginx/html/live/livestream/2015-04-23/01/476584165.ts",
|
||||||
|
@ -926,10 +926,11 @@ vhost hooks.callback.srs.com {
|
||||||
# so we use HTTP GET and use the variable following:
|
# so we use HTTP GET and use the variable following:
|
||||||
# [app], replace with the app.
|
# [app], replace with the app.
|
||||||
# [stream], replace with the stream.
|
# [stream], replace with the stream.
|
||||||
|
# [param], replace with the param.
|
||||||
# [ts_url], replace with the ts url.
|
# [ts_url], replace with the ts url.
|
||||||
# ignore any return data of server.
|
# ignore any return data of server.
|
||||||
# @remark random select a url to report, not report all.
|
# @remark random select a url to report, not report all.
|
||||||
on_hls_notify http://127.0.0.1:8085/api/v1/hls/[app]/[stream][ts_url];
|
on_hls_notify http://127.0.0.1:8085/api/v1/hls/[app]/[stream]/[ts_url][param];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,7 @@ srs_error_t SrsHttpHooks::on_publish(string url, SrsRequest* req)
|
||||||
obj->set("app", SrsJsonAny::str(req->app.c_str()));
|
obj->set("app", SrsJsonAny::str(req->app.c_str()));
|
||||||
obj->set("tcUrl", SrsJsonAny::str(req->tcUrl.c_str()));
|
obj->set("tcUrl", SrsJsonAny::str(req->tcUrl.c_str()));
|
||||||
obj->set("stream", SrsJsonAny::str(req->stream.c_str()));
|
obj->set("stream", SrsJsonAny::str(req->stream.c_str()));
|
||||||
|
obj->set("param", SrsJsonAny::str(req->param.c_str()));
|
||||||
|
|
||||||
std::string data = obj->dumps();
|
std::string data = obj->dumps();
|
||||||
std::string res;
|
std::string res;
|
||||||
|
@ -173,6 +174,7 @@ void SrsHttpHooks::on_unpublish(string url, SrsRequest* req)
|
||||||
obj->set("vhost", SrsJsonAny::str(req->vhost.c_str()));
|
obj->set("vhost", SrsJsonAny::str(req->vhost.c_str()));
|
||||||
obj->set("app", SrsJsonAny::str(req->app.c_str()));
|
obj->set("app", SrsJsonAny::str(req->app.c_str()));
|
||||||
obj->set("stream", SrsJsonAny::str(req->stream.c_str()));
|
obj->set("stream", SrsJsonAny::str(req->stream.c_str()));
|
||||||
|
obj->set("param", SrsJsonAny::str(req->param.c_str()));
|
||||||
|
|
||||||
std::string data = obj->dumps();
|
std::string data = obj->dumps();
|
||||||
std::string res;
|
std::string res;
|
||||||
|
@ -208,6 +210,7 @@ srs_error_t SrsHttpHooks::on_play(string url, SrsRequest* req)
|
||||||
obj->set("vhost", SrsJsonAny::str(req->vhost.c_str()));
|
obj->set("vhost", SrsJsonAny::str(req->vhost.c_str()));
|
||||||
obj->set("app", SrsJsonAny::str(req->app.c_str()));
|
obj->set("app", SrsJsonAny::str(req->app.c_str()));
|
||||||
obj->set("stream", SrsJsonAny::str(req->stream.c_str()));
|
obj->set("stream", SrsJsonAny::str(req->stream.c_str()));
|
||||||
|
obj->set("param", SrsJsonAny::str(req->param.c_str()));
|
||||||
obj->set("pageUrl", SrsJsonAny::str(req->pageUrl.c_str()));
|
obj->set("pageUrl", SrsJsonAny::str(req->pageUrl.c_str()));
|
||||||
|
|
||||||
std::string data = obj->dumps();
|
std::string data = obj->dumps();
|
||||||
|
@ -241,6 +244,7 @@ void SrsHttpHooks::on_stop(string url, SrsRequest* req)
|
||||||
obj->set("vhost", SrsJsonAny::str(req->vhost.c_str()));
|
obj->set("vhost", SrsJsonAny::str(req->vhost.c_str()));
|
||||||
obj->set("app", SrsJsonAny::str(req->app.c_str()));
|
obj->set("app", SrsJsonAny::str(req->app.c_str()));
|
||||||
obj->set("stream", SrsJsonAny::str(req->stream.c_str()));
|
obj->set("stream", SrsJsonAny::str(req->stream.c_str()));
|
||||||
|
obj->set("param", SrsJsonAny::str(req->param.c_str()));
|
||||||
|
|
||||||
std::string data = obj->dumps();
|
std::string data = obj->dumps();
|
||||||
std::string res;
|
std::string res;
|
||||||
|
@ -277,6 +281,7 @@ srs_error_t SrsHttpHooks::on_dvr(int cid, string url, SrsRequest* req, string fi
|
||||||
obj->set("vhost", SrsJsonAny::str(req->vhost.c_str()));
|
obj->set("vhost", SrsJsonAny::str(req->vhost.c_str()));
|
||||||
obj->set("app", SrsJsonAny::str(req->app.c_str()));
|
obj->set("app", SrsJsonAny::str(req->app.c_str()));
|
||||||
obj->set("stream", SrsJsonAny::str(req->stream.c_str()));
|
obj->set("stream", SrsJsonAny::str(req->stream.c_str()));
|
||||||
|
obj->set("param", SrsJsonAny::str(req->param.c_str()));
|
||||||
obj->set("cwd", SrsJsonAny::str(cwd.c_str()));
|
obj->set("cwd", SrsJsonAny::str(cwd.c_str()));
|
||||||
obj->set("file", SrsJsonAny::str(file.c_str()));
|
obj->set("file", SrsJsonAny::str(file.c_str()));
|
||||||
|
|
||||||
|
@ -318,6 +323,7 @@ srs_error_t SrsHttpHooks::on_hls(int cid, string url, SrsRequest* req, string fi
|
||||||
obj->set("vhost", SrsJsonAny::str(req->vhost.c_str()));
|
obj->set("vhost", SrsJsonAny::str(req->vhost.c_str()));
|
||||||
obj->set("app", SrsJsonAny::str(req->app.c_str()));
|
obj->set("app", SrsJsonAny::str(req->app.c_str()));
|
||||||
obj->set("stream", SrsJsonAny::str(req->stream.c_str()));
|
obj->set("stream", SrsJsonAny::str(req->stream.c_str()));
|
||||||
|
obj->set("param", SrsJsonAny::str(req->param.c_str()));
|
||||||
obj->set("duration", SrsJsonAny::number(duration));
|
obj->set("duration", SrsJsonAny::number(duration));
|
||||||
obj->set("cwd", SrsJsonAny::str(cwd.c_str()));
|
obj->set("cwd", SrsJsonAny::str(cwd.c_str()));
|
||||||
obj->set("file", SrsJsonAny::str(file.c_str()));
|
obj->set("file", SrsJsonAny::str(file.c_str()));
|
||||||
|
@ -355,6 +361,7 @@ srs_error_t SrsHttpHooks::on_hls_notify(int cid, std::string url, SrsRequest* re
|
||||||
url = srs_string_replace(url, "[app]", req->app);
|
url = srs_string_replace(url, "[app]", req->app);
|
||||||
url = srs_string_replace(url, "[stream]", req->stream);
|
url = srs_string_replace(url, "[stream]", req->stream);
|
||||||
url = srs_string_replace(url, "[ts_url]", ts_url);
|
url = srs_string_replace(url, "[ts_url]", ts_url);
|
||||||
|
url = srs_string_replace(url, "[param]", req->param);
|
||||||
|
|
||||||
int64_t starttime = srs_update_system_time_ms();
|
int64_t starttime = srs_update_system_time_ms();
|
||||||
|
|
||||||
|
|
|
@ -470,9 +470,9 @@ srs_error_t SrsRtmpConn::stream_service_cycle()
|
||||||
|
|
||||||
srs_discovery_tc_url(req->tcUrl, req->schema, req->host, req->vhost, req->app, req->stream, req->port, req->param);
|
srs_discovery_tc_url(req->tcUrl, req->schema, req->host, req->vhost, req->app, req->stream, req->port, req->param);
|
||||||
req->strip();
|
req->strip();
|
||||||
srs_trace("client identified, type=%s, vhost=%s, app=%s, stream_name=%s, duration=%.2f",
|
srs_trace("client identified, type=%s, vhost=%s, app=%s, stream=%s, param=%s, duration=%.2f",
|
||||||
srs_client_type_string(info->type).c_str(), req->vhost.c_str(), req->app.c_str(), req->stream.c_str(), req->duration);
|
srs_client_type_string(info->type).c_str(), req->vhost.c_str(), req->app.c_str(), req->stream.c_str(), req->param.c_str(), req->duration);
|
||||||
|
|
||||||
// discovery vhost, resolve the vhost from config
|
// discovery vhost, resolve the vhost from config
|
||||||
SrsConfDirective* parsed_vhost = _srs_config->get_vhost(req->vhost);
|
SrsConfDirective* parsed_vhost = _srs_config->get_vhost(req->vhost);
|
||||||
if (parsed_vhost) {
|
if (parsed_vhost) {
|
||||||
|
@ -489,11 +489,10 @@ srs_error_t SrsRtmpConn::stream_service_cycle()
|
||||||
return srs_error_wrap(err, "check vhost");
|
return srs_error_wrap(err, "check vhost");
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_trace("connected stream, tcUrl=%s, pageUrl=%s, swfUrl=%s, schema=%s, vhost=%s, port=%d, app=%s, stream=%s, args=%s",
|
srs_trace("connected stream, tcUrl=%s, pageUrl=%s, swfUrl=%s, schema=%s, vhost=%s, port=%d, app=%s, stream=%s, param=%s, args=%s",
|
||||||
req->tcUrl.c_str(), req->pageUrl.c_str(), req->swfUrl.c_str(),
|
req->tcUrl.c_str(), req->pageUrl.c_str(), req->swfUrl.c_str(), req->schema.c_str(), req->vhost.c_str(), req->port,
|
||||||
req->schema.c_str(), req->vhost.c_str(), req->port,
|
req->app.c_str(), req->stream.c_str(), req->param.c_str(), (req->args? "(obj)":"null"));
|
||||||
req->app.c_str(), req->stream.c_str(), (req->args? "(obj)":"null"));
|
|
||||||
|
|
||||||
// do token traverse before serve it.
|
// do token traverse before serve it.
|
||||||
// @see https://github.com/ossrs/srs/pull/239
|
// @see https://github.com/ossrs/srs/pull/239
|
||||||
if (true) {
|
if (true) {
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
// current release version
|
// current release version
|
||||||
#define VERSION_MAJOR 3
|
#define VERSION_MAJOR 3
|
||||||
#define VERSION_MINOR 0
|
#define VERSION_MINOR 0
|
||||||
#define VERSION_REVISION 35
|
#define VERSION_REVISION 36
|
||||||
|
|
||||||
// generated by configure, only macros.
|
// generated by configure, only macros.
|
||||||
#include <srs_auto_headers.hpp>
|
#include <srs_auto_headers.hpp>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue