diff --git a/libavformat/http.c b/libavformat/http.c
index 55cd3a4..e9326de 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -47,6 +47,7 @@ typedef struct {
     char location[URL_SIZE];
     HTTPAuthState auth_state;
     unsigned char headers[BUFFER_SIZE];
+    int is_chunked;
 } HTTPContext;
 
 static int http_connect(URLContext *h, const char *path, const char *hoststr,
@@ -59,6 +60,11 @@ void ff_http_set_headers(URLContext *h, const char *headers)
     snprintf(s->headers, sizeof(s->headers), "%s", headers);
 }
 
+void ff_http_set_chunked_transfer_encoding(URLContext *h, int is_chunked)
+{
+    ((HTTPContext*)h->priv_data)->is_chunked = is_chunked;
+}
+
 /* return non zero if error */
 int ff_http_connect(URLContext *h)
 {
@@ -141,6 +147,7 @@ static int http_open(URLContext *h, const char *uri, int flags)
     h->priv_data = s;
     s->filesize = -1;
     s->chunksize = -1;
+    s->is_chunked = 1;
     s->off = 0;
     *s->headers = '\0';
     memset(&s->auth_state, 0, sizeof(s->auth_state));
@@ -393,6 +400,7 @@ static int http_write(URLContext *h, uint8_t *buf, int size)
      * signal EOF */
     if (size > 0) {
         /* upload data using chunked encoding */
+        if(s->is_chunked)
         snprintf(temp, sizeof(temp), "%x\r\n", size);
 
         if ((ret = url_write(s->hd, temp, strlen(temp))) < 0 ||
diff --git a/libavformat/http.h b/libavformat/http.h
index 96250b8..d98839d 100644
--- a/libavformat/http.h
+++ b/libavformat/http.h
@@ -38,4 +38,12 @@ int ff_http_connect(URLContext *h);
  */
 void ff_http_set_headers(URLContext *h, const char *headers);
 
+/**
+ * Enables or disables chunked transfer encoding. (default is enabled)
+ *
+ * @param h URL context for this HTTP connection
+ * @param is_chunked 0 to disable chunking, nonzero otherwise.
+ */
+void ff_http_set_chunked_transfer_encoding(URLContext *h, int is_chunked);
+
 #endif
