summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2014-07-18 00:39:43 +0200
committerLuca Barbato <lu_zero@gentoo.org>2014-07-21 22:18:35 +0200
commit28df1d24112c6ad0763985df2faeeb198cfbad69 (patch)
tree017ef99422c5a83e7b861c7ce3bc97cfb9d8a7b3
parentbb0babd7054bed7edfd9f4d6b20cdba864de1830 (diff)
downloadffmpeg-streaming-28df1d24112c6ad0763985df2faeeb198cfbad69.zip
ffmpeg-streaming-28df1d24112c6ad0763985df2faeeb198cfbad69.tar.gz
http: Provide an option to override the HTTP method
Certain servers accept only PUT as valid method.
-rw-r--r--libavformat/http.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavformat/http.c b/libavformat/http.c
index 948930a..fc5f7df 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -85,6 +85,7 @@ typedef struct {
#endif
AVDictionary *chained_options;
int send_expect_100;
+ char *method;
} HTTPContext;
#define OFFSET(x) offsetof(HTTPContext, x)
@@ -110,6 +111,7 @@ static const AVOption options[] = {
{"location", "The actual location of the data received", OFFSET(location), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D|E },
{"offset", "initial byte offset", OFFSET(off), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, D },
{"end_offset", "try to limit the request to bytes preceding this offset", OFFSET(end_off), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, D },
+{"method", "Override the HTTP method", OFFSET(method), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E, },
{NULL}
};
#define HTTP_CLASS(flavor)\
@@ -555,7 +557,11 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
s->chunked_post = 0;
}
- method = post ? "POST" : "GET";
+ if (s->method)
+ method = s->method;
+ else
+ method = post ? "POST" : "GET";
+
authstr = ff_http_auth_create_response(&s->auth_state, auth, local_path,
method);
proxyauthstr = ff_http_auth_create_response(&s->proxy_auth_state, proxyauth,
OpenPOWER on IntegriCloud