[MPlayer-dev-eng] [PATCH] include port num in Host: header

Eric Lammerts eric at lammerts.org
Mon Jun 21 04:56:12 CEST 2004


Hi,
When mplayer does an HTTP request, it sends a Host: header without a
port number. But if the port number is not 80, it should be included
(according to RFC2616). Some servers get confused by this. Patch below
fixes the problem.

Eric

Index: libmpdemux/network.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/network.c,v
retrieving revision 1.100
diff -u -r1.100 network.c
--- libmpdemux/network.c	14 May 2004 23:10:43 -0000	1.100
+++ libmpdemux/network.c	16 Jun 2004 22:16:11 -0000
@@ -449,7 +449,11 @@
 		server_url = url;
 		http_set_uri( http_hdr, server_url->file );
 	}
-	snprintf(str, 256, "Host: %s", server_url->hostname );
+	if(server_url->port && server_url->port != 80) {
+		snprintf(str, 256, "Host: %s:%u", server_url->hostname, server_url->port );
+	} else {
+		snprintf(str, 256, "Host: %s", server_url->hostname );
+	}
 	http_set_field( http_hdr, str);
 	if (network_useragent)
 	{




More information about the MPlayer-dev-eng mailing list