[Xfce4-commits] <xfce4-weather-plugin:master> Make auto-detection by IP address work again.

Harald Judt noreply at xfce.org
Wed Jul 18 14:40:01 CEST 2012


Updating branch refs/heads/master
         to a2a6e2a54370e8d01bca5c502f1d85263c28b897 (commit)
       from e892eb2008ab68c2feaf8583bdffcf42ebe64e06 (commit)

commit a2a6e2a54370e8d01bca5c502f1d85263c28b897
Author: Harald Judt <h.judt at gmx.at>
Date:   Wed Jul 18 14:33:14 2012 +0200

    Make auto-detection by IP address work again.
    
    Nick installed a new GeoIP service at geoip.xfce.org.
    
    Because the new server uses chunked HTTP and I don't feel like
    implementing a decode routine for it, let's make a special request
    only for GeoIP that uses HTTP/1.0 instead of HTTP/1.1.

 panel-plugin/weather-http.c   |   12 +++++++-----
 panel-plugin/weather-search.c |    4 +---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/panel-plugin/weather-http.c b/panel-plugin/weather-http.c
index 1834343..7caa1cf 100644
--- a/panel-plugin/weather-http.c
+++ b/panel-plugin/weather-http.c
@@ -267,11 +267,13 @@ weather_http_receive_data_idle (gpointer user_data)
   if (connection->proxy_host)
     request = g_strdup_printf ("GET http://%s%s HTTP/1.0\r\n\r\n", connection->hostname, connection->url);
   else
-    request = g_strdup_printf ("GET %s HTTP/1.1\r\n"
-    				"Host: %s\r\n"
-				"Connection: close\r\n"
-				"\r\n",
-				connection->url, connection->hostname);
+    request = g_strdup_printf ("GET %s HTTP/1.%d\r\n"
+                               "Host: %s\r\n"
+                               "Connection: close\r\n"
+                               "\r\n",
+                               connection->url,
+                               strcmp(connection->hostname, "geoip.xfce.org") ? 1 : 0,
+                               connection->hostname);
 
   /* send the request */
   for (m = 0, n = strlen (request); m < n;)
diff --git a/panel-plugin/weather-search.c b/panel-plugin/weather-search.c
index 68f84a9..815e62e 100644
--- a/panel-plugin/weather-search.c
+++ b/panel-plugin/weather-search.c
@@ -550,9 +550,7 @@ void weather_search_by_ip(
   data->proxy_host = proxy_host;
   data->proxy_port = proxy_port;
 
-  /* archive.xfce.org is our download server that runs mod_geoip
-   * with the www.maxmind.com database */
-  weather_http_receive_data ("archive.xfce.org", "/geolocation",
+  weather_http_receive_data ("geoip.xfce.org", "/",
                              proxy_host, proxy_port,
                              cb_geolocation, data);
   return;


More information about the Xfce4-commits mailing list