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

WebRTC: HTTP Callback unable to authenticate by special chars #2774

Open
Cyaim opened this issue Dec 7, 2021 · 10 comments
Open

WebRTC: HTTP Callback unable to authenticate by special chars #2774

Cyaim opened this issue Dec 7, 2021 · 10 comments
Assignees
Labels
API HTTP-API, HTTP-Callback, etc. TransByAI Translated by AI/GPT.

Comments

@Cyaim
Copy link

Cyaim commented Dec 7, 2021

Note: Before asking a question, please read the FAQ (Please read FAQ before filing an issue) #2716

Description

Please describe your issue here

  1. SRS version: SRS/4.0.136
  1. SRS log:
[2021-12-07 09:10:34.715][Trace][1][i9a3611q] HTTP #0 192.168.1.7:52315 POST http://127.0.0.1/rtc/v1/play/?token=JCteIcIXi6jo41F0kF4Lo85MTTCjEblPF9P7/TlUmVfIwKd4tqZhx3/TBa5RCSFUWwo3iTmrLiWv/OdCqWu+KEw/NoLVLbNr, content-length=5957
[2021-12-07 09:10:34.716][Trace][1][i9a3611q] RTC play webrtc://127.0.0.1/live/ID0602181091342260950842?token=JCteIcIXi6jo41F0kF4Lo85MTTCjEblPF9P7/TlUmVfIwKd4tqZhx3/TBa5RCSFUWwo3iTmrLiWv/OdCqWu+KEw/NoLVLbNr, api=https://127.0.0.1:1986/rtc/v1/play/?token=JCteIcIXi6jo41F0kF4Lo85MTTCjEblPF9P7/TlUmVfIwKd4tqZhx3/TBa5RCSFUWwo3iTmrLiWv/OdCqWu+KEw/NoLVLbNr, tid=, clientip=, app=live/ID0602181091342260950842, stream=NoLVLbNr, offer=5256B, eip=, codec=, srtp=, dtls=
[2021-12-07 09:10:34.716][Trace][1][i9a3611q] ignore attribute=, value=
[2021-12-07 09:10:34.717][Trace][1][i9a3611q] new source, stream_url=/live/ID0602181091342260950842/NoLVLbNr
[2021-12-07 09:10:34.717][Trace][1][i9a3611q] RTC player nack=1, nnc=1
[2021-12-07 09:10:34.717][Trace][1][i9a3611q] RTC connection player gcc=0
[2021-12-07 09:10:34.717][Trace][1][i9a3611q] RTC: Init tracks {track: video-8g582864, is_active: 0=>1},{track: audio-210wo838, is_active: 0=>1}, ok
[2021-12-07 09:10:34.717][Trace][1][i9a3611q] RTC: Use candidates 127.0.0.1
[2021-12-07 09:10:34.717][Trace][1][i9a3611q] RTC init session, user=tcc99f37:oNct, url=/live/ID0602181091342260950842/NoLVLbNr, encrypt=1/1, DTLS(role=passive, version=auto), timeout=30000ms, nack=1
[2021-12-07 09:10:34.717][Trace][1][i9a3611q] RTC username=tcc99f37:oNct, dtls=1, srtp=1, offer=5256B, answer=1263B
[2021-12-07 09:10:34.717][Trace][1][i9a3611q] RTC remote offer: v=0\r\no=- 713663494280816082 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0 1\r\na=extmap-allow-mixed\r\na=msid-semantic: WMS\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111 63 103 104 9 0 8 106 105 13 110 112 113 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:oNct\r\na=ice-pwd:GJWkQy0xqNrNebrk6lpMCOWn\r\na=ice-options:trickle\r\na=fingerprint:sha-256 35:8D:B9:11:A1:39:DF:3C:99:39:54:53:38:03:D0:1B:A0:12:EC:60:01:69:56:8B:2B:40:33:3B:9E:6C:9D:AA\r\na=setup:actpass\r\na=mid:0\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\na=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\r\na=recvonly\r\na=rtcp-mux\r\na=rtpmap:111 opus/48000/2\r\na=rtcp-fb:111 transport-cc\r\na=fmtp:111 minptime=10;useinbandfec=1\r\na=rtpmap:63 red/48000/2\r\na=fmtp:63 111/111\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:104 ISAC/32000\r\na=rtpmap:9 G722/8000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:106 CN/32000\r\na=rtpmap:105 CN/16000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:110 telephone-event/48000\r\na=rtpmap:112 telephone-event/32000\r\na=rtpmap:113 telephone-event/16000\r\na=rtpmap:126 telephone-event/8000\r\nm=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 122 102 121 127 120 125 107 108 109 35 36 124 119 123 118 114 115 116 37\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:oNct\r\na=ice-pwd:GJWkQy0xqNrNebrk6lpMCOWn\r\na=ice-options:trickle\r\na=fingerprint:sha-256 35:8D:B9:11:A1:39:DF:3C:99:39:54:53:38:03:D0:1B:A0:12:EC:60:01:69:56:8B:2B:40:33:3B:9E:6C:9D:AA\r\na=setup:actpass\r\na=mid:1\r\na=extmap:14 urn:ietf:params:rtp-hdrext:toffset\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:13 urn:3gpp:video-orientation\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:12 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\r\na=extmap:11 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type\r\na=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing\r\na=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/color-space\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\na=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\r\na=recvonly\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:96 VP8/90000\r\na=rtcp-fb:96 goog-remb\r\na=rtcp-fb:96 transport-cc\r\na=rtcp-fb:96 ccm fir\r\na=rtcp-fb:96 nack\r\na=rtcp-fb:96 nack pli\r\na=rtpmap:97 rtx/90000\r\na=fmtp:97 apt=96\r\na=rtpmap:98 VP9/90000\r\na=rtcp-fb:98 goog-remb\r\na=rtcp-fb:98 transport-cc\r\na=rtcp-fb:98 ccm fir\r\na=rtcp-fb:98 nack\r\na=rtcp-fb:98 nack pli\r\na=fmtp:98 profile-id=0\r\na=rtpmap:99 rtx/90000\r\na=fmtp:99 apt=98\r\na=rtpmap:100 VP9/90000\r\na=rtcp-fb:100 goog-remb\r\na=rtcp-fb:100 transport-cc\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 nack pli\r\na=fmtp:100 profile-id=2\r\na=rtpmap:101 rtx/90000\r\na=fmtp:101 apt=100\r\na=rtpmap:122 VP9/90000\r\na=rtcp-fb:122 goog-remb\r\na=rtcp-fb:122 transport-cc\r\na=rtcp-fb:122 ccm fir\r\na=rtcp-fb:122 nack\r\na=rtcp-fb:122 nack pli\r\na=fmtp:122 profile-id=1\r\na=rtpmap:102 H264/90000\r\na=rtcp-fb:102 goog-remb\r\na=rtcp-fb:102 transport-cc\r\na=rtcp-fb:102 ccm fir\r\na=rtcp-fb:102 nack\r\na=rtcp-fb:102 nack pli\r\na=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f\r\na=rtpmap:121 rtx/90000\r\na=fmtp:121 apt=102\r\na=rtpmap:127 H264/90000\r\na=rtcp-fb:127 goog-remb\r\na=rtcp-fb:127 transport-cc\r\na=rtcp-fb:127 ccm fir\r\na=rtcp-fb:127 nack\r\na=rtcp-fb:127 nack pli\r\na=fmtp:127 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f\r\na=rtpmap:120 rtx/90000\r\na=fmtp:120 apt=127\r\na=rtpmap:125 H264/90000\r\na=rtcp-fb:125 goog-remb\r\na=rtcp-fb:125 transport-cc\r\na=rtcp-fb:125 ccm fir\r\na=rtcp-fb:125 nack\r\na=rtcp-fb:125 nack pli\r\na=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f\r\na=rtpmap:107 rtx/90000\r\na=fmtp:107 apt=125\r\na=rtpmap:108 H264/90000\r\na=rtcp-fb:108 goog-remb\r\na=rtcp-fb:108 transport-cc\r\na=rtcp-fb:108 ccm fir\r\na=rtcp-fb:108 nack\r\na=rtcp-fb:108 nack pli\r\na=fmtp:108 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f\r\na=rtpmap:109 rtx/90000\r\na=fmtp:109 apt=108\r\na=rtpmap:35 AV1/90000\r\na=rtcp-fb:35 goog-remb\r\na=rtcp-fb:35 transport-cc\r\na=rtcp-fb:35 ccm fir\r\na=rtcp-fb:35 nack\r\na=rtcp-fb:35 nack pli\r\na=rtpmap:36 rtx/90000\r\na=fmtp:36 apt=35\r\na=rtpmap:124 H264/90000\r\na=rtcp-fb:124 goog-remb\r\na=rtcp-fb:124 transport-cc\r\na=rtcp-fb:124 ccm fir\r\na=rtcp-fb:124 nack\r\na=rtcp-fb:124 nack pli\r\na=fmtp:124 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d001f\r\na=rtpmap:119 rtx/90000\r\na=fmtp:119 apt=124\r\na=rtpmap:123 H264/90000\r\na=rtcp-fb:123 goog-remb\r\na=rtcp-fb:123 transport-cc\r\na=rtcp-fb:123 ccm fir\r\na=rtcp-fb:123 nack\r\na=rtcp-fb:123 nack pli\r\na=fmtp:123 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=64001f\r\na=rtpmap:118 rtx/90000\r\na=fmtp:118 apt=123\r\na=rtpmap:114 red/90000\r\na=rtpmap:115 rtx/90000\r\na=fmtp:115 apt=114\r\na=rtpmap:116 ulpfec/90000\r\na=rtpmap:37 flexfec-03/90000\r\na=rtcp-fb:37 goog-remb\r\na=rtcp-fb:37 transport-cc\r\na=fmtp:37 repair-window=10000000\r\n
[2021-12-07 09:10:34.717][Trace][1][i9a3611q] RTC local answer: v=0\r\no=SRS/4.0.136(Leo) 151564784 2 IN IP4 0.0.0.0\r\ns=SRSPlaySession\r\nt=0 0\r\na=ice-lite\r\na=group:BUNDLE 0 1\r\na=msid-semantic: WMS live/ID0602181091342260950842/NoLVLbNr\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:tcc99f37\r\na=ice-pwd:prje522o2821285o9o3b964j0591tmti\r\na=fingerprint:sha-256 5E:23:1E:56:68:73:49:D9:37:38:EA:1A:6C:6D:6D:9D:C2:F3:AE:ED:03:0B:07:C6:67:57:30:DF:6D:00:AF:5D\r\na=setup:passive\r\na=mid:0\r\na=sendonly\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:111 opus/48000/2\r\na=ssrc:28612 cname:6v84vb3d4e665877\r\na=ssrc:28612 label:audio-210wo838\r\na=candidate:0 1 udp 2130706431 127.0.0.1 8000 typ host generation 0\r\nm=video 9 UDP/TLS/RTP/SAVPF 125\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:tcc99f37\r\na=ice-pwd:prje522o2821285o9o3b964j0591tmti\r\na=fingerprint:sha-256 5E:23:1E:56:68:73:49:D9:37:38:EA:1A:6C:6D:6D:9D:C2:F3:AE:ED:03:0B:07:C6:67:57:30:DF:6D:00:AF:5D\r\na=setup:passive\r\na=mid:1\r\na=sendonly\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:125 H264/90000\r\na=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f\r\na=ssrc:28613 cname:6v84vb3d4e665877\r\na=ssrc:28613 label:video-8g582864\r\na=candidate:0 1 udp 2130706431 36.134.81.7 8000 typ host generation 0\r\n
[2021-12-07 09:10:34.718][Trace][1][i9a3611q] TCP: before dispose resource(HttpConn)(0x212f0a0), conns=25, zombies=0, ign=0, inz=0, ind=0
[2021-12-07 09:10:34.718][Trace][1][i9a3611q] client finished.
[2021-12-07 09:10:34.718][Trace][1][126wc2rt] TCP: clear zombies=1 resources, conns=25, removing=0, unsubs=0
[2021-12-07 09:10:34.718][Trace][1][i9a3611q] TCP: disposing #0 resource(HttpConn)(0x212f0a0), conns=25, disposing=1, zombies=0
[2021-12-07 09:10:34.724][Trace][1][i9a3611q] RTC: session address init 223.83.155.124:63687
[2021-12-07 09:10:34.724][Trace][1][i9a3611q] RTC: session STUN done, waiting DTLS handshake.
[2021-12-07 09:10:34.728][Trace][1][i9a3611q] DTLS: State Passive RECV, done=0, arq=0/0, r0=1, r1=0, len=157, cnt=22, size=144, hs=1
[2021-12-07 09:10:34.728][Trace][1][i9a3611q] DTLS: State Passive SEND, done=0, arq=0/0, r0=-1, r1=2, len=679, cnt=22, size=82, hs=2
[2021-12-07 09:10:34.737][Trace][1][i9a3611q] DTLS: State Passive RECV, done=0, arq=0/0, r0=1, r1=0, len=579, cnt=22, size=300, hs=11
[2021-12-07 09:10:34.738][Trace][1][i9a3611q] DTLS: State Passive SEND, done=1, arq=0/0, r0=1, r1=0, len=554, cnt=22, size=466, hs=4
[2021-12-07 09:10:34.738][Trace][1][i9a3611q] RTC: DTLS handshake done.
[2021-12-07 09:10:34.738][Trace][1][i9a3611q] RTC: session pub=0, sub=1, to=30000ms connection established
[2021-12-07 09:10:34.738][Trace][1][i9a3611q] RTC: Subscriber url=/live/ID0602181091342260950842/NoLVLbNr established
[2021-12-07 09:10:34.738][Trace][1][i9a3611q] create consumer, no gop cache
[2021-12-07 09:10:34.738][Trace][1][i9a3611q] RTC: start play url=/live/ID0602181091342260950842/NoLVLbNr, source_id=/, realtime=1, mw_msgs=0
xxxxxxxxxxxx

  1. SRS configuration:
