Commit Graph

125 Commits

Author SHA1 Message Date
Samuel Pitoiset
e5773d8bc3 http: Add support for reading http POST reply headers
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-05-22 23:16:46 +03:00
Samuel Pitoiset
ba354a8cc0 http: Add http_shutdown() for ending writing of posts
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-05-22 23:16:44 +03:00
Samuel Pitoiset
5d603f1b65 http: Factorize the code by adding http_read_header()
This function is used for reading http reply headers.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-05-20 20:20:50 +03:00
Martin Storsjö
499ad54d98 http: Clear the auth state on redirects
Currently we only try continuing with the same auth mechanism
as the initial request.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-13 11:19:29 +02:00
Martin Storsjö
e75bbcf493 http: Retry auth if it failed due to being stale
Allow up to 4 retries for normal requests, where both the
proxy and the target server might need to authenticate.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-13 11:19:29 +02:00
Martin Storsjö
32b83aeec1 avio: Add an URLProtocol flag for indicating that a protocol uses network
This definition is in two files, since the definitions will move
to the private header at the next bump.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-01-05 23:56:52 +02:00
Mans Rullgard
373211d828 Remove extraneous semicolons
These semicolons cause invalid empty top-level declarations.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-12-11 17:23:24 +00:00
Martin Storsjö
abe20c59b9 http: Make sure proxyauth is initialized
This string will be passed to ff_http_auth_create_response
even if no proxy is used, resulting in reading uninitialized
memory. The other auth string is always initialized by
av_url_split.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-12-01 12:05:14 +02:00
Martin Storsjö
dbc2424baa http: Don't use the normal http proxy mechanism for https
The tls protocol handles connections via proxies internally.

With TLS/SSL, the peer verification requires that the client
speaks directly with the server, since the proxy doesn't have
the remote server's private key.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-18 10:59:53 +02:00
Martin Storsjö
f5c5d57b57 http: Reorder two code blocks
This is in preparation for a later commit.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-18 10:59:53 +02:00
Martin Storsjö
9f1dae944e http: Add a new protocol for opening connections via http proxies
This opens a plain TCP connection through the proxy via the
CONNECT HTTP method. Normally, this is allowed for connections
on port 443, but can in general be used to allow connections
to any port (depending on proxy configuration), and could thus
be used to tunnel any TCP connection via a HTTP proxy.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-18 10:59:53 +02:00
Martin Storsjö
bf7723a640 http: Split out the non-chunked buffer reading part from http_read
This is in preparation for a later commit, where this function
is reused.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-18 10:59:16 +02:00
Anton Khirnov
ddffc2fdc3 avio: add support for passing options to protocols.
Not used anywhere yet, support for passing options from avio_open() will
follow.
2011-11-13 13:14:39 +01:00
Martin Storsjö
6f1b7b3944 avio: Add an AVIOInterruptCB parameter to ffurl_open/ffurl_alloc
Change all uses of these function to pass the relevant
callback on.
2011-11-13 13:12:17 +01:00
Martin Storsjö
b911518d1c http: Handle proxy authentication
Tested with both Basic and Digest authentication, and tested with
both proxy authentication and authentication for the requested
resource at the same time.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-11 14:07:57 +02:00
Martin Storsjö
b01f5ba207 http: Print an error message for Authorization Required, too
The error was hidden before, to avoid showing an error on the
first request where no auth has been provided, when the server
indicates which authentication method to use.

