diff --git a/README.md b/README.md
index 2969ff97a..38e281cc9 100755
--- a/README.md
+++ b/README.md
@@ -333,6 +333,7 @@ Remark:
## History
+* 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-07-21, Merge [#1119][bug #1119], fix memory leak. 2.0.249
* v2.0, 2018-07-18, [2.0 release3(2.0.248)][r2.0r3] released. 86775 lines.
@@ -1315,6 +1316,7 @@ Winlin
[bug #1176]: https://github.com/ossrs/srs/issues/1176
[bug #1119]: https://github.com/ossrs/srs/issues/1119
[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
[exo #828]: https://github.com/google/ExoPlayer/pull/828
diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf
index 4edac7d3d..246d215a0 100644
--- a/trunk/conf/full.conf
+++ b/trunk/conf/full.conf
@@ -737,7 +737,7 @@ vhost hooks.callback.srs.com {
# "action": "on_unpublish",
# "client_id": 1985,
# "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(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success):
@@ -751,7 +751,7 @@ vhost hooks.callback.srs.com {
# "action": "on_play",
# "client_id": 1985,
# "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"
# }
# if valid, the hook must return HTTP code 200(Stauts OK) and response
@@ -766,7 +766,7 @@ vhost hooks.callback.srs.com {
# "action": "on_stop",
# "client_id": 1985,
# "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(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success):
@@ -780,7 +780,7 @@ vhost hooks.callback.srs.com {
# "action": "on_dvr",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
- # "stream": "livestream",
+ # "stream": "livestream", "param":"?token=xxx&salt=yyy",
# "cwd": "/usr/local/srs",
# "file": "./objs/nginx/html/live/livestream.1420254068776.flv"
# }
@@ -794,7 +794,7 @@ vhost hooks.callback.srs.com {
# "action": "on_hls",
# "client_id": 1985,
# "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
# "cwd": "/usr/local/srs",
# "file": "./objs/nginx/html/live/livestream/2015-04-23/01/476584165.ts",
@@ -812,10 +812,11 @@ vhost hooks.callback.srs.com {
# so we use HTTP GET and use the variable following:
# [app], replace with the app.
# [stream], replace with the stream.
+ # [param], replace with the param.
# [ts_url], replace with the ts url.
# ignore any return data of server.
# @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];
}
}
diff --git a/trunk/ide/srs_xcode/srs_xcode.xcodeproj/project.pbxproj b/trunk/ide/srs_xcode/srs_xcode.xcodeproj/project.pbxproj
index b5e5a63e7..4ab868aeb 100644
--- a/trunk/ide/srs_xcode/srs_xcode.xcodeproj/project.pbxproj
+++ b/trunk/ide/srs_xcode/srs_xcode.xcodeproj/project.pbxproj
@@ -311,7 +311,6 @@
3C1EE6C91AB1080900576EE9 /* origin.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = origin.conf; path = ../../../conf/origin.conf; sourceTree = ""; };
3C1EE6CA1AB1080900576EE9 /* push.mpegts.over.udp.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = push.mpegts.over.udp.conf; path = ../../../conf/push.mpegts.over.udp.conf; sourceTree = ""; };
3C1EE6CB1AB1080900576EE9 /* push.rtsp.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = push.rtsp.conf; path = ../../../conf/push.rtsp.conf; sourceTree = ""; };
- 3C1EE6CC1AB1080900576EE9 /* ram.hls.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = ram.hls.conf; path = ../../../conf/ram.hls.conf; sourceTree = ""; };
3C1EE6CD1AB1080900576EE9 /* realtime.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = realtime.conf; path = ../../../conf/realtime.conf; sourceTree = ""; };
3C1EE6CE1AB1080900576EE9 /* rtmp.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = rtmp.conf; path = ../../../conf/rtmp.conf; sourceTree = ""; };
3C1EE6CF1AB1080900576EE9 /* security.deny.publish.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = security.deny.publish.conf; path = ../../../conf/security.deny.publish.conf; sourceTree = ""; };
@@ -703,7 +702,6 @@
3C1EE6C91AB1080900576EE9 /* origin.conf */,
3C1EE6CA1AB1080900576EE9 /* push.mpegts.over.udp.conf */,
3C1EE6CB1AB1080900576EE9 /* push.rtsp.conf */,
- 3C1EE6CC1AB1080900576EE9 /* ram.hls.conf */,
3C1EE6CD1AB1080900576EE9 /* realtime.conf */,
3C1EE6CE1AB1080900576EE9 /* rtmp.conf */,
3C1EE6CF1AB1080900576EE9 /* security.deny.publish.conf */,
diff --git a/trunk/src/app/srs_app_http_hooks.cpp b/trunk/src/app/srs_app_http_hooks.cpp
index c6d2e9276..d63df4931 100644
--- a/trunk/src/app/srs_app_http_hooks.cpp
+++ b/trunk/src/app/srs_app_http_hooks.cpp
@@ -131,6 +131,15 @@ int SrsHttpHooks::on_publish(string url, SrsRequest* req)
int client_id = _srs_context->get_id();
+ string stream = req->stream;
+ // Pass params in stream, @see https://github.com/ossrs/srs/issues/1031#issuecomment-409745733
+ if (!req->param.empty()) {
+ if (req->param.find("?") != 0) {
+ stream += "?";
+ }
+ stream += req->param;
+ }
+
std::stringstream ss;
ss << SRS_JOBJECT_START
<< SRS_JFIELD_STR("action", "on_publish") << SRS_JFIELD_CONT
@@ -139,7 +148,7 @@ int SrsHttpHooks::on_publish(string url, SrsRequest* req)
<< SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("tcUrl", req->tcUrl) << SRS_JFIELD_CONT // Add tcUrl for auth publish rtmp stream client
- << SRS_JFIELD_STR("stream", req->stream)
+ << SRS_JFIELD_STR("stream", stream)
<< SRS_JOBJECT_END;
std::string data = ss.str();
@@ -172,7 +181,8 @@ void SrsHttpHooks::on_unpublish(string url, SrsRequest* req)
<< SRS_JFIELD_STR("ip", req->ip) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT
- << SRS_JFIELD_STR("stream", req->stream)
+ << SRS_JFIELD_STR("stream", req->stream)<< SRS_JFIELD_CONT
+ << SRS_JFIELD_STR("param", req->param)
<< SRS_JOBJECT_END;
std::string data = ss.str();
@@ -206,6 +216,7 @@ int SrsHttpHooks::on_play(string url, SrsRequest* req)
<< SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("stream", req->stream) << SRS_JFIELD_CONT
+ << SRS_JFIELD_STR("param", req->param) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("pageUrl", req->pageUrl)
<< SRS_JOBJECT_END;
@@ -239,7 +250,8 @@ void SrsHttpHooks::on_stop(string url, SrsRequest* req)
<< SRS_JFIELD_STR("ip", req->ip) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT
- << SRS_JFIELD_STR("stream", req->stream)
+ << SRS_JFIELD_STR("stream", req->stream) << SRS_JFIELD_CONT
+ << SRS_JFIELD_STR("param", req->param)
<< SRS_JOBJECT_END;
std::string data = ss.str();
@@ -274,6 +286,7 @@ int SrsHttpHooks::on_dvr(int cid, string url, SrsRequest* req, string file)
<< SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("stream", req->stream) << SRS_JFIELD_CONT
+ << SRS_JFIELD_STR("param", req->param) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("cwd", cwd) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("file", file)
<< SRS_JOBJECT_END;
@@ -316,6 +329,7 @@ int SrsHttpHooks::on_hls(int cid, string url, SrsRequest* req, string file, stri
<< SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("stream", req->stream) << SRS_JFIELD_CONT
+ << SRS_JFIELD_STR("param", req->param) << SRS_JFIELD_CONT
<< SRS_JFIELD_ORG("duration", duration) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("cwd", cwd) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("file", file) << SRS_JFIELD_CONT
@@ -356,6 +370,7 @@ int SrsHttpHooks::on_hls_notify(int cid, std::string url, SrsRequest* req, std::
url = srs_string_replace(url, "[app]", req->app);
url = srs_string_replace(url, "[stream]", req->stream);
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();
diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp
index 58781768c..3c8aee8ed 100755
--- a/trunk/src/app/srs_app_rtmp_conn.cpp
+++ b/trunk/src/app/srs_app_rtmp_conn.cpp
@@ -438,8 +438,8 @@ int SrsRtmpConn::stream_service_cycle()
srs_discovery_tc_url(req->tcUrl, req->schema, req->host, req->vhost, req->app, req->stream, req->port, req->param);
req->strip();
- srs_trace("client identified, type=%s, stream_name=%s, duration=%.2f",
- srs_client_type_string(type).c_str(), req->stream.c_str(), req->duration);
+ srs_trace("client identified, type=%s, stream_name=%s, duration=%.2f, param=%s",
+ srs_client_type_string(type).c_str(), req->stream.c_str(), req->duration, req->param.c_str());
// discovery vhost, resolve the vhost from config
SrsConfDirective* parsed_vhost = _srs_config->get_vhost(req->vhost);
@@ -460,10 +460,10 @@ int SrsRtmpConn::stream_service_cycle()
return ret;
}
- srs_trace("connected stream, tcUrl=%s, pageUrl=%s, swfUrl=%s, schema=%s, vhost=%s, port=%s, app=%s, stream=%s, args=%s",
+ srs_trace("connected stream, tcUrl=%s, pageUrl=%s, swfUrl=%s, schema=%s, vhost=%s, port=%s, app=%s, stream=%s, param=%s, args=%s",
req->tcUrl.c_str(), req->pageUrl.c_str(), req->swfUrl.c_str(),
req->schema.c_str(), req->vhost.c_str(), req->port.c_str(),
- req->app.c_str(), req->stream.c_str(), (req->args? "(obj)":"null"));
+ req->app.c_str(), req->stream.c_str(), req->param.c_str(), (req->args? "(obj)":"null"));
// do token traverse before serve it.
// @see https://github.com/ossrs/srs/pull/239
diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp
index 62352b69e..c2ceadcf9 100644
--- a/trunk/src/core/srs_core.hpp
+++ b/trunk/src/core/srs_core.hpp
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
-#define VERSION_REVISION 250
+#define VERSION_REVISION 251
// generated by configure, only macros.
#include