/tmp/cvsmFCOKf
authoralex <alex>
Fri, 11 May 2001 04:23:20 +0000 (04:23 +0000)
committeralex <alex>
Fri, 11 May 2001 04:23:20 +0000 (04:23 +0000)
ChangeLog
libsoup/soup-context.c
libsoup/soup-message.c
libsoup/soup-message.h
libsoup/soup-private.h
libsoup/soup-queue.c
libsoup/soup-uri.c
libsoup/soup-uri.h

index 1346373..7316b8f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2001-05-10  Alex Graveley  <alex@ximian.com>
+
+       * src/soup-core/soup-queue.c (soup_finish_read): set
+       response.owner to SOUP_BUFFER_SYSTEM_OWNED.
+
+       * src/soup-core/soup-uri.c (soup_uri_copy): added.
+
+       * src/soup-core/soup-context.c (soup_context_get): Free the
+       temporary URI.
+       (soup_context_from_uri): dup the passed uri if creating a new context.
+
 2001-05-09  JP Rosevear  <jpr@ximian.com>
 
        * src/soup-wsdl/wsdl-soap-skels.c
index e15f6bd..e6829c1 100644 (file)
@@ -51,20 +51,24 @@ SoupContext *
 soup_context_get (gchar *uri) 
 {
        SoupUri *suri;
+       SoupContext *con;
 
        g_return_val_if_fail (uri != NULL, NULL);
 
        suri = soup_uri_new (uri);
        if (!suri) return NULL;
        
-       return soup_context_from_uri (suri);
+       con = soup_context_from_uri (suri);
+       soup_uri_free (suri);
+
+       return con;
 }
 
 /**
- * soup_context_get:
- * @uri: the stringified URI.
+ * soup_context_from_uri:
+ * @suri: a %SoupUri.
  *
- * Returns a pointer to the %SoupContext representing @uri. If a context
+ * Returns a pointer to the %SoupContext representing @suri. If a context
  * already exists for the URI, it is returned with an added reference.
  * Otherwise, a new context is created with a reference count of one.
  *
@@ -88,7 +92,7 @@ soup_context_from_uri (SoupUri *suri)
        if (!serv) {
                serv = g_new0 (SoupServer, 1);
                serv->host = g_strdup (suri->host);
-               g_hash_table_insert (soup_servers, suri->host, serv);
+               g_hash_table_insert (soup_servers, serv->host, serv);
        }
 
        if (!serv->contexts)
@@ -99,10 +103,10 @@ soup_context_from_uri (SoupUri *suri)
        if (!ret) {
                ret = g_new0 (SoupContext, 1);
                ret->server = serv;
-               ret->uri = suri;
+               ret->uri = soup_uri_copy (suri);
                ret->refcnt = 0;
 
-               g_hash_table_insert (serv->contexts, suri->path, ret);
+               g_hash_table_insert (serv->contexts, ret->uri->path, ret);
        }
 
        soup_context_ref (ret);
index 4351d0d..033d097 100644 (file)
@@ -126,9 +126,9 @@ soup_message_cancel (SoupMessage *req)
 }
 
 void
-soup_message_add_header (SoupMessage *req,
-                        gchar       *name,
-                        gchar       *value) 
+soup_message_set_request_header (SoupMessage *req,
+                                gchar       *name,
+                                gchar       *value) 
 {
        g_return_if_fail (req != NULL);
 
@@ -158,3 +158,15 @@ soup_message_send (SoupMessage *msg)
 
        return SOUP_ERROR_NONE;
 }
+
+void
+soup_message_set_flags (SoupMessage *msg, guint flags)
+{
+       msg->priv->msg_flags = flags;
+}
+
+guint
+soup_message_get_flags (SoupMessage *msg)
+{
+       return msg->priv->msg_flags;
+}
index 2289dc0..127c7bd 100644 (file)
@@ -72,32 +72,49 @@ typedef void (*SoupCallbackFn) (SoupMessage   *req,
                                SoupErrorCode  err,
                                gpointer       user_data);
 
-SoupMessage       *soup_message_new        (SoupContext       *context,
-                                           SoupAction         action);
+SoupMessage   *soup_message_new                (SoupContext       *context,
+                                               SoupAction         action);
 
-SoupMessage       *soup_message_new_full   (SoupContext       *context,
-                                           SoupAction         action,
-                                           SoupOwnership      req_owner,
-                                           gchar             *req_body,
-                                           gulong             req_length);
+SoupMessage   *soup_message_new_full           (SoupContext       *context,
+                                               SoupAction         action,
+                                               SoupOwnership      req_owner,
+                                               gchar             *req_body,
+                                               gulong             req_length);
 
-void               soup_message_free       (SoupMessage       *msg);
+void           soup_message_free               (SoupMessage       *msg);
 
-void               soup_message_cancel     (SoupMessage       *msg);
+void           soup_message_cancel             (SoupMessage       *msg);
 
-void               soup_message_add_header (SoupMessage       *msg,
-                                           gchar             *name,
-                                           gchar             *value);
+SoupErrorCode  soup_message_send               (SoupMessage       *msg);
 
-SoupErrorCode      soup_message_send       (SoupMessage       *msg);
+void           soup_message_queue              (SoupMessage       *msg, 
+                                               SoupCallbackFn     callback, 
+                                               gpointer           user_data);
 
-void               soup_message_queue      (SoupMessage       *req, 
-                                           SoupCallbackFn     callback, 
-                                           gpointer           user_data);
+void           soup_message_set_request_header (SoupMessage       *req,
+                                               gchar             *name,
+                                               gchar             *value);
 
-/* 
- * soup_queue_message() is deprecated. Replace with soup_message_queue.
- */
-#define soup_queue_message soup_message_queue
+gchar         *soup_message_get_request_header (SoupMessage       *req,
+                                               gchar             *name);
+
+void           soup_message_set_response_header (SoupMessage      *req,
+                                                gchar            *name,
+                                                gchar            *value);
+
+gchar         *soup_message_get_response_header (SoupMessage      *req,
+                                                gchar            *name);
+
+/* FIXME: None of these are implemented yet, oh well... */
+typedef enum {
+       SOUP_MESSAGE_FOLLOW_REDIRECT = (1 << 1),
+       SOUP_MESSAGE_NO_COOKIE       = (1 << 2),
+       SOUP_MESSAGE_PROCESS_CHUNKS  = (1 << 3)
+} SoupMessageFlags;
+
+void           soup_message_set_flags          (SoupMessage       *msg,
+                                               guint              flags);
+
+guint          soup_message_get_flags          (SoupMessage       *msg);
 
 #endif /*SOUP_MESSAGE_H*/
index 79d4b7a..80babb3 100644 (file)
@@ -95,6 +95,8 @@ struct _SoupMessagePrivate {
        SoupErrorCode   errorcode;
 
        gpointer        digest_data;
+
+       guint           msg_flags;
 };
 
 typedef struct {
index 3d19a31..795c492 100644 (file)
@@ -178,6 +178,7 @@ soup_finish_read (SoupMessage *req)
        GByteArray *arr = req->priv->recv_buf;
        gint index = req->priv->header_len;
 
+       req->response.owner = SOUP_BUFFER_SYSTEM_OWNED;
        req->response.length = arr->len - index ;
        req->response.body = g_memdup (&arr->data [index],
                                       req->response.length + 1);
index daee79d..5fdf5a7 100644 (file)
@@ -256,6 +256,21 @@ soup_uri_to_string (const SoupUri *uri, gboolean show_passwd)
                        uri->querystring ? uri->querystring : "");
 }
 
+SoupUri *
+soup_uri_copy (const SoupUri* uri)
+{
+       gchar *uri_str;
+       SoupUri *dup;
+
+       g_return_val_if_fail (uri != NULL, NULL);
+
+       uri_str = soup_uri_to_string (uri, TRUE);
+       dup = soup_uri_new (uri_str);
+       g_free (uri_str);
+
+       return dup;
+}
+
 void
 soup_uri_free (SoupUri *uri)
 {
index ef5187a..059cc90 100644 (file)
@@ -56,6 +56,8 @@ SoupUri *soup_uri_new       (const gchar *uri_string);
 
 gchar   *soup_uri_to_string (const SoupUri *uri, gboolean show_password);
 
+SoupUri *soup_uri_copy      (const SoupUri *uri);
+
 void     soup_uri_free      (SoupUri *uri);
 
 #endif /*SOUP_URI_H*/