Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Martin Storsjö" <martin@martin.st>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH v17 4/5] libavformat: Remove MAX_PATH limit and use UTF-8 version of getenv()
Date: Sun, 19 Jun 2022 01:40:38 +0300 (EEST)
Message-ID: <17d5cd6e-56d3-3a0-7c8c-399cda2c6b1@martin.st> (raw)
In-Reply-To: <20220617093141.9826-4-nil-admirari@mailo.com>

On Fri, 17 Jun 2022, Nil Admirari wrote:

> 1. getenv() is replaced with getenv_utf8() across libavformat.
> 2. New versions of AviSynth+ are now called with UTF-8 filenames.
> 3. Old versions of AviSynth are still using ANSI strings,
>   but MAX_PATH limit on filename is removed.
> ---
> libavformat/avisynth.c    | 39 +++++++++++++++++++++++++++------------
> libavformat/http.c        | 20 +++++++++++++-------
> libavformat/ipfsgateway.c | 35 +++++++++++++++++++++++------------
> libavformat/tls.c         | 11 +++++++++--
> 4 files changed, 72 insertions(+), 33 deletions(-)
>
> @@ -198,6 +199,7 @@ void ff_http_init_auth_state(URLContext *dest, const URLContext *src)
> static int http_open_cnx_internal(URLContext *h, AVDictionary **options)
> {
>     const char *path, *proxy_path, *lower_proto = "tcp", *local_path;
> +    char *env_http_proxy, *env_no_proxy;
>     char *hashmark;
>     char hostname[1024], hoststr[1024], proto[10];
>     char auth[1024], proxyauth[1024] = "";
> @@ -211,9 +213,13 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options)
>                  path1, sizeof(path1), s->location);
>     ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL);
>
> -    proxy_path = s->http_proxy ? s->http_proxy : getenv("http_proxy");
> -    use_proxy  = !ff_http_match_no_proxy(getenv("no_proxy"), hostname) &&
> +    env_http_proxy = getenv_utf8("http_proxy");
> +    proxy_path = s->http_proxy ? s->http_proxy : env_http_proxy;
> +
> +    env_no_proxy = getenv_utf8("no_proxy");
> +    use_proxy  = !ff_http_match_no_proxy(env_no_proxy, hostname) &&
>                  proxy_path && av_strstart(proxy_path, "http://", NULL);
> +    av_freep(&env_no_proxy);
>
>     if (!strcmp(proto, "https")) {
>         lower_proto = "tls";
> @@ -224,7 +230,7 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options)
>         if (s->http_proxy) {
>             err = av_dict_set(options, "http_proxy", s->http_proxy, 0);
>             if (err < 0)
> -                return err;
> +                goto end;
>         }
>     }
>     if (port < 0)
> @@ -259,12 +265,12 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options)
>         err = ffurl_open_whitelist(&s->hd, buf, AVIO_FLAG_READ_WRITE,
>                                    &h->interrupt_callback, options,
>                                    h->protocol_whitelist, h->protocol_blacklist, h);
> -        if (err < 0)
> -            return err;
>     }
>
> -    return http_connect(h, path, local_path, hoststr,
> -                        auth, proxyauth);
> +end:
> +    av_freep(&env_http_proxy);
> +    return err < 0 ? err : http_connect(
> +        h, path, local_path, hoststr, auth, proxyauth);
> }

FWIW - I wasn't entirely sure we can conclude that we always pass through 
a case that initializes the err variable here, so just to be sure, I 
locally amended this patch to initialize the err variable to 0 too.

// Martin

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2022-06-18 22:40 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-17  9:31 [FFmpeg-devel] [PATCH v17 1/5] libavutil: Add wchartoutf8(), wchartoansi(), utf8toansi() and getenv_utf8() Nil Admirari
2022-06-17  9:31 ` [FFmpeg-devel] [PATCH v17 2/5] compat/w32dlfcn.h: Remove MAX_PATH limit and replace LoadLibraryExA with LoadLibraryExW Nil Admirari
2022-06-17  9:31 ` [FFmpeg-devel] [PATCH v17 3/5] fftools: Remove MAX_PATH limit and switch to UTF-8 versions of fopen() and getenv() Nil Admirari
2022-06-17  9:31 ` [FFmpeg-devel] [PATCH v17 4/5] libavformat: Remove MAX_PATH limit and use UTF-8 version of getenv() Nil Admirari
2022-06-18 22:24   ` Martin Storsjö
2022-06-18 22:36     ` Martin Storsjö
2022-06-18 22:48     ` Soft Works
2022-06-19  7:49       ` Martin Storsjö
2022-06-19  8:00         ` Soft Works
2022-06-19 11:44         ` nil-admirari
2022-06-18 22:40   ` Martin Storsjö [this message]
2022-06-19 11:47     ` nil-admirari
2022-06-17  9:31 ` [FFmpeg-devel] [PATCH v17 5/5] libavfilter/vf_frei0r.c: Use " Nil Admirari
2022-06-17 19:16 ` [FFmpeg-devel] [PATCH v17 1/5] libavutil: Add wchartoutf8(), wchartoansi(), utf8toansi() and getenv_utf8() Soft Works
2022-06-18 22:21 ` Martin Storsjö
2022-06-19 11:49   ` nil-admirari
2022-06-19  4:58 ` Andreas Rheinhardt
2022-06-19  5:56   ` Soft Works
2022-06-19  6:27     ` Andreas Rheinhardt
2022-06-19  7:24       ` Soft Works
2022-06-19  6:33     ` Martin Storsjö
2022-06-19  6:43       ` Andreas Rheinhardt
2022-06-19 11:56   ` nil-admirari
2022-06-20  0:54     ` Andreas Rheinhardt
2022-06-20 10:36       ` nil-admirari

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17d5cd6e-56d3-3a0-7c8c-399cda2c6b1@martin.st \
    --to=martin@martin.st \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git