[vlc-devel] VLC Socket HTTP Bug - User agent

Rémi Denis-Courmont remi at remlab.net
Tue Jun 28 18:17:51 CEST 2011


That's a bug in the HTTP server. Assuming that TCP data comes as a single 
packet is a blatant violation of the HTTP specification.

Le mardi 28 juin 2011 08:20:20 Robi, vous avez écrit :
> 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


-- 
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis



More information about the vlc-devel mailing list