FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
http.c File Reference
#include "config.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
#include "libavutil/opt.h"
#include "libavutil/time.h"
#include "libavutil/parseutils.h"
#include "avformat.h"
#include "http.h"
#include "httpauth.h"
#include "internal.h"
#include "network.h"
#include "os_support.h"
#include "url.h"

Go to the source code of this file.

Data Structures

struct  HTTPContext
 

Macros

#define BUFFER_SIZE   MAX_URL_SIZE
 
#define MAX_REDIRECTS   8
 
#define HTTP_SINGLE   1
 
#define HTTP_MUTLI   2
 
#define MAX_EXPIRY   19
 
#define WHITESPACES   " \n\t\r"
 
#define OFFSET(x)   offsetof(HTTPContext, x)
 
#define D   AV_OPT_FLAG_DECODING_PARAM
 
#define E   AV_OPT_FLAG_ENCODING_PARAM
 
#define DEFAULT_USER_AGENT   "Lavf/" AV_STRINGIFY(LIBAVFORMAT_VERSION)
 
#define NEEDS_ESCAPE(ch)
 
#define HTTP_CLASS(flavor)
 

Enumerations

enum  HandshakeState { LOWER_PROTO, READ_HEADERS, WRITE_REPLY_HEADERS, FINISH }
 

Functions

static int http_connect (URLContext *h, const char *path, const char *local_path, const char *hoststr, const char *auth, const char *proxyauth, int *new_location)
 
static int http_read_header (URLContext *h, int *new_location)
 
static int http_shutdown (URLContext *h, int flags)
 
void ff_http_init_auth_state (URLContext *dest, const URLContext *src)
 Initialize the authentication state based on another HTTP URLContext. More...
 
static int http_open_cnx_internal (URLContext *h, AVDictionary **options)
 
static int http_open_cnx (URLContext *h, AVDictionary **options)
 
int ff_http_get_shutdown_status (URLContext *h)
 Get the HTTP shutdown response status, be used after http_shutdown. More...
 
int ff_http_do_new_request (URLContext *h, const char *uri)
 Send a new HTTP request, reusing the old connection. More...
 
int ff_http_do_new_request2 (URLContext *h, const char *uri, AVDictionary **opts)
 Send a new HTTP request, reusing the old connection. More...
 
int ff_http_averror (int status_code, int default_averror)
 
static int http_write_reply (URLContext *h, int status_code)
 
static void handle_http_errors (URLContext *h, int error)
 
static int http_handshake (URLContext *c)
 
static int http_listen (URLContext *h, const char *uri, int flags, AVDictionary **options)
 
static int http_open (URLContext *h, const char *uri, int flags, AVDictionary **options)
 
static int http_accept (URLContext *s, URLContext **c)
 
static int http_getc (HTTPContext *s)
 
static int http_get_line (HTTPContext *s, char *line, int line_size)
 
static int check_http_code (URLContext *h, int http_code, const char *end)
 
static int parse_location (HTTPContext *s, const char *p)
 
static void parse_content_range (URLContext *h, const char *p)
 
static int parse_content_encoding (URLContext *h, const char *p)
 
static int parse_icy (HTTPContext *s, const char *tag, const char *p)
 
static int parse_set_cookie_expiry_time (const char *exp_str, struct tm *buf)
 
static int parse_set_cookie (const char *set_cookie, AVDictionary **dict)
 
static int parse_cookie (HTTPContext *s, const char *p, AVDictionary **cookies)
 
static int cookie_string (AVDictionary *dict, char **cookies)
 
static int process_line (URLContext *h, char *line, int line_count, int *new_location)
 
static int get_cookies (HTTPContext *s, char **cookies, const char *path, const char *domain)
 Create a string containing cookie values for use as a HTTP cookie header field value for a particular path and domain from the cookie values stored in the HTTP protocol context. More...
 
static int has_header (const char *str, const char *header)
 
static void bprint_escaped_path (AVBPrint *bp, const char *path)
 Escape unsafe characters in path in order to pass them safely to the HTTP request. More...
 
static int http_buf_read (URLContext *h, uint8_t *buf, int size)
 
static int64_t http_seek_internal (URLContext *h, int64_t off, int whence, int force_reconnect)
 
static int http_read_stream (URLContext *h, uint8_t *buf, int size)
 