# main config for srs.
# @see full.conf for detail config.

listen              1936;
max_connections     1000;
srs_log_tank        console;
daemon              on;
http_api {
    enabled         on;
    listen          1986;

   # crossdomain     on;
}
http_server {
    enabled         on;
    listen          8080;
    dir             ./objs/nginx/html;
}
stats {
    network         0;
    disk            sda sdb xvda xvdb;
}

rtc_server {
    enabled         on;
    # Listen at udp://8000
    listen          8000;
    #
    # The $CANDIDATE means fetch from env, if not configed, use * as default.
    #
    # The * means retrieving server IP automatically, from all network interfaces,
    # @see https://github.com/ossrs/srs/issues/307#issuecomment-599028124
    candidate       $CANDIDATE;
}
vhost __defaultVhost__ {
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
        hstrs       on;
    }

    forward {
        enabled on;
        destination 192.168.0.11:1938;
    }

    play {
        atc                     on;
        mix_correct             on;
    }

    rtc {
        enabled     on;
        bframe      discard;
    }

    dvr {
        enabled         on;
        dvr_apply       all;
        dvr_plan        segment;
        dvr_path        ./objs/nginx/html/dvr/[app]/[stream]/[stream].[timestamp].flv;
        dvr_duration    30;
        dvr_wait_keyframe       on;
        time_jitter     full;
    }

    http_hooks {
        enabled         on;

        on_play         http://192.168.0.11:5000/api/v1/StreamServer/OnCallBack;
    }

    transcode {
        enabled off;
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
        engine mobile_90 {
            enabled on;
            vfilter;
            vcodec libx264;
            vbitrate 128;
            vfps 25;
            vwidth 160;
            vheight 90;
            vthreads 3;
            vprofile high;
            vpreset medium;
            vparams;
            acodec libfdk_aac;
            abitrate 70;
            asample_rate 44100;
            achannels 2;
            aparams;
            output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
        }
        engine mobile_270 {
            enabled on;
            vfilter;
            vcodec libx264;
            vbitrate 512;
            vfps 25;
            vwidth 480;
            vheight 270;
            vthreads 3;
            vprofile high;
            vpreset medium;
            vparams;
            acodec libfdk_aac;
            abitrate 70;
            asample_rate 44100;
            achannels 2;
            aparams;
            output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
        }
    }

}