Now the error is printed if an authentication method was used,
but failed.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-11 14:07:48 +02:00
Martin Storsjö
f2d0015531 http: Don't add a Range: bytes=0- header for POST
That header simply doesn't make sense in that context.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-10 14:13:40 +02:00
Martin Storsjö
6149485f6c http: Change the chunksize AVOption into chunked_post
The chunksize internal variable has two different uses - for
reading, it's the amount of data left of the current chunk
(or -1 if the server doesn't send data in chunked mode), where
it's only an internal state variable. For writing, it's used
to decide whether to enable chunked encoding (by default), by
using the value 0, or disable chunked encoding (value -1).

This, while consistent, doesn't make much sense to expose
as an AVOption. This splits the usage of the internal variable
into two variables, chunksize which is used for reading (as
before), and chunked_post which is the user-settable option,
with the values 0 and 1, where 1 is default.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-10 13:21:26 +02:00
Anton Khirnov
a251928060 http: Add encoding/decoding flags to the AVOptions
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-10 13:21:18 +02:00
Anton Khirnov
3b384502f2 http: use different classes for http and https. 2011-11-10 11:36:45 +01:00
Martin Storsjö
8ef79f42ca http: Change an error log message to a warning
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-10 10:51:57 +02:00
Martin Storsjö
7590061eb7 http: Remove the now unused ff_http_set_headers custom function
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-10 10:51:50 +02:00
Martin Storsjö
10da1e913b http: Make custom headers settable via an AVOption
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-10 10:51:26 +02:00
Reimar Döffinger
bb3244dee2 Replace all usage of strcasecmp/strncasecmp
All current usages of it are incompatible with localization.
For example strcasecmp("i", "I") != 0 is possible, but would
break many of the places where it is used.

Instead use our own implementations that always treat the data
as ASCII.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-06 11:52:57 +02:00
Martin Storsjö
18ae362640 http: Remove the custom function for disabling chunked posts
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-05 16:54:39 +02:00
Martin Storsjö
183baeadca avformat: Add the https protocol
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-05 12:09:36 +02:00
Diego Biurrun
20566eb0f0 Replace outdated references to ffmpeg tool with avconv. 2011-11-02 10:42:54 +01:00
Anton Khirnov
145f741e11 AVOptions: rename FF_OPT_TYPE_* => AV_OPT_TYPE_* 2011-10-12 16:51:16 +02:00
Stefan Fritsch
346ea9e222 http: Consider the stream as seekable if the reply contains Accept-Ranges: bytes
The initial request contains "Range: 0-", which servers normally
have responded with "HTTP/1.1 206 Partial Content" reply with
a Content-Range header, which was used as indicator for seekability.

Apache, since 2.2.20, responds with "HTTP/1.1 200 OK" for these
requests, which is more friendly to caches and proxies, but the
seekability still is indicated via the Accept-Ranges: bytes header.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-04 11:28:53 +02:00
Anton Khirnov
f0029cbcf6 lavf: use designated initializers for AVClasses. 2011-05-17 23:01:42 +02:00
Anton Khirnov
b66752790a AVOptions: make default_val a union, as proposed in AVOption2.
This breaks API and ABI.
2011-05-10 20:22:06 +02:00
Martin Storsjö
c60112f268 libavformat: Make protocols pass URLContext as log context where available
Since the libavformat major bump, URLContext contains an AVClass,
making it a usable log context.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-04-20 14:59:45 +03:00
Stefano Sabatini
59d96941f0 avio: remove AVIO_* access symbols in favor of new AVIO_FLAG_* symbols
Make AVIO_FLAG_ access constants work as flags, and in particular fix
the behavior of functions (such as avio_check()) which expect them to
be flags rather than modes.

This breaks API.
2011-04-19 19:47:58 +02:00
Anton Khirnov
f35ff97f2e lavf: use designated initializers for all protocols
This is more readable and makes it easier to reorder URLProtocol
members.
2011-04-08 11:08:26 +02:00
Anton Khirnov
f87b1b373a avio: AVIO_ prefixes for URL_ open flags. 2011-04-07 18:07:16 +02:00
Anton Khirnov
1869ea03b7 avio: make url_get_file_handle() internal. 2011-04-04 17:45:20 +02:00
Anton Khirnov
e52a9145c8 avio: make url_close() internal. 2011-04-04 17:45:20 +02:00
Anton Khirnov
925e908bc7 avio: make url_write() internal. 2011-04-04 17:45:20 +02:00
Anton Khirnov
bc371aca46 avio: make url_read() internal. 2011-04-04 17:45:20 +02:00
Anton Khirnov
0589da0aa5 avio: make url_open() internal. 2011-04-04 17:45:20 +02:00
Tyler
bc61920d89 http: header field names are case insensitive
Amazon S3 sends header field names all lowercase.
This is actually acceptable according to the HTTP standard.

http://tools.ietf.org/html/rfc2616#section-4.2

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-03-28 04:16:12 +02:00
Mans Rullgard
2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Luca Barbato
dfd2a005eb Replace dprintf with av_dlog
dprintf clashes with POSIX.1-2008
2011-01-29 23:55:37 +01:00
Diego Elio Pettenò
c6610a216e Prefix all _demuxer, _muxer, _protocol from libavformat and libavdevice.
This also lists the objects from those two libraries as internal (by adding
the ff_ prefix) so that they can then be hidden via linker scripts.
2011-01-26 22:10:09 +00:00
Mike Edenfield
7e35d8596b http: Handle 301/307 redirect requests, too
Patch by Mike Edenfield, kutulu at kutulu dot org

Originally committed as revision 25651 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-11-02 20:37:01 +00:00
Michael Niedermayer
6ed040408b Move AVOptions from libavcodec to libavutil
Originally committed as revision 25210 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-09-26 14:25:22 +00:00
Martin Storsjö
e55ebcc3f6 Move the definition of the maximum url size for static buffers to internal.h
Originally committed as revision 24833 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-08-19 14:50:40 +00:00
Martin Storsjö
f240ed18ef http: Return EOF at the end of the content even if the connection isn't closed
We do request Connection: close, but some servers ignore it.

Originally committed as revision 24746 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-08-09 08:14:48 +00:00
Martin Storsjö
db979afed2 http: Log a warning when receiving an error code
Originally committed as revision 24266 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-07-16 14:15:37 +00:00
Måns Rullgård
f3bfe388b5 Make ff_url_split() public
ff_url_split() is retained as an alias, as it was used by ffserver,
to avoid breaking ABI compatibility with it.

Originally committed as revision 23822 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-06-27 14:16:46 +00:00