svnno****@sourc*****
svnno****@sourc*****
Sun Apr 15 21:41:18 JST 2007
Revision: 3197 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=kazehakase&view=rev&rev=3197 Author: kous Date: 2007-04-15 21:41:18 +0900 (Sun, 15 Apr 2007) Log Message: ----------- * src/net/kz-http.c (cb_http_connect): don't add ":PORT" to "Host" header. Modified Paths: -------------- kazehakase/trunk/ChangeLog kazehakase/trunk/src/net/kz-http.c Modified: kazehakase/trunk/ChangeLog =================================================================== --- kazehakase/trunk/ChangeLog 2007-04-14 22:48:47 UTC (rev 3196) +++ kazehakase/trunk/ChangeLog 2007-04-15 12:41:18 UTC (rev 3197) @@ -1,3 +1,8 @@ +2007-04-15 Kouhei Sutou <kou****@cozmi*****> + + * src/net/kz-http.c (cb_http_connect): don't add ":PORT" to "Host" + header. + 2007-04-15 Hiroyuki Ikezoe <poinc****@ikezo*****> * module/embed/gtk-webcore/kz-gtk-webcore.cpp: Load URL after creating Modified: kazehakase/trunk/src/net/kz-http.c =================================================================== --- kazehakase/trunk/src/net/kz-http.c 2007-04-14 22:48:47 UTC (rev 3196) +++ kazehakase/trunk/src/net/kz-http.c 2007-04-15 12:41:18 UTC (rev 3197) @@ -1031,7 +1031,7 @@ } -static void +static void cb_http_connect(GTcpSocket *socket, GTcpSocketConnectAsyncStatus status, gpointer data) { @@ -1041,7 +1041,7 @@ gchar *command, *tmp_ua; const gchar *method = methods[0]; gsize n; - gchar *URL, *host_header, *user_agent = NULL; + gchar *URL, *host_header = NULL, *user_agent = NULL; gboolean override = FALSE; KzHTTPPrivate *priv = KZ_HTTP_GET_PRIVATE (data); @@ -1089,20 +1089,22 @@ #ifdef USE_SSL if (priv->kz_ssl) - { host_header = g_strdup_printf("Host: %s\r\n", priv->hostname); - } - else +#endif + + if (!host_header) { - host_header = g_strdup_printf("Host: %s:%u\r\n", - priv->hostname, priv->port); + if (priv->port == 80) + host_header = g_strdup_printf("Host: %s\r\n", + priv->hostname); + else + host_header = g_strdup_printf("Host: %s:%u\r\n", + priv->hostname, + priv->port); } -#else - host_header = g_strdup_printf("Host: %s:%u\r\n", - priv->hostname, priv->port); -#endif + KZ_CONF_GET("Global", "override_user_agent", override, BOOL); if (override) user_agent = KZ_CONF_GET_STR("Global", "user_agent");