*/
#include <config.h>
+#include <ctype.h>
#include <glib.h>
#include <string.h>
#include <stdlib.h>
* val: "1234, 567"
*/
static gboolean
-soup_parse_headers (SoupRequest *req)
+soup_parse_headers (SoupMessage *req)
{
guint http_major, http_minor, status_code, phrase_start = 0;
guint len = req->priv->recv_buf->len;
return TRUE;
THROW_MALFORMED_HEADER:
- soup_request_issue_callback (req, SOUP_ERROR_MALFORMED_HEADER);
+ soup_message_issue_callback (req, SOUP_ERROR_MALFORMED_HEADER);
return FALSE;
}
/* returns TRUE to continue processing, FALSE if a callback was issued */
static gboolean
-soup_process_headers (SoupRequest *req)
+soup_process_headers (SoupMessage *req)
{
gchar *connection, *length, *enc;
return TRUE;
THROW_MALFORMED_HEADER:
- soup_request_issue_callback (req, SOUP_ERROR_MALFORMED_HEADER);
+ soup_message_issue_callback (req, SOUP_ERROR_MALFORMED_HEADER);
return FALSE;
}
}
static void
-soup_debug_print_headers (SoupRequest *req)
+soup_debug_print_headers (SoupMessage *req)
{
g_hash_table_foreach (req->response_headers,
(GHFunc) soup_debug_print_a_header,
}
static gboolean
-soup_read_chunk (SoupRequest *req)
+soup_read_chunk (SoupMessage *req)
{
guint chunk_idx = req->priv->cur_chunk_idx;
gint chunk_len = req->priv->cur_chunk_len;
}
static void
-soup_finish_read (SoupRequest *req)
+soup_finish_read (SoupMessage *req)
{
GByteArray *arr = req->priv->recv_buf;
gint index = req->priv->header_len;
g_byte_array_set_size (arr, index);
req->status = SOUP_STATUS_FINISHED;
- soup_request_issue_callback (req, SOUP_ERROR_NONE);
+ soup_message_issue_callback (req, SOUP_ERROR_NONE);
}
static gboolean
soup_queue_read_async (GIOChannel* iochannel,
GIOCondition condition,
- SoupRequest *req)
+ SoupMessage *req)
{
gchar read_buf [RESPONSE_BLOCK_SIZE];
guint bytes_read = 0;
return TRUE;
if (error != G_IO_ERROR_NONE) {
- soup_request_issue_callback (req, SOUP_ERROR_IO);
+ soup_message_issue_callback (req, SOUP_ERROR_IO);
return FALSE;
}
}
static GString *
-soup_get_request_header (SoupRequest *req)
+soup_get_request_header (SoupMessage *req)
{
GString *header = g_string_new ("");
gchar *uri;
static gboolean
soup_queue_write_async (GIOChannel* iochannel,
GIOCondition condition,
- SoupRequest *req)
+ SoupMessage *req)
{
guint head_len, body_len, total_len, total_written, bytes_written;
GIOError error;
return TRUE;
if (error != G_IO_ERROR_NONE) {
- soup_request_issue_callback (req, SOUP_ERROR_IO);
+ soup_message_issue_callback (req, SOUP_ERROR_IO);
return FALSE;
}
static gboolean
soup_queue_error_async (GIOChannel* iochannel,
GIOCondition condition,
- SoupRequest *req)
+ SoupMessage *req)
{
gboolean conn_closed = soup_connection_is_keep_alive (req->priv->conn);
case SOUP_STATUS_FINISHED:
break;
case SOUP_STATUS_CONNECTING:
- soup_request_issue_callback (req, SOUP_ERROR_CANT_CONNECT);
+ soup_message_issue_callback (req, SOUP_ERROR_CANT_CONNECT);
break;
case SOUP_STATUS_SENDING_REQUEST:
if (req->priv->req_header &&
req->priv->req_header->len >= req->priv->write_len) {
g_warning ("Requeueing request which failed in "
"the sending headers phase");
- soup_queue_request (req,
+ soup_queue_message (req,
req->priv->callback,
req->priv->user_data);
break;
}
- soup_request_issue_callback (req, SOUP_ERROR_IO);
+ soup_message_issue_callback (req, SOUP_ERROR_IO);
break;
case SOUP_STATUS_READING_RESPONSE:
if (req->priv->header_len && !conn_closed) {
break;
}
- soup_request_issue_callback (req, SOUP_ERROR_IO);
+ soup_message_issue_callback (req, SOUP_ERROR_IO);
break;
default:
- soup_request_issue_callback (req, SOUP_ERROR_IO);
+ soup_message_issue_callback (req, SOUP_ERROR_IO);
break;
}
SoupConnection *conn,
gpointer user_data)
{
- SoupRequest *req = user_data;
+ SoupMessage *req = user_data;
GIOChannel *channel;
req->priv->connect_tag = NULL;
return;
THROW_CANT_CONNECT:
- soup_request_issue_callback (req, SOUP_ERROR_CANT_CONNECT);
+ soup_message_issue_callback (req, SOUP_ERROR_CANT_CONNECT);
}
static gboolean
GSList *iter;
for (iter = soup_active_requests; iter; iter = iter->next) {
- SoupRequest *req = iter->data;
+ SoupMessage *req = iter->data;
SoupContext *ctx, *proxy;
if (req->status != SOUP_STATUS_QUEUED)
}
void
-soup_queue_request (SoupRequest *req,
+soup_queue_message (SoupMessage *req,
SoupCallbackFn callback,
gpointer user_data)
{
g_idle_add (soup_idle_handle_new_requests, NULL);
if (req->status != SOUP_STATUS_IDLE)
- soup_request_cleanup (req);
+ soup_message_cleanup (req);
req->priv->callback = callback;
req->priv->user_data = user_data;
if (req->response.owner == SOUP_BUFFER_USER_OWNED) {
- g_warning ("Attempted to queue a request with a user owned "
+ g_warning ("Attempted to queue a message with a user owned "
"response buffer.");
- soup_request_issue_callback (req, SOUP_ERROR_CANCELLED);
+ soup_message_issue_callback (req, SOUP_ERROR_CANCELLED);
return;
}
soup_queue_idle_tag = 0;
for (iter = soup_active_requests; iter; iter = iter->next)
- soup_request_cancel (iter->data);
+ soup_message_cancel (iter->data);
}