Opened 19 months ago

Closed 19 months ago

Last modified 19 months ago

#9031 closed defect (wontfix)

[ffmpeg >4.2] http_proxy doesn't work if user or password contains hash

Reported by: sebaro Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: regression
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

http_proxy='http://proxy:1##2]3&456@121.0.0.1:80' ./ffprobe http://test
ffprobe version N-100400-g001bc594d8 Copyright (c) 2007-2020 the FFmpeg developers

built with gcc 8.2.0 (Gentoo Hardened 8.2.0-r6 p1.7)
configuration:
libavutil 56. 62.100 / 56. 62.100
libavcodec 58.115.102 / 58.115.102
libavformat 58. 65.100 / 58. 65.100
libavdevice 58. 11.103 / 58. 11.103
libavfilter 7. 93.100 / 7. 93.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100

[tcp @ 0x55dfcc4a07c0] Failed to resolve hostname proxy: Name or service not known

It works with no hash in user or password:

http_proxy='http://proxy:1222]3&456@121.0.0.1:80' ./ffprobe http://test
ffprobe version N-100400-g001bc594d8 Copyright (c) 2007-2020 the FFmpeg developers

built with gcc 8.2.0 (Gentoo Hardened 8.2.0-r6 p1.7)
configuration:
libavutil 56. 62.100 / 56. 62.100
libavcodec 58.115.102 / 58.115.102
libavformat 58. 65.100 / 58. 65.100
libavdevice 58. 11.103 / 58. 11.103
libavfilter 7. 93.100 / 7. 93.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100

[tcp @ 0x56239f22f7c0] Connection to tcp://121.0.0.1:80 failed: Connection refused

It works with version 4.2:

http_proxy='http://proxy:1##2]3&456@121.0.0.1:80' ffprobe http://test
ffprobe version 4.2.4 Copyright (c) 2007-2020 the FFmpeg developers

built with gcc 8.2.0 (Gentoo Hardened 8.2.0-r6 p1.7)
configuration:
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100

[tcp @ 0x5618b54a3d60] Connection to tcp://121.0.0.1:80 failed: Connection refused

Change History (5)

comment:1 by Carl Eugen Hoyos, 19 months ago

Keywords: regression added

Please use git bisect to find the change introducing the regression.

comment:2 by Marton Balint, 19 months ago

The previous parsing was wrong, now the URL is parsed correctly which changed behaviour. Your proxy URL refers server "proxy" on port 1, the rest is URL fragment, which is ignored. You should try escaping the proxy password and check if it works or not.

comment:3 by sebaro, 19 months ago

@cus
You mean now ffmpeg supports URI/hash fragment in http_proxy?
It works with encoded hash "%23".

comment:4 by Marton Balint, 19 months ago

Resolution: wontfix
Status: newclosed

As far as I know it makes no sense to use a fragment in http_proxy, but the same URL parsing routine is used for http_proxy which is used for regular URL parsing which supports parsing a fragment. And that is the *proper* way to parse an URL.

So this is a wontfix, please escape password if special characters are needed. ffmpeg behaves as other programs like wget or curl now.

comment:5 by sebaro, 19 months ago

I understand, thanks.

Maybe some doc updates for it:

http_proxy
set HTTP proxy to tunnel through e.g. http://example.com:1234
http_proxy
set HTTP proxy to tunnel through e.g. http[s]://[user:password@]example.com:1234[#fragment]
(URL encode special characters)
Note: See TracTickets for help on using tickets.