summaryrefslogtreecommitdiff
path: root/libsoup/soup-message-io.c
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-12-07 13:10:51 +0100
committerDan Winship <danw@gnome.org>2015-02-27 17:57:42 -0500
commitb05b21f947195e4292e480e555ff0e79fd232ed6 (patch)
tree839df853a587eb7dca4822c6fc765e4f3cf0acaa /libsoup/soup-message-io.c
parentd4e76046fa59780b19e76a44fef42a5115cbe3c3 (diff)
downloadlibsoup-server-handlers.tar.gz
soup-server: add "early" handlersserver-handlers
Add soup_server_add_early_handler(), for registering handlers to be run from got-headers rather than got-body.
Diffstat (limited to 'libsoup/soup-message-io.c')
-rw-r--r--libsoup/soup-message-io.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/libsoup/soup-message-io.c b/libsoup/soup-message-io.c
index db98dc28..4629568f 100644
--- a/libsoup/soup-message-io.c
+++ b/libsoup/soup-message-io.c
@@ -360,6 +360,15 @@ io_write (SoupMessage *msg, gboolean blocking,
switch (io->write_state) {
case SOUP_MESSAGE_IO_STATE_HEADERS:
+ if (io->mode == SOUP_MESSAGE_IO_SERVER &&
+ io->read_state == SOUP_MESSAGE_IO_STATE_BLOCKING &&
+ msg->status_code == 0) {
+ /* Client requested "Expect: 100-continue", and
+ * server did not set an error.
+ */
+ soup_message_set_status (msg, SOUP_STATUS_CONTINUE);
+ }
+
if (!io->write_buf->len) {
io->get_headers_cb (msg, io->write_buf,
&io->write_encoding,
@@ -606,11 +615,11 @@ io_read (SoupMessage *msg, gboolean blocking,
break;
} else if (io->mode == SOUP_MESSAGE_IO_SERVER &&
soup_message_headers_get_expectations (msg->request_headers) & SOUP_EXPECTATION_CONTINUE) {
- /* The client requested a Continue response. The
- * got_headers handler may change this to something
- * else though.
+ /* We must return a status code and response
+ * headers to the client; either an error to
+ * be set by a got-headers handler below, or
+ * else %SOUP_STATUS_CONTINUE otherwise.
*/
- soup_message_set_status (msg, SOUP_STATUS_CONTINUE);
io->write_state = SOUP_MESSAGE_IO_STATE_HEADERS;
io->read_state = SOUP_MESSAGE_IO_STATE_BLOCKING;
} else {