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

When using HTTP GET to access the WHIP API, the error codes are not accurate. #3838

Closed
winlinvip opened this issue Oct 16, 2023 · 1 comment
Assignees
Labels
good first issue Easy to fix issues, good for newcomers TransByAI Translated by AI/GPT. WebRTC WebRTC, RTC2RTMP or RTMP2RTC.

Comments

@winlinvip
Copy link
Member

winlinvip commented Oct 16, 2023

Describe the bug
Normally, users should access the WHIP API using HTTP POST. But sometimes, users might habitually paste the WHIP API into the browser to access it. In this case, the error logs from SRS are not very clear, and there isn't a clear error response either.

Version
SRS 5.0 and 6.0

To Reproduce
Steps to reproduce the behavior:

  1. Run SRS by ./objs/srs -c conf/console.conf
  2. Use curl to request WHIP API: curl -v 'http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream'
  3. The response is not clear:
curl -v 'http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream'
*   Trying 127.0.0.1:1985...
* Connected to localhost (127.0.0.1) port 1985 (#0)
> GET /rtc/v1/whip/?app=live&stream=livestream HTTP/1.1
> Host: localhost:1985
> User-Agent: curl/8.1.2
> Accept: */*
> 
* Empty reply from server
* Closing connection 0
curl: (52) Empty reply from server
  1. SRS error is not clear:
[2023-10-16 08:56:29.205][INFO][50045][1np2j16n] HTTP #0 127.0.0.1:58926 GET http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream, content-length=-1
[2023-10-16 08:56:29.206][INFO][50045][1np2j16n] RTC whip publish /live/livestream, clientip=127.0.0.1, app=live, stream=livestream, offer=0B, eip=, codec=, srtp=, dtls=, ufrag=, pwd=, param=app=live&stream=livestream
[2023-10-16 08:56:29.206][INFO][50045][1np2j16n] TCP: before dispose resource(HttpConn)(0x607000003f20), conns=1, zombies=0, ign=0, inz=0, ind=0
[2023-10-16 08:56:29.207][ERROR][50045][1np2j16n][35] serve error code=5018(RtcSdpNegotiate)(RTC do SDP negotiate failed) : process request=0 : cors serve : serve http : serve : serve : remote sdp check failed : now only support BUNDLE, group policy=
thread [50045][1np2j16n]: process_requests() [./src/app/srs_app_http_conn.cpp:209][errno=35]
thread [50045][1np2j16n]: process_request() [./src/app/srs_app_http_conn.cpp:236][errno=35]
thread [50045][1np2j16n]: serve_http() [./src/protocol/srs_protocol_http_stack.cpp:768][errno=35]
thread [50045][1np2j16n]: serve_http() [./src/app/srs_app_rtc_api.cpp:628][errno=35]
thread [50045][1np2j16n]: do_serve_http() [./src/app/srs_app_rtc_api.cpp:739][errno=35]
thread [50045][1np2j16n]: serve_http() [./src/app/srs_app_rtc_api.cpp:470][errno=35]
thread [50045][1np2j16n]: check_remote_sdp() [./src/app/srs_app_rtc_api.cpp:529][errno=35](Resource temporarily unavailable)

Expected behavior
SRS should use more specific error codes, instead of the current now only support BUNDLE.
SRS should return error codes and messages in the HTTP Response.

Additional context
Note: Previously, no error response was returned, primarily for simplicity. Also, when returning a response, sensitive information needs to be avoided. There were many factors to consider, so detailed error messages were not returned.

TRANS_BY_GPT4

@winlinvip winlinvip added the good first issue Easy to fix issues, good for newcomers label Oct 16, 2023
@winlinvip winlinvip changed the title 使用HTTP GET访问WHIP API时,错误码不准确 When using HTTP GET to access the WHIP API, the error codes are not accurate. Oct 16, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Oct 16, 2023
@winlinvip
Copy link
Member Author

Fixed.

@winlinvip winlinvip self-assigned this Mar 24, 2024
@winlinvip winlinvip added the WebRTC WebRTC, RTC2RTMP or RTMP2RTC. label Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Easy to fix issues, good for newcomers TransByAI Translated by AI/GPT. WebRTC WebRTC, RTC2RTMP or RTMP2RTC.
Projects
None yet
Development

No branches or pull requests

1 participant