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

Rémi Denis-Courmont git at videolan.org
Fri Jul 13 05:00:12 CEST 2012


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

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=25667b7e87141887f057d4422668067408817015
---

 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 7c1ca8a..ffbffd7 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