]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/http.c
use ff_neterrno() and FF_NETERROR() for networking error handling
[ffmpeg] / libavformat / http.c
index 9e8fce59abc974aa906777bbeec90c0a01c53a87..b28a56f7eac689bf0e2a56e0d9337abfc79f8615 100644 (file)
@@ -24,8 +24,8 @@
 
 #include "base64.h"
 
-/* XXX: POST protocol is not completly implemented because ffmpeg use
-   only a subset of it */
+/* XXX: POST protocol is not completely implemented because ffmpeg uses
+   only a subset of it. */
 
 //#define DEBUG
 
@@ -210,13 +210,14 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
     int post, err, ch;
     char line[1024], *q;
     char *auth_b64;
+    int auth_b64_len = strlen(auth)* 4 / 3 + 12;
     offset_t off = s->off;
 
 
     /* send http header */
     post = h->flags & URL_WRONLY;
-
-    auth_b64 = av_base64_encode((uint8_t *)auth, strlen(auth));
+    auth_b64 = av_malloc(auth_b64_len);
+    av_base64_encode(auth_b64, auth_b64_len, (uint8_t *)auth, strlen(auth));
     snprintf(s->buffer, sizeof(s->buffer),
              "%s %s HTTP/1.1\r\n"
              "User-Agent: %s\r\n"