Skip to content

Commit

Permalink
For #1488, pass client ip to http callback. 2.0.269
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Dec 26, 2019
1 parent c5f3157 commit 09b65af
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ Remark:

## 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 #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
Expand Down
6 changes: 6 additions & 0 deletions trunk/src/app/srs_app_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#include <srs_app_conn.hpp>

using namespace std;

#include <srs_kernel_log.hpp>
#include <srs_kernel_error.hpp>
#include <srs_app_utility.hpp>
Expand Down Expand Up @@ -117,6 +119,10 @@ int SrsConnection::srs_id()
return id;
}

string SrsConnection::remote_ip() {
return ip;
}

void SrsConnection::expire()
{
expired = true;
Expand Down
2 changes: 2 additions & 0 deletions trunk/src/app/srs_app_conn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ class SrsConnection : public virtual ISrsOneCycleThreadHandler, public virtual I
* get the srs id which identify the client.
*/
virtual int srs_id();
// Get the remote ip of peer.
virtual std::string remote_ip();
/**
* set connection to expired.
*/
Expand Down
5 changes: 5 additions & 0 deletions trunk/src/app/srs_app_http_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
req->as_http();

// Set ip by remote ip of connection.
if (conn) {
req->ip = conn->remote_ip();
}

return req;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 268
#define VERSION_REVISION 269

// generated by configure, only macros.
#include <srs_auto_headers.hpp>
Expand Down

0 comments on commit 09b65af

Please sign in to comment.