Replay

How to replay bug?

Steps to replay the bug:

  1. Start SRS with the above configuration.
  2. Play WebRTC video with token.
  3. Invalid authentication.

Expected Behavior

WebRTC effectively uses http hook

TRANS_BY_GPT3

@winlinvip winlinvip changed the title WebRTC如何进行鉴权 WebRTC: HTTP Callback没有生效,无法鉴权 Dec 8, 2021
@winlinvip winlinvip added API HTTP-API, HTTP-Callback, etc. Bug It might be a bug. labels Dec 8, 2021
@winlinvip winlinvip added this to the 4.0 milestone Dec 8, 2021
@winlinvip
Copy link
Member

winlinvip commented Dec 8, 2021

The version is too old, try upgrading to the latest version.

TRANS_BY_GPT3

@winlinvip winlinvip removed the Bug It might be a bug. label Dec 8, 2021
@winlinvip winlinvip removed this from the 4.0 milestone Dec 8, 2021
@Cyaim
Copy link
Author

Cyaim commented Dec 8, 2021

Should we directly pull the b0 or pull the 4.0 release code and recompile it in Docker? Can we merge h265?

TRANS_BY_GPT3

@Cyaim
Copy link
Author

Cyaim commented Dec 8, 2021

Tested and confirmed effective SRS/4.0.201