static int http_read_stream_all (URLContext *h, uint8_t *buf, int size)
 
static void update_metadata (URLContext *h, char *data)
 
static int store_icy (URLContext *h, int size)
 
static int http_read (URLContext *h, uint8_t *buf, int size)
 
static int http_write (URLContext *h, const uint8_t *buf, int size)
 
static int http_close (URLContext *h)
 
static int64_t http_seek (URLContext *h, int64_t off, int whence)
 
static int http_get_file_handle (URLContext *h)
 
static int http_get_short_seek (URLContext *h)
 

Variables

static const AVOption options []
 

Macro Definition Documentation

#define BUFFER_SIZE   MAX_URL_SIZE

Definition at line 49 of file http.c.

Referenced by http_getc(), http_seek_internal(), and http_write_reply().

#define MAX_REDIRECTS   8

Definition at line 50 of file http.c.

Referenced by http_open_cnx().

#define HTTP_SINGLE   1

Definition at line 51 of file http.c.

Referenced by http_listen().

#define HTTP_MUTLI   2

Definition at line 52 of file http.c.

#define MAX_EXPIRY   19

Definition at line 53 of file http.c.

Referenced by parse_set_cookie_expiry_time().

#define WHITESPACES   " \n\t\r"

Definition at line 54 of file http.c.

Referenced by parse_set_cookie().

#define OFFSET (   x)    offsetof(HTTPContext, x)

Definition at line 132 of file http.c.

Definition at line 133 of file http.c.

Definition at line 134 of file http.c.

#define DEFAULT_USER_AGENT   "Lavf/" AV_STRINGIFY(LIBAVFORMAT_VERSION)

Definition at line 135 of file http.c.

Referenced by http_connect().

