Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SRS2.0 HTTP-FLV, can it also forward the client IP? #1488

Closed
zywu31 opened this issue Nov 12, 2019 · 4 comments
Closed

SRS2.0 HTTP-FLV, can it also forward the client IP? #1488

zywu31 opened this issue Nov 12, 2019 · 4 comments
Assignees
Labels
TransByAI Translated by AI/GPT.
Milestone

Comments

@zywu31
Copy link

zywu31 commented Nov 12, 2019

SRS2.0 HTTP-FLV, can it also forward the client IP?
RTMP requests have the client's requested IP,
but FLV does not.

RTMP
{"action":"on_play","client_id":116,"ip":"172.17.0.1","vhost":"defaultVhost","app":"live","stream":"livestream","param":"?token=123&salt=456","pageUrl":""}

FLV
{"action":"on_play","client_id":113,"ip":"","vhost":"defaultVhost","app":"live","stream":"livestream","param":"?token=123&salt=456","pageUrl":""}

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Dec 26, 2019

When playing HTTP, there is no on_connect, only on_play, and on_play does not have an IP.

(gdb) p *req
$2 = {_vptr.SrsRequest = 0x95b3d0 <vtable for SrsRequest+16>, ip = "", tcUrl = "rtmp://__defaultVhost__/live", pageUrl = "", swfUrl = "", 
  objectEncoding = 0, schema = "http", vhost = "__defaultVhost__", host = "__defaultVhost__", port = "1935", app = "live", param = "", 
  stream = "livestream", duration = -1, args = 0x0}
(gdb) bt
#0  SrsHttpHooks::on_play (url="http://127.0.0.1:8085/api/v1/sessions", req=0x9e7db0) at src/app/srs_app_http_hooks.cpp:199
#1  0x000000000049eb52 in SrsLiveStream::http_hooks_on_play (this=0x9a78a0, r=0x9e59f0) at src/app/srs_app_http_stream.cpp:671
#2  0x000000000049d6ae in SrsLiveStream::serve_http (this=0x9a78a0, w=0x7ffff7f03b90, r=0x9e59f0) at src/app/srs_app_http_stream.cpp:484
#3  0x000000000045c4e3 in SrsHttpServeMux::serve_http (this=0x97e540, w=0x7ffff7f03b90, r=0x9e59f0) at src/protocol/srs_http_stack.cpp:661
#4  0x00000000004e0898 in SrsHttpServer::serve_http (this=0x97e500, w=0x7ffff7f03b90, r=0x9e59f0) at src/app/srs_app_http_conn.cpp:1384
#5  0x00000000004dff53 in SrsHttpConn::process_request (this=0x9c55c0, w=0x7ffff7f03b90, r=0x9e59f0) at src/app/srs_app_http_conn.cpp:1296
#6  0x00000000004dfd09 in SrsHttpConn::do_cycle (this=0x9c55c0) at src/app/srs_app_http_conn.cpp:1274
#7  0x0000000000471929 in SrsConnection::cycle (this=0x9c55c0) at src/app/srs_app_conn.cpp:89

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Dec 26, 2019

When converting an HTTP Request to SrsRequest, the IP information is lost and cannot be recovered.

[2019-12-26 02:30:41][trace] srs on_play: client id=113, ip=172.17.0.1, vhost=__defaultVhost__, app=live, stream=livestream, pageUrl=
127.0.0.1 - - [26/Dec/2019:02:30:41] "POST /api/v1/sessions HTTP/1.1" 200 1 "" "SRS(Simple RTMP Server)2.0.268"

Directly accessing HTTP-FLV already provides IP information, but we also need to consider the scenario of accessing through an HTTP proxy.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Dec 26, 2019

SRS2, HTTP direct access, and proxy are all supported.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Dec 26, 2019

SRS3 is also supported.

TRANS_BY_GPT3

@winlinvip winlinvip self-assigned this Sep 6, 2021
@winlinvip winlinvip changed the title SRS2.0 HTTP-FLV 这个能把客户端IP也转发过来吗? SRS2.0 HTTP-FLV, can it also forward the client IP? Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

2 participants