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



commit bae4d3c76145f70ba56df98899134e50c042c7f4
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..2baa6ad 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 " ", 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]