#define NEEDS_ESCAPE (   ch)
Value:
((ch) <= ' ' || (ch) >= '\x7f' || \
(ch) == '"' || (ch) == '%' || (ch) == '<' || (ch) == '>' || (ch) == '\\' || \
(ch) == '^' || (ch) == '`' || (ch) == '{' || (ch) == '}' || (ch) == '|')
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(const uint8_t *) pi-0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(const int16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(const int16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16,*(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16,*(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(const int32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(const int32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32,*(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32,*(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(const int64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64,*(const int64_t *) pi *(1.0f/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64,*(const int64_t *) pi *(1.0/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(const float *) pi *(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(const double *) pi *(UINT64_C(1)<< 63)))#define FMT_PAIR_FUNC(out, in) static conv_func_type *const fmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64),};static void cpy1(uint8_t **dst, const uint8_t **src, int len){memcpy(*dst,*src, len);}static void cpy2(uint8_t **dst, const uint8_t **src, int len){memcpy(*dst,*src, 2 *len);}static void cpy4(uint8_t **dst, const uint8_t **src, int len){memcpy(*dst,*src, 4 *len);}static void cpy8(uint8_t **dst, const uint8_t **src, int len){memcpy(*dst,*src, 8 *len);}AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, const int *ch_map, int flags){AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) return NULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) return NULL;if(channels==1){in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);}ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map){switch(av_get_bytes_per_sample(in_fmt)){case 1:ctx->simd_f=cpy1;break;case 2:ctx->simd_f=cpy2;break;case 4:ctx->simd_f=cpy4;break;case 8:ctx->simd_f=cpy8;break;}}if(HAVE_X86ASM &&1) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);return ctx;}void swri_audio_convert_free(AudioConvert **ctx){av_freep(ctx);}int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len){int ch;int off=0;const int os=(out->planar?1:out->ch_count)*out->bps;unsigned misaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask){int planes=in->planar?in->ch_count:1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;}if(ctx->out_simd_align_mask){int planes=out->planar?out->ch_count:1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;}if(ctx->simd_f &&!ctx->ch_map &&!misaligned){off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){if(out->planar==in->planar){int planes=out->planar?out->ch_count:1;for(ch=0;ch< planes;ch++){ctx->simd_f(out-> ch ch
Definition: audioconvert.c:56

Referenced by bprint_escaped_path().

#define HTTP_CLASS (   flavor)
Value:
static const AVClass flavor ## _context_class = { \
.class_name = # flavor, \
.item_name = av_default_item_name, \
.option = options, \
.version = LIBAVUTIL_VERSION_INT, \
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:235
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:72
static const AVOption options[]
Definition: http.c:137
Describe the class of an AVClass context structure.
Definition: log.h:67

Definition at line 1788 of file http.c.

Enumeration Type Documentation

Enumerator
LOWER_PROTO 
READ_HEADERS 
WRITE_REPLY_HEADERS 
FINISH 

Definition at line 55 of file http.c.

Function Documentation

static int http_connect ( URLContext h,
const char *  path,
const char *  local_path,
const char *  hoststr,
const char *  auth,
const char *  proxyauth,
int new_location 
)
static

Definition at line 1213 of file http.c.

Referenced by http_open_cnx_internal().

static int http_read_header ( URLContext h,
int new_location 
)
static

Definition at line 1150 of file http.c.

Referenced by http_connect(), http_handshake(), and http_read_stream().

static int http_shutdown ( URLContext h,
int  flags 
)
static

Definition at line 1664 of file http.c.

Referenced by ff_http_do_new_request2(), and http_close().

void ff_http_init_auth_state ( URLContext dest,
const URLContext src 
)

Initialize the authentication state based on another HTTP URLContext.

This can be used to pre-initialize the authentication parameters if they are known beforehand, to avoid having to do an initial failing request just to get the parameters.

Parameters
destURL context whose authentication state gets updated
srcURL context whose authentication state gets copied

Definition at line 181 of file http.c.

Referenced by ff_rtsp_open_transport_ctx().

static int http_open_cnx_internal ( URLContext h,
AVDictionary **  options 
)
static

Definition at line 191 of file http.c.

Referenced by http_open_cnx().

static int http_open_cnx ( URLContext h,
AVDictionary **  options 
)
static

Definition at line 262 of file http.c.

Referenced by ff_http_do_new_request2(), http_open(), and http_seek_internal().

int ff_http_get_shutdown_status ( URLContext h)

Get the HTTP shutdown response status, be used after http_shutdown.

Parameters
hpointer to the resource
Returns
a negative value if an error condition occurred, 0 otherwise

Definition at line 317 of file http.c.

Referenced by hlsenc_io_close().

int ff_http_do_new_request ( URLContext h,
const char *  uri 
)

Send a new HTTP request, reusing the old connection.

Parameters
hpointer to the resource
uriuri used to perform the request
Returns
a negative value if an error condition occurred, 0 otherwise

Definition at line 333 of file http.c.

Referenced by dashenc_io_open(), hlsenc_io_open(), and rtmp_http_send_cmd().

int ff_http_do_new_request2 ( URLContext h,
const char *  uri,
AVDictionary **  options 
)

Send a new HTTP request, reusing the old connection.

Parameters
hpointer to the resource
uriuri used to perform the request
optionsA dictionary filled with HTTP options. On return this parameter will be destroyed and replaced with a dict containing options that were not found. May be NULL.
Returns
a negative value if an error condition occurred, 0 otherwise

Definition at line 337 of file http.c.

Referenced by ff_http_do_new_request(), and open_url_keepalive().

int ff_http_averror ( int  status_code,
int  default_averror 
)

Definition at line 391 of file http.c.

Referenced by check_http_code(), ff_rtsp_averror(), http_open_cnx(), and process_line().

static int http_write_reply ( URLContext h,
int  status_code 
)
static

Definition at line 408 of file http.c.

Referenced by handle_http_errors(), and http_handshake().

static void handle_http_errors ( URLContext h,
int  error 
)
static

Definition at line 482 of file http.c.

Referenced by http_handshake().

static int http_handshake ( URLContext c)
static

Definition at line 488 of file http.c.

Referenced by http_listen().

static int http_listen ( URLContext h,
const char *  uri,
int  flags,
AVDictionary **  options 
)
static

Definition at line 524 of file http.c.

Referenced by http_open().

static int http_open ( URLContext h,
const char *  uri,
int  flags,
AVDictionary **  options 
)
static

Definition at line 555 of file http.c.

static int http_accept ( URLContext s,
URLContext **  c 
)
static

Definition at line 596 of file http.c.

static int http_getc ( HTTPContext s)
static

Definition at line 620 of file http.c.

Referenced by http_get_line().

static int http_get_line ( HTTPContext s,
char *  line,
int  line_size 
)
static

Definition at line 637 of file http.c.

Referenced by http_buf_read(), and http_read_header().

static int check_http_code ( URLContext h,
int  http_code,
const char *  end 
)
static

Definition at line 661 of file http.c.

Referenced by process_line().

static int parse_location ( HTTPContext s,
const char *  p 
)
static

Definition at line 676 of file http.c.

Referenced by process_line().

static void parse_content_range ( URLContext h,
const char *  p 
)
static

Definition at line 690 of file http.c.

Referenced by process_line().

static int parse_content_encoding ( URLContext h,
const char *  p 
)
static

Definition at line 705 of file http.c.

Referenced by process_line().

static int parse_icy ( HTTPContext s,
const char *  tag,
const char *  p 
)
static

Definition at line 739 of file http.c.

Referenced by process_line().

static int parse_set_cookie_expiry_time ( const char *  exp_str,
struct tm *  buf 
)
static

Definition at line 761 of file http.c.

Referenced by get_cookies(), and parse_cookie().

static int parse_set_cookie ( const char *  set_cookie,
AVDictionary **  dict 
)
static

Definition at line 786 of file http.c.

Referenced by get_cookies(), and parse_cookie().

static int parse_cookie ( HTTPContext s,
const char *  p,
AVDictionary **  cookies 
)
static

Definition at line 821 of file http.c.

Referenced by get_cookies(), and process_line().

static int cookie_string ( AVDictionary dict,
char **  cookies 
)
static

Definition at line 883 of file http.c.

Referenced by http_read_header().

static int process_line ( URLContext h,
char *  line,
int  line_count,
int new_location 
)
static

Definition at line 906 of file http.c.

Referenced by http_read_header().

static int get_cookies ( HTTPContext s,
char **  cookies,
const char *  path,
const char *  domain 
)
static

Create a string containing cookie values for use as a HTTP cookie header field value for a particular path and domain from the cookie values stored in the HTTP protocol context.

The cookie string is stored in *cookies, and may be NULL if there are no valid cookies.

Returns
a negative value if an error condition occurred, 0 otherwise

Definition at line 1060 of file http.c.

Referenced by http_connect().

static int has_header ( const char *  str,
const char *  header 
)
inlinestatic

Definition at line 1142 of file http.c.

Referenced by http_connect().

static void bprint_escaped_path ( AVBPrint *  bp,
const char *  path 
)
static

Escape unsafe characters in path in order to pass them safely to the HTTP request.

Insipred by the algorithm in GNU wget:

  • escape "%" characters not followed by two hex digits
  • escape all "unsafe" characters except which are also "reserved"
  • pass through everything else

Definition at line 1189 of file http.c.

Referenced by http_connect().

static int http_buf_read ( URLContext h,
uint8_t buf,
int  size 
)
static

Definition at line 1379 of file http.c.

Referenced by http_read_stream().

static int64_t http_seek_internal ( URLContext h,
int64_t  off,
int  whence,
int  force_reconnect 
)
static

Definition at line 1713 of file http.c.

Referenced by http_buf_read(), http_read_stream(), and http_seek().

static int http_read_stream ( URLContext h,
uint8_t buf,
int  size 
)
static

Definition at line 1487 of file http.c.

Referenced by http_read(), and http_read_stream_all().

static int http_read_stream_all ( URLContext h,
uint8_t buf,
int  size 
)
static

Definition at line 1543 of file http.c.

Referenced by store_icy().

static void update_metadata ( URLContext h,
char *  data 
)
static

Definition at line 1555 of file http.c.

Referenced by store_icy().

static int store_icy ( URLContext h,
int  size 
)
static

Definition at line 1583 of file http.c.

Referenced by http_read().

static int http_read ( URLContext h,
uint8_t buf,
int  size 
)
static

Definition at line 1621 of file http.c.

static int http_write ( URLContext h,
const uint8_t buf,
int  size 
)
static

Definition at line 1638 of file http.c.

static int http_close ( URLContext h)
static

Definition at line 1693 of file http.c.

static int64_t http_seek ( URLContext h,
int64_t  off,
int  whence 
)
static

Definition at line 1771 of file http.c.

static int http_get_file_handle ( URLContext h)
static

Definition at line 1776 of file http.c.

static int http_get_short_seek ( URLContext h)
static

Definition at line 1782 of file http.c.

Variable Documentation

const AVOption options[]
static

Definition at line 137 of file http.c.