aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/http.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-11-06 02:18:50 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-11-06 02:23:34 +0100
commitd8cab5c26b0987f139830937e1f30b2a10822680 (patch)
tree1328facddcdaeac6881f32b7b3511806a68d2111 /libavformat/http.c
parent3b4798a87375c6090215185a87d51358cbb5af84 (diff)
parent18ae3626405a8b3d6dbb7e5b848d354cd7bf9a47 (diff)
downloadffmpeg-d8cab5c26b0987f139830937e1f30b2a10822680.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: http: Remove the custom function for disabling chunked posts rtsp: Disable chunked http post through AVOptions movdec: Set frame_size for AMR h264_weight: remove duplication functions. swscale: align vertical filtersize by 2 on x86. libavfilter: reindent. matroskadec: empty blocks are in fact valid. avfilter: don't abort() on zero-size allocations. h264: improve calculation of codec delay. movenc: Set a correct packet size for AMR-NB mode 15, "no data" avformat: Add functions for doing global network initialization avformat: Add the https protocol avformat: Add the tls protocol, using OpenSSL or gnutls avformat: Initialize gnutls in ff_tls_init() w32threads: Wrap the mutex functions in inline functions returning int configure: Allow linking to the gnutls library avformat: Add ff_tls_init()/deinit() that initialize OpenSSL configure: Allow linking to openssl avcodec: Allow locking and unlocking an avformat specific mutex avformat: Split out functions from network.h to a new file, network.c Conflicts: Changelog configure doc/APIchanges libavcodec/internal.h libavcodec/version.h libavfilter/formats.c libavformat/matroskadec.c libavformat/mov.c libavformat/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/http.c')
-rw-r--r--libavformat/http.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/libavformat/http.c b/libavformat/http.c
index 76e5a0fb07..414eb8719f 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -77,11 +77,6 @@ void ff_http_set_headers(URLContext *h, const char *headers)
av_strlcpy(s->headers, headers, sizeof(s->headers));
}
-void ff_http_set_chunked_transfer_encoding(URLContext *h, int is_chunked)
-{
- ((HTTPContext*)h->priv_data)->chunksize = is_chunked ? 0 : -1;
-}
-
void ff_http_init_auth_state(URLContext *dest, const URLContext *src)
{
memcpy(&((HTTPContext*)dest->priv_data)->auth_state,
@@ -91,8 +86,8 @@ void ff_http_init_auth_state(URLContext *dest, const URLContext *src)
/* return non zero if error */
static int http_open_cnx(URLContext *h)
{
- const char *path, *proxy_path;
- char hostname[1024], hoststr[1024];
+ const char *path, *proxy_path, *lower_proto = "tcp";
+ char hostname[1024], hoststr[1024], proto[10];
char auth[1024];
char path1[1024];
char buf[1024];
@@ -108,7 +103,8 @@ static int http_open_cnx(URLContext *h)
/* fill the dest addr */
redo:
/* needed in any case to build the host string */
- av_url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port,
+ av_url_split(proto, sizeof(proto), auth, sizeof(auth),
+ hostname, sizeof(hostname), &port,
path1, sizeof(path1), s->location);
ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL);
@@ -122,10 +118,15 @@ static int http_open_cnx(URLContext *h)
else
path = path1;
}
+ if (!strcmp(proto, "https")) {
+ lower_proto = "tls";
+ if (port < 0)
+ port = 443;
+ }
if (port < 0)
port = 80;
- ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
+ ff_url_join(buf, sizeof(buf), lower_proto, NULL, hostname, port, NULL);
err = ffurl_open(&hd, buf, AVIO_FLAG_READ_WRITE);
if (err < 0)
goto fail;
@@ -508,6 +509,7 @@ http_get_file_handle(URLContext *h)
return ffurl_get_file_handle(s->hd);
}
+#if CONFIG_HTTP_PROTOCOL
URLProtocol ff_http_protocol = {
.name = "http",
.url_open = http_open,
@@ -519,3 +521,17 @@ URLProtocol ff_http_protocol = {
.priv_data_size = sizeof(HTTPContext),
.priv_data_class = &httpcontext_class,
};
+#endif
+#if CONFIG_HTTPS_PROTOCOL
+URLProtocol ff_https_protocol = {
+ .name = "https",
+ .url_open = http_open,
+ .url_read = http_read,
+ .url_write = http_write,
+ .url_seek = http_seek,
+ .url_close = http_close,
+ .url_get_file_handle = http_get_file_handle,
+ .priv_data_size = sizeof(HTTPContext),
+ .priv_data_class = &httpcontext_class,
+};
+#endif