+2001-05-25 Alex Graveley <alex@ximian.com>
+
+ * src/soup-core/soup-queue.c (soup_message_queue): No need to free
+ priv->recv_buf as it is now done in soup_message_cleanup().
+ (soup_message_queue): Free response_header keys and values before
+ destroying the hash table.
+
+ * src/soup-core/soup-message.c (soup_message_free): Don't free
+ priv->recv_buf here.
+ (soup_message_cleanup): Free priv->recv_buf here instead.
+
+ * src/soup-core/soup-queue.c (soup_finish_read): Since we now
+ g_strdup() all headers, and we already g_memdup the actual body
+ buffer, free the temporary recv_buf.
+
+ * src/soup-core/soup-headers.c (soup_headers_parse_response):
+ g_strdup() the response reason phrase.
+
2001-05-24 Alex Graveley <alex@ximian.com>
* README: Update Licensing section for soup-ssl-proxy.
if (!soup_headers_parse (str, len, dest))
goto THROW_MALFORMED_HEADER;
- *status_phrase = &str [phrase_start];
+ *status_phrase = g_strdup (&str [phrase_start]);
return TRUE;
source_remove (req->priv->error_tag);
source_remove (req->priv->timeout_tag);
- if (req->priv->connect_tag)
+ if (req->priv->connect_tag) {
soup_context_cancel_connect (req->priv->connect_tag);
- if (req->priv->conn)
+ req->priv->connect_tag = NULL;
+ }
+ if (req->priv->conn) {
soup_connection_release (req->priv->conn);
+ req->priv->conn = NULL;
+ }
+ if (req->priv->recv_buf) {
+ g_byte_array_free (req->priv->recv_buf, TRUE);
+ req->priv->recv_buf = NULL;
+ }
- req->priv->connect_tag = NULL;
- req->priv->conn = NULL;
req->priv->write_len = 0;
req->priv->header_len = 0;
req->priv->content_length = 0;
g_hash_table_destroy (req->response_headers);
}
- if (req->priv->recv_buf)
- g_byte_array_free (req->priv->recv_buf, TRUE);
-
g_free (req->priv);
g_free (req->action);
g_free (req);
req->response.body = g_memdup (&arr->data [index],
req->response.length + 1);
req->response.body [req->response.length] = '\0';
-
- /* Headers are zero-terminated */
- g_byte_array_set_size (arr, index);
-
+
+ g_byte_array_free (arr, TRUE);
+ req->priv->recv_buf = NULL;
+
req->status = SOUP_STATUS_FINISHED;
soup_message_issue_callback (req, SOUP_ERROR_NONE);
}
return FALSE;
}
+static void
+soup_queue_remove_header (gchar *name, gchar *value, gpointer unused)
+{
+ g_free (name);
+ g_free (value);
+}
+
/**
* soup_message_queue:
* @req: a %SoupMessage.
req->response.body = NULL;
req->response.length = 0;
- if (req->response_headers)
+ if (req->response_headers) {
+ g_hash_table_foreach (req->response_headers,
+ (GHFunc) soup_queue_remove_header,
+ NULL);
g_hash_table_destroy (req->response_headers);
- if (req->priv->recv_buf)
- g_byte_array_free (req->priv->recv_buf, TRUE);
+ req->response_headers = NULL;
+ }
req->response_code = 0;
req->response_phrase = NULL;
- req->response_headers = NULL;
req->priv->recv_buf = NULL;
req->status = SOUP_STATUS_QUEUED;