rtsp: refactor method handling and improve error checks

- convert the method switch() to a simple table

- avoid converting the methods from external to internal numbers, they were
  the same anyway so keep the external ones, just use the old defines.

- fix range check. It wrongly used the method numbers as bitmask, which made
  the check not work previously. Also error on OOM.

- Dropped the session-id check. It too wrongly did a bitmask check which was
  wrong and never worked. When fixed, it broke test cases so I dropped the
  entire check.

- split out rtsp_setup_request() from rtsp_do()

- replace the httpversion variable with a define

Closes #22505
This commit is contained in:
Daniel Stenberg 2026-08-05 23:40:18 +02:00
parent a478393759
commit 26b9f3aa9b
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 167 additions and 204 deletions

View file

@ -30,4 +30,18 @@ extern const struct Curl_protocol Curl_protocol_rtsp;
#define Curl_rtsp_parseheader(x, y) CURLE_NOT_BUILT_IN
#endif
#define RTSPREQ_NONE CURL_RTSPREQ_NONE
#define RTSPREQ_OPTIONS CURL_RTSPREQ_OPTIONS
#define RTSPREQ_DESCRIBE CURL_RTSPREQ_DESCRIBE
#define RTSPREQ_ANNOUNCE CURL_RTSPREQ_ANNOUNCE
#define RTSPREQ_SETUP CURL_RTSPREQ_SETUP
#define RTSPREQ_PLAY CURL_RTSPREQ_PLAY
#define RTSPREQ_PAUSE CURL_RTSPREQ_PAUSE
#define RTSPREQ_TEARDOWN CURL_RTSPREQ_TEARDOWN
#define RTSPREQ_GET_PARAMETER CURL_RTSPREQ_GET_PARAMETER
#define RTSPREQ_SET_PARAMETER CURL_RTSPREQ_SET_PARAMETER
#define RTSPREQ_RECORD CURL_RTSPREQ_RECORD
#define RTSPREQ_RECEIVE CURL_RTSPREQ_RECEIVE
#define RTSPREQ_LAST CURL_RTSPREQ_LAST
#endif /* HEADER_CURL_RTSP_H */