libavformat/http.c File Reference

#include "libavutil/avstring.h"
#include "avformat.h"
#include <unistd.h>
#include <strings.h>
#include "internal.h"
#include "network.h"
#include "http.h"
#include "os_support.h"
#include "httpauth.h"
#include "url.h"
#include "libavutil/opt.h"

Go to the source code of this file.

Data Structures

struct  HTTPContext

Defines

#define BUFFER_SIZE   1024
#define MAX_REDIRECTS   8
#define OFFSET(x)   offsetof(HTTPContext, x)

Functions

static int http_connect (URLContext *h, const char *path, const char *hoststr, const char *auth, int *new_location)
void ff_http_set_headers (URLContext *h, const char *headers)
 Set custom HTTP headers.
void ff_http_set_chunked_transfer_encoding (URLContext *h, int is_chunked)
 Enable or disable chunked transfer encoding.
void ff_http_init_auth_state (URLContext *dest, const URLContext *src)
 Initialize the authentication state based on another HTTP URLContext.
static int http_open_cnx (URLContext *h)
static int http_open (URLContext *h, const char *uri, int flags)
static int http_getc (HTTPContext *s)
static int http_get_line (HTTPContext *s, char *line, int line_size)
static int process_line (URLContext *h, char *line, int line_count, int *new_location)
static int has_header (const char *str, const char *header)
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)

Variables

static const AVOption options []
static const AVClass httpcontext_class
URLProtocol ff_http_protocol


Define Documentation

#define BUFFER_SIZE   1024

Definition at line 38 of file http.c.

#define MAX_REDIRECTS   8

Definition at line 39 of file http.c.

Referenced by http_open_cnx().

#define OFFSET (  )     offsetof(HTTPContext, x)

Definition at line 55 of file http.c.


Function Documentation

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:
dest URL context whose authentication state gets updated
src URL context whose authentication state gets copied

Definition at line 86 of file http.c.

void ff_http_set_chunked_transfer_encoding ( URLContext h,
int  is_chunked 
)

Enable or disable chunked transfer encoding.

(default is enabled)

Parameters:
h URL context for this HTTP connection
is_chunked 0 to disable chunking, nonzero otherwise.

Definition at line 81 of file http.c.

void ff_http_set_headers ( URLContext h,
const char *  headers 
)

Set custom HTTP headers.

A trailing CRLF ("\r\n") is required for custom headers. Passing in an empty header string ("\0") will reset to defaults.

The following headers can be overriden by custom values, otherwise they will be set to their defaults. -User-Agent -Accept -Range -Host -Connection

Parameters:
h URL context for this HTTP connection
headers the custom headers to set

Definition at line 70 of file http.c.

Referenced by mmsh_open().

static int has_header ( const char *  str,
const char *  header 
) [inline, static]

Definition at line 285 of file http.c.

Referenced by http_connect().

static int http_close ( URLContext h  )  [static]

Definition at line 452 of file http.c.

static int http_connect ( URLContext h,
const char *  path,
const char *  hoststr,
const char *  auth,
int *  new_location 
) [static]

Definition at line 291 of file http.c.

Referenced by http_open_cnx().

static int http_get_file_handle ( URLContext h  )  [static]

Definition at line 506 of file http.c.

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

Definition at line 190 of file http.c.

Referenced by http_connect(), and http_read().

static int http_getc ( HTTPContext s  )  [static]

Definition at line 173 of file http.c.

Referenced by http_get_line().

static int http_open ( URLContext h,
const char *  uri,
int  flags 
) [static]

Definition at line 162 of file http.c.

static int http_open_cnx ( URLContext h  )  [static]

Definition at line 93 of file http.c.

Referenced by http_open(), and http_seek().

static int http_read ( URLContext h,
uint8_t *  buf,
int  size 
) [static]

Definition at line 379 of file http.c.

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

Definition at line 469 of file http.c.

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

Definition at line 426 of file http.c.

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

Definition at line 214 of file http.c.

Referenced by http_connect().


Variable Documentation

Initial value:

 {
    .name                = "http",
    .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,
}

Definition at line 512 of file http.c.

const AVClass httpcontext_class [static]

Initial value:

 {
    .class_name     = "HTTP",
    .item_name      = av_default_item_name,
    .option         = options,
    .version        = LIBAVUTIL_VERSION_INT,
}

Definition at line 60 of file http.c.

const AVOption options[] [static]

Initial value:

 {
{"chunksize", "use chunked transfer-encoding for posts, -1 disables it, 0 enables it", OFFSET(chunksize), FF_OPT_TYPE_INT64, {.dbl = 0}, -1, 0 }, 
{NULL}
}

Definition at line 56 of file http.c.


Generated on Fri Oct 26 02:39:48 2012 for FFmpeg by  doxygen 1.5.8