summaryrefslogtreecommitdiff
path: root/libavformat/http.c
Commit message (Collapse)AuthorAge
* http: Properly initialize icy headers stringAlessandro Ghedini2014-03-12
| | | | | | | | | | | | | | The icy_metadata_headers string never gets initialized, so, during the first call to av_strlcatf() in parse_icy(), strlen() will be called on a pointer to uninitialized memory. At best this causes some garbage data to be left at the start of the string. By initializing icy_metadata_headers to the empty string, the first call to strlen() will always return 0, so that data is appended from the start of the string. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* http: Declare more parameters as const where possibleMartin Storsjö2014-03-12
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Allow setting a Content-Type for POST requestsClément Bœsch2014-03-11
| | | | Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* http: Improve options descriptionsAlessandro Ghedini2014-03-11
| | | | | | Add documentation where missing. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* http: Always allow no-op seekAnssi Hannula2014-03-11
| | | | | | This also allows checking stream position as per ffurl_seek() doxy. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* http: Add support for selecting a request rangeAnssi Hannula2014-03-11
| | | | | | Comment from Reimar Döffinger included as pro memoria. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* http: Support setting custom User-AgentClément Bœsch2014-03-11
| | | | | | | Contextually make the default User-Agent use the common "Name/Version" pattern. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* http: Export Content-Type informationMichael Niedermayer2014-03-11
| | | | | | Bug-Id: https://bugs.debian.org/740421 Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* http: Add support reading ICY metadataLuca Barbato2014-03-11
| | | | | | | | | Export the metadata as a icy_metadata_packet avoption. Based on the work of wm4 and Alessandro Ghedini. Bug-Id: https://bugs.debian.org/739936 Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* http: Refactor process_lineLuca Barbato2014-03-11
|
* http: K&R formatting cosmeticsLuca Barbato2014-03-11
|
* http: Drop doxy commentsLuca Barbato2014-03-11
|
* http: Return meaningful error codesLuca Barbato2014-03-11
|
* http: Expose the content location via an AVOptionMartin Storsjö2013-11-22
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Support relative URL redirectionZhang Rui2013-11-22
| | | | | | | | | In RFC 2616, this was explicitly said to be an absolute URL, while in an upcoming draft [1] it is allowed to be relative as well. [1] http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-25#section-7.1.2 Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Remove an unrelated and mistakenly set AVOption unit nameMartin Storsjö2013-11-22
| | | | | | This was due to a copypaste oversight. Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Check the auth string contents and not only the pointerMichael Niedermayer2013-10-14
| | | | | | | This makes sure we don't send the Except: 100-continue header if no authentication credentials have been provided. Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Support auth method detection for POSTMartin Storsjö2013-10-13
| | | | | | | | | | | | | | | | | | | | | | | | Inspired by a patch by Jakob van Bethlehem. But instead of doing an empty POST first to trigger the WWW-Authenticate header (which would succeed if no auth actually was required), add an Expect: 100-continue header, which is meant to be used exactly for cases like this. The header is added if doing a post, and the user has specified authentication but we don't know the auth method yet. Not all common HTTP servers support the Expect: 100-continue header, though, so we only try to use it when it really is needed. The user can request it to be added for other POST requests as well via an option - which would allow the caller to know immediately that the POST has failed (e.g. if no auth was provided but the server required it, or if the target URL simply doesn't exist). This is only done for write mode posts (e.g. posts without pre-set post_data) - for posts with pre-set data, we can just redo the post if it failed due to 401. Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Add an option for forcing basic authenticationMartin Storsjö2013-10-13
| | | | | | | | | | | | | The default is to autodetect the auth method. This does require one extra request (and also closing and reopening the http connection). For some cases such as HTTP POST, the autodetection is not handled properly (yet). No option is added for digest, since this method requires getting nonce parameters from the server first and can't be used straight away like Basic. Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Pass options through to the nested protocolMartin Storsjö2013-09-26
| | | | | | | | When passing a dict to the nested protocol, it will consume the used options from it, so a separate copy needs to be used when reopening the connection multiple times. Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Support reading gzip/deflate compressed dataZhang Rui2013-07-28
| | | | | | | | | | | | | | | | Derived from VLC's http module. Original authors: Antoine Cellerier <dionoea@videolan.org> Sébastien Escudier <sebastien-devel@celeos.eu> Rémi Duraffort <ivoire@videolan.org> Rémi Denis-Courmont <remi@remlab.net> Francois Cartegnie <fcvlcdev@free.fr> Normally, http servers shouldn't send this to us since we don't advertise it with an Accept-Encoding header, but some servers still do it anyway. Signed-off-by: Martin Storsjö <martin@martin.st>
* Use the avstring.h locale-independent character type functionsReimar Döffinger2013-03-07
| | | | | | Make sure the behavior does not change with the locale. Signed-off-by: Martin Storsjö <martin@martin.st>
* lavf: Handle the environment variable no_proxy more properlyMartin Storsjö2013-02-27
| | | | | | | | | | | | | | | | | | | | The handling of the environment variable no_proxy, present since one of the initial commits (de6d9b6404), is inconsistent with how many other applications and libraries interpret this variable. Its bare presence does not indicate that the use of proxies should be skipped, but it is some sort of pattern for hosts that does not need using a proxy (e.g. for a local network). As investigated by Rudolf Polzer, different libraries handle this in different ways, some supporting IP address masks, some supporting arbitrary globbing using *, some just checking that the pattern matches the end of the hostname without regard for whether it actually is the right domain or a domain that ends in the same string. This simple logic should be pretty similar to the logic used by lynx and curl. Signed-off-by: Martin Storsjö <martin@martin.st>
* http: use av_strlcpy instead of strcpy() without size checksJanne Grunau2012-10-09
| | | | Fixes CID700730.
* http: Increase buffer sizes to cope with longer URIsDuncan Salerno2012-09-28
| | | | | | | | | | | | | Use the MAX_URL_SIZE define where applicable. Increase buffer sizes for all buffers that need to fit a long pathname - buffers that need to fit only the hostname (and other short strings, but not the pathname - such as "headers" in http_connect) are kept at 1024 bytes for now. Also increase the max line length in http_read_header, since it might need to contain a full url for Location: redirects. Signed-off-by: Martin Storsjö <martin@martin.st>
* avopt: Store defaults for AV_OPT_TYPE_INT in the i64 union memberMartin Storsjö2012-09-04
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* lavf: remove unnecessary inclusions of unistd.hMans Rullgard2012-06-20
| | | | | | These files do not use anything provided by unistd.h. Signed-off-by: Mans Rullgard <mans@mansr.com>
* http: replace atoll() with strtoll()Ronald S. Bultje2012-06-19
|
* http: Properly handle chunked transfer-encoding for replies to post dataMartin Storsjö2012-06-17
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Fail reading if the connection has gone awayMartin Storsjö2012-06-17
| | | | | | | This can happen if doing a new request using the same socket, but the new request failed, which clears the urlcontext. Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Add the url_shutdown function for https, tooMartin Storsjö2012-06-01
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Simplify code by removing a local variableMartin Storsjö2012-06-01
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Clear the old URLContext pointer when closedMartin Storsjö2012-06-01
| | | | | | | This fixes issues with opening http urls that have authentication or redirects, introduced in commit e999b641. Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Pass the proper return code of net IO operationsSamuel Pitoiset2012-05-30
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Add 'post_data', a new option which sets custom HTTP post dataSamuel Pitoiset2012-05-30
| | | | | | | This allows doing http posts with a content-length header sent in advance, avoiding chunked encoding. Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Add support for reusing the http socket for subsequent requestsSamuel Pitoiset2012-05-28
| | | | | | | Introduce ff_http_do_new_request(), a new function which sends a new HTTP request, reusing the existing connection to the server. Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Add support for using persistent connectionsSamuel Pitoiset2012-05-28
| | | | | | | Add a new AVOption 'multiple_requests', which indicates if we want to use persistent connections (ie. Connection: keep-alive). Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Add support for reading http POST reply headersSamuel Pitoiset2012-05-22
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Add http_shutdown() for ending writing of postsSamuel Pitoiset2012-05-22
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Factorize the code by adding http_read_header()Samuel Pitoiset2012-05-20
| | | | | | This function is used for reading http reply headers. Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Clear the auth state on redirectsMartin Storsjö2012-03-13
| | | | | | | Currently we only try continuing with the same auth mechanism as the initial request. Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Retry auth if it failed due to being staleMartin Storsjö2012-03-13
| | | | | | | 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>
* avio: Add an URLProtocol flag for indicating that a protocol uses networkMartin Storsjö2012-01-05
| | | | | | | 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>
* Remove extraneous semicolonsMans Rullgard2011-12-11
| | | | | | These semicolons cause invalid empty top-level declarations. Signed-off-by: Mans Rullgard <mans@mansr.com>
* http: Make sure proxyauth is initializedMartin Storsjö2011-12-01
| | | | | | | | | 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>
* http: Don't use the normal http proxy mechanism for httpsMartin Storsjö2011-11-18
| | | | | | | | | | 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>
* http: Reorder two code blocksMartin Storsjö2011-11-18
| | | | | | This is in preparation for a later commit. Signed-off-by: Martin Storsjö <martin@martin.st>
* http: Add a new protocol for opening connections via http proxiesMartin Storsjö2011-11-18
| | | | | | | | | | 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>
* http: Split out the non-chunked buffer reading part from http_readMartin Storsjö2011-11-18
| | | | | | | This is in preparation for a later commit, where this function is reused. Signed-off-by: Martin Storsjö <martin@martin.st>
* avio: add support for passing options to protocols.Anton Khirnov2011-11-13
| | | | | Not used anywhere yet, support for passing options from avio_open() will follow.