[2021-12-08 03:18:25.149][Trace][1][999t5o91] TCP: before dispose resource(HttpConn)(0x3ed2730), conns=26, zombies=0, ign=0, inz=0, ind=0
[2021-12-08 03:18:25.149][Trace][1][999t5o91] client finished.
[2021-12-08 03:18:25.149][Trace][1][sa688i9c] TCP: clear zombies=1 resources, conns=26, removing=0, unsubs=0
[2021-12-08 03:18:25.149][Trace][1][999t5o91] TCP: disposing #0 resource(HttpConn)(0x3ed2730), conns=26, disposing=1, zombies=0
[2021-12-08 03:18:26.040][Trace][1][3b820sc4] HTTP #0 192.168.1.7:55451 POST http://127.0.0.1/rtc/v1/play/, content-length=4439
[2021-12-08 03:18:26.041][Trace][1][y766i61l] HTTP #0 192.168.1.7:55453 POST http://127.0.0.1/rtc/v1/play/, content-length=4439
[2021-12-08 03:18:26.041][Trace][1][22759gto] HTTP #0 192.168.1.7:55452 POST http://127.0.0.1/rtc/v1/play/, content-length=4439
[2021-12-08 03:18:26.042][Trace][1][92i5q1mu] HTTP #0 192.168.1.7:55454 POST http://127.0.0.1/rtc/v1/play/, content-length=4439
[2021-12-08 03:18:26.043][Warn][1][3b820sc4][0] RTC error code=4005 : RTC: http_hooks_on_play : on_play http://192.168.0.11:5000/api/v1/StreamServer/OnCallBack : http: on_play failed, client_id=3b820sc4, url=http://192.168.0.11:5000/api/v1/StreamServer/OnCallBack, request={"server_id":"vid-2010y25","action":"on_play","client_id":"3b820sc4","ip":"223.83.155.124","vhost":"defaultVhost","app":"live","stream":"ID0602181091342271250873","param":"","pageUrl":""}, response={"type":"https://tools.ietf.org/html/rfc7231#section-6.5.1","title":"One or more validation errors occurred.","status":400,"traceId":"00-abbc1171bf78f7d02c615afa4fcfce06-86b008eed0272a73-00","errors":{"$.client_id":["The JSON value could not be converted to System.Nullable`1[System.Int32]. Path: $.client_id | LineNumber: 0 | BytePositionInLine: 68."]}}, status=400 : http: status 400
thread [1][3b820sc4]: do_serve_http() [src/app/srs_app_rtc_api.cpp:133][errno=0]
thread [1][3b820sc4]: http_hooks_on_play() [src/app/srs_app_rtc_api.cpp:274][errno=0]
thread [1][3b820sc4]: on_play() [src/app/srs_app_http_hooks.cpp:224][errno=0]
thread [1][3b820sc4]: do_post() [src/app/srs_app_http_hooks.cpp:516][errno=0]

