aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Utkin <andrey.utkin@corp.bluecherry.net>2015-10-13 12:44:37 +0300
committerLuca Barbato <lu_zero@gentoo.org>2015-10-14 14:35:34 +0200
commitc1348506697377b46f844339c178332e3314149a (patch)
tree17ed4a213fadb9e730cc111cea508d5e64dd3aeb
parente55376a1fd5abebbb0a082aa20739d58c2260a37 (diff)
downloadffmpeg-c1348506697377b46f844339c178332e3314149a.tar.gz
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: Luca Barbato <lu_zero@gentoo.org>
-rw-r--r--libavformat/httpauth.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/libavformat/httpauth.c b/libavformat/httpauth.c
index b96da3ef12..b0d3c0c8ca 100644
--- a/libavformat/httpauth.c
+++ b/libavformat/httpauth.c
@@ -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");