+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
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.
*
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)
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);
}
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);
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;
+}
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*/
SoupErrorCode errorcode;
gpointer digest_data;
+
+ guint msg_flags;
};
typedef struct {
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);
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)
{
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*/