TRANS_BY_GPT3

@Cyaim
Copy link
Author

Cyaim commented Dec 8, 2021

The handling of RTC callback information seems to have occasional issues. The actual properties for Stream and App should be maintained.
App:live Stream:ID0602181091342360960853

{"Action":"on_play","Client_Id":"754z4331","IP":"127.0.0.1","Vhost":"defaultVhost","App":"live/ID0602181091342360960853","Stream":"aEQJIgUB","Param":"?token=3LUOEAwOpObmRGS/oJoZ353NFB4hEGvnfFC+hXUEiYUy1rNTPZv2kzxoQGdreqUxQ2LAqH7jLi6daBoYz10ald9","Send_bytes":null,"Recv_bytes":null,"TcUrl":null,"PageUrl":"","Cwd":null,"File":null}

The actual properties should be:
{"Action":"on_play","Client_Id":"ew5m380j","IP":"127.0.0.1","Vhost":"defaultVhost","App":"live","Stream":"ID0602181091342360960853","Param":"?token=IZOLadRRLwfqPw+Lgj8au8DYaeID20yhsMJdrXEr5NmAqKZPEr+7kLGNjE3xnlgiBLWIJqPcGA9rx6emCPhrQcPAOsd8sT6d","Send_bytes":null,"Recv_bytes":null,"TcUrl":null,"PageUrl":"","Cwd":null,"File":null}

