return;
got_body:
+ /* If we end up returning, read_state needs to be set
+ * to IO_STATE_BODY, and read_length must be 0; since
+ * we may be coming from STATE_TRAILERS, or may be
+ * doing a read-to-eof, we sanitize these here.
+ */
+ io->read_state = SOUP_MESSAGE_IO_STATE_BODY;
+ io->read_length = 0;
+
/* A chunk of data may have been read and the emission
* of got_chunk delayed because we wanted to wait for
* more chunks to arrive, for doing content sniffing,
soup_buffer_free (sniffed_buffer);
soup_message_body_free (io->delayed_chunk_data);
io->delayed_chunk_data = NULL;
-
- /* If we end up returning, read_state
- * needs to be set to IO_STATE_BODY,
- * and read_length must be 0; since we
- * may be coming from STATE_TRAILERS,
- * or may be doing a read-to-eof, we
- * sanitize these here.
- */
- io->read_state = SOUP_MESSAGE_IO_STATE_BODY;
- io->read_length = 0;
SOUP_MESSAGE_IO_RETURN_IF_CANCELLED_OR_PAUSED;
}
}
char *chunked;
char *contents;
gsize length;
+ gboolean use_chunked_encoding = FALSE;
if (msg->method != SOUP_METHOD_GET) {
soup_message_set_status (msg, SOUP_STATUS_NOT_IMPLEMENTED);
if (query) {
chunked = g_hash_table_lookup (query, "chunked");
- if (chunked && g_str_equal (chunked, "yes"))
+ if (chunked && g_str_equal (chunked, "yes")) {
soup_message_headers_set_encoding (msg->response_headers,
SOUP_ENCODING_CHUNKED);
+ use_chunked_encoding = TRUE;
+ }
}
if (!strcmp (path, "/mbox")) {
"Content-Type", "text/plain");
}
+ if (use_chunked_encoding)
+ soup_message_body_complete (msg->response_body);
}
static gboolean
if (chunked_encoding)
soup_uri_set_query (uri, "chunked=yes");
+ soup_message_set_uri (msg, uri);
+
soup_message_body_set_accumulate (msg->response_body, should_accumulate);
g_object_connect (msg,