[libgweather/wip/hadess/fix-iwin-queries: 1/6] GWeatherWeather: Always set a user-agent when doing queries



commit b0ad28282ec7d25cfb43aa245ecbe770d78f9f9f
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Aug 26 14:55:12 2019 +0300

    GWeatherWeather: Always set a user-agent when doing queries
    
    This should fix IWIN queries not working (403) because it didn't
    appreciate the lack of user-agent.

 libgweather/gweather-weather.c | 2 ++
 meson.build                    | 1 +
 2 files changed, 3 insertions(+)
---
diff --git a/libgweather/gweather-weather.c b/libgweather/gweather-weather.c
index 571a3e0..6254316 100644
--- a/libgweather/gweather-weather.c
+++ b/libgweather/gweather-weather.c
@@ -595,6 +595,8 @@ ref_session (void)
        return g_object_ref (session);
 
     session = soup_session_new ();
+    g_object_set (G_OBJECT (session), SOUP_SESSION_USER_AGENT,
+                  "libgweather/" LIBGWEATHER_VERSION " (+https://gitlab.gnome.org/GNOME/libgweather/) ", 
NULL);
 
     cache = get_cache ();
     if (cache != NULL) {
diff --git a/meson.build b/meson.build
index 06860c6..57b2496 100644
--- a/meson.build
+++ b/meson.build
@@ -60,6 +60,7 @@ config_h.set_quoted('LOCALEDIR', join_paths(datadir, 'locale'))
 config_h.set_quoted('GNOMELOCALEDIR', join_paths(datadir, 'locale'))
 config_h.set_quoted('G_LOG_DOMAIN', 'GWeather')
 config_h.set_quoted('GWEATHER_XML_LOCATION_DIR', pkgdatadir)
+config_h.set_quoted('LIBGWEATHER_VERSION', meson.project_version())
 
 if c_compiler.has_member('struct tm', 'tm_gmtoff', prefix: '#include <time.h>')
   config_h.set('HAVE_TM_TM_GMOFF', 1)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]