summaryrefslogtreecommitdiff
path: root/plugins/common/RESTSupport.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2026-03-09 18:19:48 +0100
committerJörg Frings-Fürst <debian@jff.email>2026-03-09 18:19:48 +0100
commitb11befe1c9ea84969ebd418e96f7209b772b58d0 (patch)
tree4cee94cb12ad4dd24253c2a111b87577f50ed80d /plugins/common/RESTSupport.vala
parentd048b2c970f6182a2201b5ba6c29d0d155abc22b (diff)
parent8656a544ddcf098e10df1430eecb75902dbc7999 (diff)
Merge branch 'release/debian/0.32.15-1'HEADdebian/0.32.15-1master
Diffstat (limited to 'plugins/common/RESTSupport.vala')
-rw-r--r--plugins/common/RESTSupport.vala12
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/common/RESTSupport.vala b/plugins/common/RESTSupport.vala
index cc810fe..13286de 100644
--- a/plugins/common/RESTSupport.vala
+++ b/plugins/common/RESTSupport.vala
@@ -4,6 +4,8 @@
* (version 2.1 or later). See the COPYING file in this distribution.
*/
+extern const string _VERSION;
+
namespace Publishing.RESTSupport {
// Ported from librest
@@ -34,9 +36,11 @@ public abstract class Session {
public signal void authenticated();
public signal void authentication_failed(Spit.Publishing.PublishingError err);
- protected Session(string? endpoint_url = null) {
+ protected Session(string? endpoint_url = null, Soup.SessionFeature[] features = {}) {
this.endpoint_url = endpoint_url;
soup_session = new Soup.Session ();
+ // The trailing space is intentional to make libsoup append its version info
+ soup_session.set_user_agent("Shotwell/%s ".printf(_VERSION));
if (Environment.get_variable("SHOTWELL_SOUP_LOG") != null) {
var logger = new Soup.Logger(Soup.LoggerLogLevel.BODY);
logger.set_request_filter((logger, msg) => {
@@ -49,6 +53,10 @@ public abstract class Session {
});
soup_session.add_feature (logger);
}
+
+ foreach (var feature in features) {
+ soup_session.add_feature(feature);
+ }
}
protected void notify_wire_message_unqueued(Soup.Message message) {
@@ -361,7 +369,7 @@ public class Transaction {
protected virtual void add_header(string key, string value) {
message.request_headers.append(key, value);
}
-
+
// set custom_payload to null to have this transaction send the default payload of
// key-value pairs appended through add_argument(...) (this is how most REST requests work).
// To send a payload other than traditional key-value pairs (such as an XML document or a JPEG