Commit 25667b7e authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by Jean-Baptiste Kempf

http: write GET line in one go

This can save on TCP packet if Nagle somehow fails, and work around
bugs in some broken HTTP servers.
(cherry picked from commit 1924e5e8)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 3b457acd
...@@ -1244,12 +1244,13 @@ static int Request( access_t *p_access, uint64_t i_tell ) ...@@ -1244,12 +1244,13 @@ static int Request( access_t *p_access, uint64_t i_tell )
const char *psz_path = p_sys->url.psz_path; const char *psz_path = p_sys->url.psz_path;
if( !psz_path || !*psz_path ) if( !psz_path || !*psz_path )
psz_path = "/"; psz_path = "/";
net_Write( p_access, p_sys->fd, pvs, "GET ", 4 );
if( p_sys->b_proxy && pvs == NULL ) if( p_sys->b_proxy && pvs == NULL )
net_Printf( p_access, p_sys->fd, NULL, "http://%s:%d", net_Printf( p_access, p_sys->fd, NULL,
p_sys->url.psz_host, p_sys->url.i_port ); "GET http://%s:%d HTTP/1.%d\r\n",
net_Printf( p_access, p_sys->fd, pvs, "%s HTTP/1.%d\r\n", p_sys->url.psz_host, p_sys->url.i_port, p_sys->i_version );
psz_path, p_sys->i_version ); else
net_Printf( p_access, p_sys->fd, pvs, "GET %s HTTP/1.%d\r\n",
psz_path, p_sys->i_version );
if( p_sys->url.i_port != (pvs ? 443 : 80) ) if( p_sys->url.i_port != (pvs ? 443 : 80) )
net_Printf( p_access, p_sys->fd, pvs, "Host: %s:%d\r\n", net_Printf( p_access, p_sys->fd, pvs, "Host: %s:%d\r\n",
p_sys->url.psz_host, p_sys->url.i_port ); p_sys->url.psz_host, p_sys->url.i_port );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment