commit 959d7a23be2d50d4edc22d2551d33f37fda96d33
Author: Dirkjan Ochtman <d.ochtman@activevideo.com>
Date:   Mon Dec 23 16:07:10 2013 +0100

    Add flag stay_connected to SoupConnection

diff --git a/libsoup/soup-connection.c b/libsoup/soup-connection.c
index 2b5dc49..d6bed01 100644
--- a/libsoup/soup-connection.c
+++ b/libsoup/soup-connection.c
@@ -21,7 +21,7 @@ typedef struct {
 	SoupURI *remote_uri, *proxy_uri;
 	GProxyResolver *proxy_resolver;
 	GTlsDatabase *tlsdb;
-	gboolean ssl, ssl_strict, ssl_fallback;
+	gboolean ssl, ssl_strict, ssl_fallback, stay_connected;
 
 	GMainContext *async_context;
 	gboolean      use_thread_context;
@@ -60,6 +60,7 @@ enum {
 	PROP_TIMEOUT,
 	PROP_IDLE_TIMEOUT,
 	PROP_STATE,
+	PROP_STAY_CONNECTED,
 
 	LAST_PROP
 };
@@ -99,7 +100,7 @@ soup_connection_dispose (GObject *object)
 
 	stop_idle_timer (priv);
 
-	if (priv->socket) {
+	if (priv->socket && !priv->stay_connected) {
 		g_warning ("Disposing connection while connected");
 		soup_connection_disconnect (conn);
 	}
@@ -154,6 +155,9 @@ soup_connection_set_property (GObject *object, guint prop_id,
 	case PROP_STATE:
 		soup_connection_set_state (SOUP_CONNECTION (object), g_value_get_uint (value));
 		break;
+	case PROP_STAY_CONNECTED:
+		priv->stay_connected = g_value_get_boolean (value);
+		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
@@ -200,6 +204,9 @@ soup_connection_get_property (GObject *object, guint prop_id,
 	case PROP_STATE:
 		g_value_set_enum (value, priv->state);
 		break;
+	case PROP_STAY_CONNECTED:
+		g_value_set_boolean (value, priv->stay_connected);
+		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
@@ -323,6 +330,13 @@ soup_connection_class_init (SoupConnectionClass *connection_class)
 				   "Current state of connection",
 				   SOUP_TYPE_CONNECTION_STATE, SOUP_CONNECTION_NEW,
 				   G_PARAM_READWRITE));
+	g_object_class_install_property (
+		object_class, PROP_STAY_CONNECTED,
+		g_param_spec_boolean (SOUP_CONNECTION_STAY_CONNECTED,
+				  "Stay connected",
+				  "Whether the connection should stay connected on disposal",
+				  FALSE,
+				  G_PARAM_READWRITE));
 }
 
 static void
diff --git a/libsoup/soup-connection.h b/libsoup/soup-connection.h
index b70a8a3..ab6a18d 100644
--- a/libsoup/soup-connection.h
+++ b/libsoup/soup-connection.h
@@ -48,6 +48,7 @@ GType soup_connection_get_type (void);
 #define SOUP_CONNECTION_IDLE_TIMEOUT    "idle-timeout"
 #define SOUP_CONNECTION_STATE           "state"
 #define SOUP_CONNECTION_MESSAGE         "message"
+#define SOUP_CONNECTION_STAY_CONNECTED	"stay-connected"
 
 void            soup_connection_connect_async    (SoupConnection       *conn,
 						  GCancellable         *cancellable,
