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

For #1488, pass client ip to http callback. 2.0.269

This commit is contained in:
winlin 2019-12-26 10:37:16 +08:00
parent c5f31570cd
commit 09b65aff96
5 changed files with 15 additions and 1 deletions

View file

@ -338,6 +338,7 @@ Remark:
## History ## History
* v2.0, 2019-12-26, For [#1488][bug #1488], pass client ip to http callback. 2.0.269
* v2.0, 2019-12-23, Fix [srs-librtmp #22](https://github.com/ossrs/srs-librtmp/issues/22), parse vhost splited by single seperator. 2.0.268 * v2.0, 2019-12-23, Fix [srs-librtmp #22](https://github.com/ossrs/srs-librtmp/issues/22), parse vhost splited by single seperator. 2.0.268
* v2.0, 2019-12-23, Fix [srs-librtmp #25](https://github.com/ossrs/srs-librtmp/issues/25), build srs-librtmp on windows. 2.0.267 * v2.0, 2019-12-23, Fix [srs-librtmp #25](https://github.com/ossrs/srs-librtmp/issues/25), build srs-librtmp on windows. 2.0.267
* v2.0, 2019-12-13, Support openssl versions greater than 1.1.0. 2.0.266 * v2.0, 2019-12-13, Support openssl versions greater than 1.1.0. 2.0.266

View file

@ -23,6 +23,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_conn.hpp> #include <srs_app_conn.hpp>
using namespace std;
#include <srs_kernel_log.hpp> #include <srs_kernel_log.hpp>
#include <srs_kernel_error.hpp> #include <srs_kernel_error.hpp>
#include <srs_app_utility.hpp> #include <srs_app_utility.hpp>
@ -117,6 +119,10 @@ int SrsConnection::srs_id()
return id; return id;
} }
string SrsConnection::remote_ip() {
return ip;
}
void SrsConnection::expire() void SrsConnection::expire()
{ {
expired = true; expired = true;

View file

@ -130,6 +130,8 @@ public:
* get the srs id which identify the client. * get the srs id which identify the client.
*/ */
virtual int srs_id(); virtual int srs_id();
// Get the remote ip of peer.
virtual std::string remote_ip();
/** /**
* set connection to expired. * set connection to expired.
*/ */

View file

@ -870,6 +870,11 @@ SrsRequest* SrsHttpMessage::to_request(string vhost)
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->as_http(); req->as_http();
// Set ip by remote ip of connection.
if (conn) {
req->ip = conn->remote_ip();
}
return req; return req;
} }

View file

@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version // current release version
#define VERSION_MAJOR 2 #define VERSION_MAJOR 2
#define VERSION_MINOR 0 #define VERSION_MINOR 0
#define VERSION_REVISION 268 #define VERSION_REVISION 269
// generated by configure, only macros. // generated by configure, only macros.
#include <srs_auto_headers.hpp> #include <srs_auto_headers.hpp>