[vlc-devel] VLC Socket HTTP Bug - User agent
Robi
synaphis at gmail.com
Tue Jun 28 07:20:20 CEST 2011
Hello,
== Bug Summary ==
When opening a network stream with VLC, on some servers requiring a specific
user-agent (like 38.108.112.114:8810 requiring KPeerClient), it doesn't
work, VLC doesn't even have time to send the user-agent information.
In fact it works one time out of something like 20, it is kind of random. I
think this is due to the server shutting down the connection as soon as it
receive the first packet (GET) and seeing there is not the wanted
user-agent.
I checked with a packet sniffer and then by looking at the source code and
VLC does in fact send the user-agent in a different packet, just after the
GET packet, causing this problem.
== How to fix ==
In the file modules/access/http.c line around 12XX (function Request)
I think there should be only a single call to the net_Printf function in
order to send all the informations in a single packet and thus preventing
this problem.
To do so, a String or something similar could be used and be filled out with
the packet data little by little before being sent (basically, str = "GET
....", then str += "User-agent: ....", and finally net_Printf(....,str)) or
something like that.
As I've never worked on VLC source code, I'm not really sure the best way of
doing it, that's why I sent this e-mail, hoping I gave enough information
for someone to fix this problem easily.
== Where to fix ==
[...]
net_Printf( p_access, p_sys->fd, pvs,
"GET %s HTTP/1.%d\r\nHost: %s:%d\r\n",
psz_path, p_sys->i_version, p_sys->url.psz_host,
p_sys->url.i_port );
}
else
{
net_Printf( p_access, p_sys->fd, pvs,
"GET %s HTTP/1.%d\r\nHost: %s\r\n",
psz_path, p_sys->i_version, p_sys->url.psz_host );
}
}
/* User Agent */
net_Printf( p_access, p_sys->fd, pvs,
"User-Agent: %s\r\n",
p_sys->psz_user_agent );
[...]
Best Regards,
Robin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110628/b0c8c064/attachment.html>
More information about the vlc-devel
mailing list