RTSP: improved RTP parser

- fix HTTP header parsing to report incomplete
  lines it buffers as consumed!
- re-implement the RTP parser for interleave RTP
  messages for robustness. It is now keeping its
  state at the connection
- RTSP protocol handler "readwrite" implementation
  now tracks if the response is before/in/after
  header parsing or "in" a bod by calling
  "Curl_http_readwrite_headers()" itself. This
  allows it to know when non-RTP bytes are "junk"
  or HEADER or BODY.
- tested with #12035 and various small receive
  sizes where current master fails

Closes #12052
This commit is contained in:
Stefan Eissing 2023-10-07 15:13:09 +02:00 committed by Daniel Stenberg
parent 117c9bd978
commit 7eb31c852d
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
4 changed files with 280 additions and 160 deletions

View file

@ -39,6 +39,12 @@ CURLcode Curl_rtsp_parseheader(struct Curl_easy *data, char *header);
#endif /* CURL_DISABLE_RTSP */
typedef enum {
RTP_PARSE_SKIP,
RTP_PARSE_CHANNEL,
RTP_PARSE_LEN,
RTP_PARSE_DATA
} rtp_parse_st;
/*
* RTSP Connection data
*
@ -47,6 +53,9 @@ CURLcode Curl_rtsp_parseheader(struct Curl_easy *data, char *header);
struct rtsp_conn {
struct dynbuf buf;
int rtp_channel;
size_t rtp_len;
rtp_parse_st state;
BIT(in_header);
};
/****************************************************************************