New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User-agent is not set for all requests #4155
Comments
|
Use --user-agent? |
|
Actually you do. I thought you were using --http-header-fields. No idea what that part in your post is about then. |
|
Looks like this is with HLS, and the options are not passed down correctly to further requests. Since you cut the log, I can't tell which ffmpeg version you used either (and whether it's already fixed), so whatever. |
|
This was with ffmpeg 3.2.4. I also tried the head version, same result. Will see if I can report the bug over at the ffmpeg project then. |
|
Looking at this further, I guess it's possible that the HLS demuxer doesn't care what we set on on the HTTP input, and wants the options "extra". Can you try this patch: http://sprunge.us/UHFP |
|
Same result w/ the patch. Here's a more complete log if it helps: |
|
Yeah, then seems like libavformat is just ignoring these options. There'd be more confidence in this if there were an open call that succeeds, because then we'd know whether the provided options were actually consumed. The patch I've mentioned might be required anyway. |
|
@wm4 I debugged this a bit further and it seems to be an issue of using https://github.com/mpv-player/mpv/blob/master/stream/stream_lavf.c#L205 The ffmpeg code does not find the correct value and just uses the default user agent. Not sure where the right place to fix this is. |
|
Apparently user-agent is deprecated and one should use user_agent. Does it work if you change that in mpv? |
|
I tried two things:
av_dict_set(dict, "user-agent", opts->useragent, 0);
update_options(&c->user_agent, "user_agent", u);both worked. that's what I meant with "not sure where to fix this". if |
|
Yes. Technically, both stream_lavf.c and hls.c need to be changed. |
|
Sorry, I must be blind. stream_lavf.c uses the correct value, so only hls.c needs to be changed. |
|
Thanks. Is the mpv patch I posted needed? |
|
No, it's not needed. |
This came up while debugging a problem with mpv: mpv-player/mpv#4155 Signed-off-by: wm4 <nfxjfg@googlemail.com>
This came up while debugging a problem with mpv: mpv-player/mpv#4155 Signed-off-by: wm4 <nfxjfg@googlemail.com> (cherry picked from commit aff80aa) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
mpv version and platform
Reproduction steps
(see log file header)
Expected behavior
User agent is set for all requests
Actual behavior
User-agent is set correctly in the first few requests, later ones use the default of "Lavf/57.56.101"
Log file
https://gist.github.com/jberkel/e44b9e9d87199be935270023808b434b
Note line 72:
Workaround
Explicitly specify user-agent field in headers:
The text was updated successfully, but these errors were encountered: