Commit 1924e5e8 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

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.
parent 43d56977
......@@ -1244,12 +1244,13 @@ static int Request( access_t *p_access, uint64_t i_tell )
const char *psz_path = p_sys->url.psz_path;
if( !psz_path || !*psz_path )
psz_path = "/";
net_Write( p_access, p_sys->fd, pvs, "GET ", 4 );
if( p_sys->b_proxy && pvs == NULL )
net_Printf( p_access, p_sys->fd, NULL, "http://%s:%d",
p_sys->url.psz_host, p_sys->url.i_port );
net_Printf( p_access, p_sys->fd, pvs, "%s HTTP/1.%d\r\n",
psz_path, p_sys->i_version );
net_Printf( p_access, p_sys->fd, NULL,
"GET http://%s:%d HTTP/1.%d\r\n",
p_sys->url.psz_host, p_sys->url.i_port, 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) )
net_Printf( p_access, p_sys->fd, pvs, "Host: %s:%d\r\n",
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