OSDN Git Service

Merge commit 'ddfc98906373d1f17f6205cedd14c68d7a75995f'
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 12 Mar 2014 02:44:23 +0000 (03:44 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 12 Mar 2014 02:45:16 +0000 (03:45 +0100)
* commit 'ddfc98906373d1f17f6205cedd14c68d7a75995f':
  http: Support setting custom User-Agent

Conflicts:
doc/protocols.texi
libavformat/http.c

See: 2bb1c713cc7e8fd018a3a0b579145a31a1c47bce
Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
doc/protocols.texi
libavformat/http.c

@@@ -216,36 -92,9 +216,37 @@@ HTTP (Hyper Text Transfer Protocol)
  This protocol accepts the following options:
  
  @table @option
- Override User-Agent header. If not specified the protocol will use a
- string describing the libavformat build.
 +@item seekable
 +Control seekability of connection. If set to 1 the resource is
 +supposed to be seekable, if set to 0 it is assumed not to be seekable,
 +if set to -1 it will try to autodetect if it is seekable. Default
 +value is -1.
 +
 +@item chunked_post
 +If set to 1 use chunked transfer-encoding for posts, default is 1.
 +
 +@item headers
 +Set custom HTTP headers, can override built in default headers. The
 +value must be a string encoding the headers.
 +
 +@item content_type
 +Force a content type.
 +
 +@item user-agent
 -Override the User-Agent header. If not specified a string of the form
 -"Lavf/<version>" will be used.
+ @item user_agent
++Override the User-Agent header. If not specified the protocol will use a
++string describing the libavformat build. ("Lavf/<version>")
 +
 +@item multiple_requests
 +Use persistent connections if set to 1. By default it is 0.
 +
 +@item post_data
 +Set custom HTTP post data.
 +
 +@item timeout
 +Set timeout of socket I/O operations used by the underlying low level
 +operation. By default it is set to -1, which means that the timeout is
 +not specified.
  
  @item mime_type
  Export the MIME type.
@@@ -51,9 -51,7 +51,8 @@@ typedef struct 
      int http_code;
      /* Used if "Transfer-Encoding: chunked" otherwise -1. */
      int64_t chunksize;
 -    int64_t off, filesize;
 +    char *content_type;
-     char *user_agent;
 +    int64_t off, filesize, req_end_offset;
      char *location;
      HTTPAuthState auth_state;
      HTTPAuthState proxy_auth_state;
  #define E AV_OPT_FLAG_ENCODING_PARAM
  #define DEFAULT_USER_AGENT "Lavf/" AV_STRINGIFY(LIBAVFORMAT_VERSION)
  static const AVOption options[] = {
 +{"seekable", "control seekability of connection", OFFSET(seekable), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, D },
  {"chunked_post", "use chunked transfer-encoding for posts", OFFSET(chunked_post), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, E },
 -{"headers", "custom HTTP headers, can override built in default headers", OFFSET(headers), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D|E },
 +{"headers", "set custom HTTP headers, can override built in default headers", OFFSET(headers), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D|E },
 +{"content_type", "force a content type", OFFSET(content_type), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D|E },
+ {"user_agent", "override User-Agent header", OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = DEFAULT_USER_AGENT}, 0, 0, D },
 -{"user-agent", "override User-Agent header, for compatibility with ffmpeg", OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = DEFAULT_USER_AGENT}, 0, 0, D },
 +{"user-agent", "override User-Agent header", OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = DEFAULT_USER_AGENT}, 0, 0, D },
  {"multiple_requests", "use persistent connections", OFFSET(multiple_requests), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, D|E },
 -{"post_data", "custom HTTP post data", OFFSET(post_data), AV_OPT_TYPE_BINARY, .flags = D|E },
 +{"post_data", "set custom HTTP post data", OFFSET(post_data), AV_OPT_TYPE_BINARY, .flags = D|E },
  {"mime_type", "export the MIME type", OFFSET(mime_type), AV_OPT_TYPE_STRING, {0}, 0, 0, AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY  },
 +{"cookies", "set cookies to be sent in applicable future requests, use newline delimited Set-Cookie HTTP field value syntax", OFFSET(cookies), AV_OPT_TYPE_STRING, {0}, 0, 0, D },
  {"icy", "request ICY metadata", OFFSET(icy), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, D },
  {"icy_metadata_headers", "return ICY metadata headers", OFFSET(icy_metadata_headers), AV_OPT_TYPE_STRING, {0}, 0, 0, AV_OPT_FLAG_EXPORT },
  {"icy_metadata_packet", "return current ICY metadata packet", OFFSET(icy_metadata_packet), AV_OPT_TYPE_STRING, {0}, 0, 0, AV_OPT_FLAG_EXPORT },