[vlc-commits] http: write GET line in one go

Rémi Denis-Courmont git at videolan.org
Thu Jul 12 16:16:50 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Jul 12 17:15:40 2012 +0300| [1924e5e81dcdb226e67933c54a48cba7f910d4bb] | committer: 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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1924e5e81dcdb226e67933c54a48cba7f910d4bb
---

 modules/access/http.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/modules/access/http.c b/modules/access/http.c
index d540e62..ccd416f 100644
--- a/modules/access/http.c
+++ b/modules/access/http.c
@@ -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 );



More information about the vlc-commits mailing list