TRANS_BY_GPT3

@duiniuluantanqin
Copy link
Member

duiniuluantanqin commented Dec 8, 2021

3LUOEAwOpObmRGS/oJoZ353NFB4hEGvnfFC+hXUEiYUy1rNTPZv2kzxoQGdreqUxQ2LAqH7jLi6daBoYz10ald9
Is this token for the publisher?

TRANS_BY_GPT3

@Cyaim
Copy link
Author

Cyaim commented Dec 8, 2021

webrtc://127.0.0.1/live/ID0602181091342271250873?token=IZOLadRRLwfqPw+Lgj8au8DYaeID20yhsMJdrXEr5NmAqKZPEr+7kLGNjE3xnlgiBLWIJqPcGA9rx6emCPhrQcPAOsd8sT6d

[2021-12-08 06:09:09.018][Warn][1][6831u6vd][0] RTC error code=3008 : RTC: http_hooks_on_play : on_play http://192.168.0.11:5000/api/v1/StreamServer/OnCallBack : http: on_play failed, client_id=6831u6vd, url=http://192.168.0.11:5000/api/v1/StreamServer/OnCallBack, request={"server_id":"vid-1h15295","action":"on_play","client_id":"6831u6vd","ip":"223.83.155.124","vhost":"defaultVhost","app":"live/ID0602181091342361170874","stream":"WhoXeDmxQxqDukIutEXI6FQ0psXdBSXQWDdTQ99dY","param":"?token=0emw+WhUdoKA8YyV9FPIGqa4dvOj/K0/5sIk2RqXrvTRVobZOHVcxm","pageUrl":""}, response=1, status=200 : http: response number code 1
thread [1][6831u6vd]: do_serve_http() [src/app/srs_app_rtc_api.cpp:133][errno=0]
thread [1][6831u6vd]: http_hooks_on_play() [src/app/srs_app_rtc_api.cpp:274][errno=0]
thread [1][6831u6vd]: on_play() [src/app/srs_app_http_hooks.cpp:224][errno=0]
thread [1][6831u6vd]: do_post() [src/app/srs_app_http_hooks.cpp:536][errno=0]
[2021-12-08 06:09:09.018][Trace][1][6831u6vd] TCP: before dispose resource(HttpConn)(0x26d1040), conns=27, zombies=1, ign=0, inz=0, ind=0
[2021-12-08 06:09:09.018][Trace][1][6831u6vd] client finished.
[2021-12-08 06:09:09.018][Trace][1][78b5mj4p] TCP: clear zombies=2 resources, conns=27, removing=0, unsubs=0
[2021-12-08 06:09:09.018][Trace][1][6z448ah8] TCP: disposing #0 resource(HttpConn)(0x265b6b0), conns=27, disposing=2, zombies=0
[2021-12-08 06:09:09.018][Trace][1][6831u6vd] TCP: disposing #1 resource(HttpConn)(0x26d1040), conns=26, disposing=2, zombies=0
[2021-12-08 06:09:09.025][Trace][1][72290d45] HTTP #0 192.168.1.7:62069 POST http://127.0.0.1/rtc/v1/play/?token=0emw+WhUdoKA8YyV9FPIGqa4dvOj/K0/5sIk2RqXrvTRVobZOHVcxm/WhoXeDmxQxqDukIutEXI6FQ0psXdBSXQWDdTQ99dY, content-length=5958
[2021-12-08 06:09:09.027][Warn][1][72290d45][0] RTC error code=3008 : RTC: http_hooks_on_play : on_play http://192.168.0.11:5000/api/v1/StreamServer/OnCallBack : http: on_play failed, client_id=72290d45, url=http://192.168.0.11:5000/api/v1/StreamServer/OnCallBack, request={"server_id":"vid-1h15295","action":"on_play","client_id":"72290d45","ip":"223.83.155.124","vhost":"defaultVhost","app":"live/ID0602181091342361160873","stream":"WhoXeDmxQxqDukIutEXI6FQ0psXdBSXQWDdTQ99dY","param":"?token=0emw+WhUdoKA8YyV9FPIGqa4dvOj/K0/5sIk2RqXrvTRVobZOHVcxm","pageUrl":""}, response=1, status=200 : http: response number code 1
thread [1][72290d45]: do_serve_http() [src/app/srs_app_rtc_api.cpp:133][errno=0]
thread [1][72290d45]: http_hooks_on_play() [src/app/srs_app_rtc_api.cpp:274][errno=0]
thread [1][72290d45]: on_play() [src/app/srs_app_http_hooks.cpp:224][errno=0]
thread [1][72290d45]: do_post() [src/app/srs_app_http_hooks.cpp:536][errno=0]
[2021-12-08 06:09:09.027][Trace][1][72290d45] TCP: before dispose resource(HttpConn)(0x2ae1d50), conns=26, zombies=0, ign=0, inz=0, ind=0
[2021-12-08 06:09:09.027][Trace][1][72290d45] client finished.
[2021-12-08 06:09:09.027][Trace][1][78b5mj4p] TCP: clear zombies=1 resources, conns=26, removing=0, unsubs=0
[2021-12-08 06:09:09.027][Trace][1][72290d45] TCP: disposing #0 resource(HttpConn)(0x2ae1d50), conns=26, disposing=1, zombies=0
[2021-12-08 06:09:09.036][Trace][1][2822684i] HTTP #0 192.168.1.7:62070 POST http://127.0.0.1/rtc/v1/play/?token=0emw+WhUdoKA8YyV9FPIGqa4dvOj/K0/5sIk2RqXrvTRVobZOHVcxm/WhoXeDmxQxqDukIutEXI6FQ0psXdBSXQWDdTQ99dY, content-length=5958
[2021-12-08 06:09:09.039][Warn][1][2822684i][0] RTC error code=3008 : RTC: http_hooks_on_play : on_play http://192.168.0.11:5000/api/v1/StreamServer/OnCallBack : http: on_play failed, client_id=2822684i, url=http://192.168.0.11:5000/api/v1/StreamServer/OnCallBack, request={"server_id":"vid-1h15295","action":"on_play","client_id":"2822684i","ip":"223.83.155.124","vhost":"defaultVhost","app":"live/ID0602181091342360960853","stream":"WhoXeDmxQxqDukIutEXI6FQ0psXdBSXQWDdTQ99dY","param":"?token=0emw+WhUdoKA8YyV9FPIGqa4dvOj/K0/5sIk2RqXrvTRVobZOHVcxm","pageUrl":""}, response=1, status=200 : http: response number code 1
thread [1][2822684i]: do_serve_http() [src/app/srs_app_rtc_api.cpp:133][errno=0]
thread [1][2822684i]: http_hooks_on_play() [src/app/srs_app_rtc_api.cpp:274][errno=0]
thread [1][2822684i]: on_play() [src/app/srs_app_http_hooks.cpp:224][errno=0]

@Cyaim
Copy link
Author

Cyaim commented Dec 8, 2021

The token generated by PKCS may contain slashes ("/"). The actual behavior of the streaming media service may mistakenly truncate the slashes ("/"), but the mainstream token generation method is PKCS...

TRANS_BY_GPT3

@duiniuluantanqin
Copy link
Member

duiniuluantanqin commented Dec 8, 2021

That is a compatibility issue with the format.

TRANS_BY_GPT3

@Cyaim
Copy link
Author

Cyaim commented Dec 8, 2021

Indeed

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Dec 10, 2021

This requires encoding the QueryString, a simple way to bypass it is to URL encode and give it to SRS.

A better approach is to encode the URL when SRS callback occurs, referring to the handling in JS or Go.

TRANS_BY_GPT3

@winlinvip winlinvip changed the title WebRTC: HTTP Callback没有生效,无法鉴权 WebRTC: HTTP Callback did not take effect, unable to authenticate Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
@winlinvip winlinvip changed the title WebRTC: HTTP Callback did not take effect, unable to authenticate WebRTC: HTTP Callback unable to authenticate by special chars May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API HTTP-API, HTTP-Callback, etc. TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

3 participants