pipewire: rtsp-client: allow sending arbitrary binary data

Previously, the content had to be a null-terminated byte
sequence because the sending function used `strlen()` to
determine its length. However, `rtsp_do_auth_setup()` needs
to send a non-textual byte sequence, and it only worked so
far because it did not happen to have any zero bytes in it.
Add a "content_length" parameter and change the type of
"content" to facilitate sending arbitrary byte sequences.
This commit is contained in:
Barnabás Pőcze 2022-09-08 15:33:32 +02:00
parent e5ca5d0480
commit 2d7eb8678b
3 changed files with 13 additions and 8 deletions

View file

@ -1072,13 +1072,14 @@ static void rtsp_auth_setup_reply(void *data, int status, const struct spa_dict
static int rtsp_do_auth_setup(struct impl *impl)
{
static const char content[] =
static const unsigned char content[33] =
"\x01"
"\x59\x02\xed\xe9\x0d\x4e\xf2\xbd\x4c\xb6\x8a\x63\x30\x03\x82\x07"
"\xa9\x4d\xbd\x50\xd8\xaa\x46\x5b\x5d\x8c\x01\x2a\x0c\x7e\x1d\x4e";
return pw_rtsp_client_url_send(impl->rtsp, "/auth-setup", "POST", &impl->headers->dict,
"application/octet-stream", content, rtsp_auth_setup_reply, impl);
"application/octet-stream", content, sizeof(content),
rtsp_auth_setup_reply, impl);
}
static const char *find_attr(char **tokens, const char *key)