diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-07-26 21:36:03 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-07-26 21:37:15 +0200 |
commit | 7333798c85837f1cf175f39bc4acb5664fa6cacc (patch) | |
tree | 60036638a0962b3cb966d62da2eda81f93ac3267 /libavformat/httpauth.c | |
parent | 307a20cca216356aec30f5bb102c633169cbc0c1 (diff) | |
parent | 44dc9c6af0377faf2a99889d1f949e32a1102e84 (diff) | |
download | ffmpeg-7333798c85837f1cf175f39bc4acb5664fa6cacc.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
libopenjpeg: support YUV and deep RGB pixel formats
Fix typo in v410 decoder.
vf_yadif: unset cur_buf on the input link.
vf_overlay: ensure the overlay frame does not get leaked.
vf_overlay: prevent premature freeing of cur_buf
Support urlencoded http authentication credentials
rtmp: Return an error when the client bandwidth is incorrect
rtmp: Return proper error code in handle_server_bw
rtmp: Return proper error code in handle_client_bw
rtmp: Return proper error codes in handle_chunk_size
lavr: x86: add missing vzeroupper in ff_mix_1_to_2_fltp_flt()
vp8: Replace x*155/100 by x*101581>>16.
vp3: don't use calls to inline asm in yasm code.
x86/dsputil: put inline asm under HAVE_INLINE_ASM.
dsputil_mmx: fix incorrect assembly code
rtmp: Factorize the code by adding handle_invoke
rtmp: Factorize the code by adding handle_chunk_size
rtmp: Factorize the code by adding handle_ping
rtmp: Factorize the code by adding handle_client_bw
rtmp: Factorize the code by adding handle_server_bw
Conflicts:
libavcodec/libopenjpegdec.c
libavcodec/x86/dsputil_mmx.c
libavfilter/vf_overlay.c
libavformat/Makefile
libavformat/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/httpauth.c')
-rw-r--r-- | libavformat/httpauth.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/libavformat/httpauth.c b/libavformat/httpauth.c index 86cdac7f07..646f909a0d 100644 --- a/libavformat/httpauth.c +++ b/libavformat/httpauth.c @@ -25,6 +25,7 @@ #include "internal.h" #include "libavutil/random_seed.h" #include "libavutil/md5.h" +#include "urldecode.h" #include "avformat.h" #include <ctype.h> @@ -251,18 +252,28 @@ char *ff_http_auth_create_response(HTTPAuthState *state, const char *auth, return NULL; if (state->auth_type == HTTP_AUTH_BASIC) { - int auth_b64_len = AV_BASE64_SIZE(strlen(auth)); - int len = auth_b64_len + 30; - char *ptr; + int auth_b64_len, len; + char *ptr, *decoded_auth = ff_urldecode(auth); + + if (!decoded_auth) + return NULL; + + auth_b64_len = AV_BASE64_SIZE(strlen(decoded_auth)); + len = auth_b64_len + 30; + authstr = av_malloc(len); - if (!authstr) + if (!authstr) { + av_free(decoded_auth); return NULL; + } + snprintf(authstr, len, "Authorization: Basic "); ptr = authstr + strlen(authstr); - av_base64_encode(ptr, auth_b64_len, auth, strlen(auth)); + av_base64_encode(ptr, auth_b64_len, decoded_auth, strlen(decoded_auth)); av_strlcat(ptr, "\r\n", len - (ptr - authstr)); + av_free(decoded_auth); } else if (state->auth_type == HTTP_AUTH_DIGEST) { - char *username = av_strdup(auth), *password; + char *username = ff_urldecode(auth), *password; if (!username) return NULL; |