[FFmpeg-devel] [PATCH] avformat/http: remove duplicate user-agent option

Steven Liu lingjiujianke at gmail.com
Fri Sep 16 05:43:30 EEST 2016


2016-09-16 1:08 GMT+08:00 Clément Bœsch <u at pkh.me>:

> On Fri, Sep 16, 2016 at 12:41:41AM +0800, Steven Liu wrote:
> [...]
> > update:
> >
>
> Please attach a git-format-patch or use git-send-email.
> Also, your mailer is mangling the inlined patch.
>
> >
> > add a FF_OPT_FLAG_DEPRECATED define for compile.
> > add a new variable for user_agent to give a deprecated warning message
> > ---
> >  doc/protocols.texi    |  4 +++-
> >  libavformat/http.c    | 14 ++++++++++++--
> >  libavformat/version.h |  3 +++
> >  3 files changed, 18 insertions(+), 3 deletions(-)
> >
> > diff --git a/doc/protocols.texi b/doc/protocols.texi
> > index 470c99c..3acdc78 100644
> > --- a/doc/protocols.texi
> > +++ b/doc/protocols.texi
> > @@ -292,10 +292,12 @@ Use persistent connections if set to 1, default is
> 0.
> >  Set custom HTTP post data.
> >
> >  @item user-agent
> > - at item user_agent
> >  Override the User-Agent header. If not specified the protocol will use a
> >  string describing the libavformat build. ("Lavf/<version>")
> >
> > + at item user_agent
> > +This is a deprecated option, you can use user-agent instead it.
> > +
>
> Again, you don't want to deprecate "user_agent", that's the one you want
> to keep (because it's consistent with the other options).
>
> >  @item timeout
> >  Set timeout in microseconds 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
> > diff --git a/libavformat/http.c b/libavformat/http.c
> > index adb3d92..0b8a86c 100644
> > --- a/libavformat/http.c
> > +++ b/libavformat/http.c
> > @@ -71,6 +71,9 @@ typedef struct HTTPContext {
> >      char *headers;
> >      char *mime_type;
> >      char *user_agent;
>
> > +#ifdef FF_OPT_FLAG_DEPRECATED
>
> The FF_OPT_FLAG_DEPRECATED name is related to a generic approach for
> deprecating AVOption (by adding an AVOption flag, and patching
> lavu/opt.c). In your case, you want to use FF_API_HTTP_USER_AGENT.
>
> > +    attribute_deprecated char *user_agent_deprecated;
>
> again, you don't want to use attribute_deprecated.
>
> > +#endif
> >      char *content_type;
> >      /* Set if the server correctly handles Connection: close and will
> close
> >       * the connection after feeding us the content. */
> > @@ -130,7 +133,9 @@ static const AVOption options[] = {
> >      { "http_proxy", "set HTTP proxy to tunnel through",
> > OFFSET(http_proxy), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D | E },
> >      { "headers", "set custom HTTP headers, can override built in default
> > headers", OFFSET(headers), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D
> | E
> > },
> >      { "content_type", "set a specific content type for the POST
> messages",
> > OFFSET(content_type), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D | E },
> > -    { "user_agent", "override User-Agent header", OFFSET(user_agent),
> > AV_OPT_TYPE_STRING, { .str = DEFAULT_USER_AGENT }, 0, 0, D },
> > +#ifdef FF_OPT_FLAG_DEPRECATED
> > +    { "user_agent", "override User-Agent header",
> > OFFSET(user_agent_deprecated), AV_OPT_TYPE_STRING, { .str =
> > DEFAULT_USER_AGENT }, 0, 0, D },
> > +#endif
> >      { "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_BOOL, { .i64 = 0 }, 0, 1, D | E },
> >      { "post_data", "set custom HTTP post data", OFFSET(post_data),
> > AV_OPT_TYPE_BINARY, .flags = D | E },
> > @@ -1036,7 +1041,12 @@ static int http_connect(URLContext *h, const char
> > *path, const char *local_path,
> >              s->http_code != 401)
> >              send_expect_100 = 1;
> >      }
>
> > -
>
> You should keep that empty line
>
> [...]
>
> --
> Clément B.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-avformat-http-will-remove-option-user_agent.patch
Type: application/octet-stream
Size: 3943 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160916/ef17150b/attachment.obj>


More information about the ffmpeg-devel mailing list