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

for #324, support hstrs(http stream trigger rtmp source) origin mode. 2.0.139.

This commit is contained in:
winlin 2015-03-14 19:45:13 +08:00
parent 995b130090
commit 27cb62b7aa
8 changed files with 123 additions and 13 deletions

View file

@ -40,6 +40,8 @@ using namespace std;
#include <srs_kernel_file.hpp>
#include <srs_core_autofree.hpp>
#include <srs_rtmp_buffer.hpp>
#include <srs_rtmp_sdk.hpp>
#include <srs_rtmp_utility.hpp>
#define SRS_DEFAULT_HTTP_PORT 80
@ -1286,6 +1288,32 @@ string SrsHttpMessage::get_request_header(string name)
return "";
}
SrsRequest* SrsHttpMessage::to_request(string vhost)
{
SrsRequest* req = new SrsRequest();
req->app = _uri->get_path();
ssize_t pos = string::npos;
if ((pos = req->app.rfind("/")) != string::npos) {
req->stream = req->app.substr(pos + 1);
req->app = req->app.substr(0, pos);
}
if ((pos = req->stream.rfind(".")) != string::npos) {
req->stream = req->stream.substr(0, pos);
}
req->tcUrl = "rtmp://" + vhost + req->app;
req->pageUrl = get_request_header("Referer");
req->objectEncoding = 0;
srs_discovery_tc_url(req->tcUrl,
req->schema, req->host, req->vhost, req->app, req->port,
req->param);
req->strip();
return req;
}
SrsHttpParser::SrsHttpParser()
{
buffer = new SrsFastBuffer();