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

Enhance HTTP Streaming, HTTP Callback, HTTP API for HTTP-FLV, HTTPS, HLS etc. #1657

Closed
winlinvip opened this issue Mar 21, 2020 · 8 comments · Fixed by #2509 or #2578
Closed

Enhance HTTP Streaming, HTTP Callback, HTTP API for HTTP-FLV, HTTPS, HLS etc. #1657

winlinvip opened this issue Mar 21, 2020 · 8 comments · Fixed by #2509 or #2578
Assignees
Labels
Enhancement Improvement or enhancement. Feature It's a new feature. TransByAI Translated by AI/GPT.
Milestone

Comments

@winlinvip
Copy link
Member

winlinvip commented Mar 21, 2020

SRS supports several applications over HTTP.

If SRS4 or SRS5 enhance the capabilities of HTTP streaming services, it would be more convenient to use and provide stronger consistency.

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

winlinvip commented Nov 2, 2020

There is a work-around:

Use nginx or go-oryx/httpx-static to convert HTTP to HTTPS, or HTTPS Live Streaming and HTTPS-FLV in practice.

Whatever, SRS will support HTTPS client and server inside.

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

winlinvip commented Nov 3, 2020

HTTPS Client protocol:

HTTP callback support HTTPS server, for example, conf/https.hooks.callback.conf:

vhost __defaultVhost__ {
    http_hooks {
        enabled         on;
        on_connect      https://127.0.0.1:443/api/v1/clients;
    }
}

The log of SRS, for https-client:

[2020-11-03 15:47:58.645][Trace][4715][h6r1ehdh] RTMP client ip=127.0.0.1:61658, fd=10
[2020-11-03 15:52:35.021][Trace][5547][2m457139] https: connected to https://127.0.0.1:443, cost=6ms
[2020-11-03 15:47:58.658][Trace][4715][h6r1ehdh] http: on_connect ok, client_id=h6r1ehdh, 
url=https://127.0.0.1:443/api/v1/clients, request={"action":"on_connect", 
"client_id":"h6r1ehdh","ip":"127.0.0.1","vhost":"__defaultVhost__","app":"live",
"tcUrl":"rtmp://127.0.0.1:1935/live","pageUrl":""}, 
response={"code": 0, "data": null}

Note: The wireshark capture file for HTTPS client: https-client.pcapng.zip

Note: Refer to OpenSSL example using memory BIO with non-blocking socket IO.

winlinvip added a commit that referenced this issue Nov 3, 2020
winlinvip added a commit that referenced this issue Nov 3, 2020
winlinvip added a commit that referenced this issue Nov 3, 2020
winlinvip added a commit that referenced this issue Nov 4, 2020
winlinvip added a commit that referenced this issue Nov 5, 2020
winlinvip added a commit that referenced this issue Nov 5, 2020
winlinvip added a commit that referenced this issue Nov 5, 2020
winlinvip added a commit that referenced this issue Nov 5, 2020
winlinvip added a commit that referenced this issue Nov 5, 2020
winlinvip added a commit that referenced this issue Nov 5, 2020
winlinvip added a commit that referenced this issue Nov 5, 2020
winlinvip added a commit that referenced this issue Nov 5, 2020
@winlinvip
Copy link
Member Author

winlinvip commented Nov 6, 2020

HTTPS API server protocol:

Config for HTTPS API, for example, conf/https.rtc.conf:

http_api {
    enabled         on;
    listen          1985;
    # For https_api or HTTPS API.
    https {
        # Whether enable HTTPS API.
        # default: off
        enabled on;
        # The listen endpoint for HTTPS API.
        # default: 1990
        listen 1990;
        # The SSL private key file, generated by:
        #       openssl genrsa -out server.key 2048
        # default: ./conf/server.key
        key ./conf/server.key;
        # The SSL public cert file, generated by:
        #       openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net"
        # default: ./conf/server.crt
        cert ./conf/server.crt;
    }
}

Open in Chrome:

The SRS logs:

[2020-11-06 17:14:10.700][Trace][21509][551p56t8] https: api server done, use key 
./conf/server.key and cert ./conf/server.crt, cost=5ms
[2020-11-06 17:14:10.700][Trace][21509][551p56t8] HTTP #0 127.0.0.1:62381 GET 
https://127.0.0.1:1990/api/v1/versions, content-length=-1

# For self-sign certificate, there is always a error:
[2020-11-06 17:17:35.939][Error][21509][551p56t8][0] serve error code=4042 : start : handshake : handshake r0=-1, r1=1
thread [21509][551p56t8]: do_cycle() [src/app/srs_app_http_conn.cpp:170][errno=0]
thread [21509][551p56t8]: on_start() [src/app/srs_app_http_api.cpp:1710][errno=0]
thread [21509][551p56t8]: handshake() [src/app/srs_app_conn.cpp:624][errno=0]

Note: Capture files https-server-port-1443.pcapng.zip, https-server.pcapng.zip

Note: Refer to OpenSSL example using memory BIO with non-blocking socket IO.

winlinvip added a commit that referenced this issue Nov 6, 2020
winlinvip added a commit that referenced this issue Nov 6, 2020
winlinvip added a commit that referenced this issue Nov 6, 2020
winlinvip added a commit that referenced this issue Nov 6, 2020
winlinvip added a commit that referenced this issue Nov 6, 2020
winlinvip added a commit that referenced this issue Nov 6, 2020
winlinvip added a commit that referenced this issue Nov 6, 2020
@winlinvip
Copy link
Member Author

winlinvip commented Dec 1, 2020

It is worth doing well and mastering the basics of HTTP.

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

winlinvip commented May 14, 2021

All HTTP-API related issues should be consolidated and updated in this issue. Please ensure that the markdown structure is maintained.

  • HTTP API does not count the number of WebRTC distributed streams (i.e., the number of clients) - Issue #2290
  • Abnormal result of HTTP interface in SRS 4.0 version - Issue #2231
  • How to obtain WebRTC client information when streaming with SRS RTMP and watching with WebRTC - only able to obtain streaming information in the console - Issue #2149
  • HTTP API in version 2.0.243 does not count HLS clients - Issue #996
  • APPLICATION: When using HTTP-FLV playback, traffic statistics are incorrect when using SRS HTTP API, although the client connection count is correct - Issue #863

Please ensure that the markdown structure is maintained.

TRANS_BY_GPT3

winlinvip pushed a commit that referenced this issue Aug 10, 2021
* support http hooks for rtc: on_play/stop/publish/unpublish

* Update srs_app_rtc_conn.cpp

* Update srs_app_rtc_conn.cpp
@winlinvip winlinvip added the Enhancement Improvement or enhancement. label Aug 23, 2021
@winlinvip winlinvip changed the title Enhance HTTP Stream Server for HTTP-FLV, HTTPS, HLS etc. Enhance HTTP Streaming, HTTP Callback, HTTP API for HTTP-FLV, HTTPS, HLS etc. Aug 23, 2021
@peipeiguo
Copy link

peipeiguo commented Aug 26, 2021

Looking forward to SRS4 supporting HLS client statistics and HLS on_play/on_stop callbacks.

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

Fixed in SRS 4

@winlinvip winlinvip modified the milestones: 5.0, 4.0 Jan 2, 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
Enhancement Improvement or enhancement. Feature It's a new feature. TransByAI Translated by AI/GPT.
Projects
None yet
3 participants