Commit c1348506 authored by Andrey Utkin's avatar Andrey Utkin Committed by Luca Barbato

httpauth: Add space after commas in HTTP/RTSP auth header

This fixes access to Grandstream cameras, which return 401 otherwise.
VLC sends Authorization: header with spaces between parameters, and it
is known to work with Grandstream devices and broad range of other HTTP
and RTSP servers, so author considers switching to such behaviour safe.

See RFC 2617 (HTTP Auth).
Signed-off-by: 's avatarLuca Barbato <lu_zero@gentoo.org>
parent e55376a1
......@@ -220,18 +220,19 @@ static char *make_digest_auth(HTTPAuthState *state, const char *username,
/* TODO: Escape the quoted strings properly. */
av_strlcatf(authstr, len, "username=\"%s\"", username);
av_strlcatf(authstr, len, ",realm=\"%s\"", state->realm);
av_strlcatf(authstr, len, ",nonce=\"%s\"", digest->nonce);
av_strlcatf(authstr, len, ",uri=\"%s\"", uri);
av_strlcatf(authstr, len, ",response=\"%s\"", response);
av_strlcatf(authstr, len, ", realm=\"%s\"", state->realm);
av_strlcatf(authstr, len, ", nonce=\"%s\"", digest->nonce);
av_strlcatf(authstr, len, ", uri=\"%s\"", uri);
av_strlcatf(authstr, len, ", response=\"%s\"", response);
if (digest->algorithm[0])
av_strlcatf(authstr, len, ",algorithm=%s", digest->algorithm);
av_strlcatf(authstr, len, ", algorithm=%s", digest->algorithm);
if (digest->opaque[0])
av_strlcatf(authstr, len, ",opaque=\"%s\"", digest->opaque);
av_strlcatf(authstr, len, ", opaque=\"%s\"", digest->opaque);
if (digest->qop[0]) {
av_strlcatf(authstr, len, ",qop=\"%s\"", digest->qop);
av_strlcatf(authstr, len, ",cnonce=\"%s\"", cnonce);
av_strlcatf(authstr, len, ",nc=%s", nc);
av_strlcatf(authstr, len, ", qop=\"%s\"", digest->qop);
av_strlcatf(authstr, len, ", cnonce=\"%s\"", cnonce);
av_strlcatf(authstr, len, ", nc=%s", nc);
}
av_strlcatf(authstr, len, "\r\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment