From 983d16bce07d0b4f8f5f9d8634edb55477a535de Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 18 Aug 2011 13:07:50 +0100 Subject: [PATCH] Work around libsoup violating RFC2616 --- ews_autodiscover.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ews_autodiscover.c b/ews_autodiscover.c index bc1aac2..d123dd0 100644 --- a/ews_autodiscover.c +++ b/ews_autodiscover.c @@ -20,6 +20,19 @@ static void souptest_authenticate(SoupSession *sess, SoupMessage *msg, soup_auth_authenticate (auth, authdata->username, authdata->password); } +static void soap_restarted (SoupMessage *msg, gpointer data) +{ + xmlOutputBuffer *buf = data; + + /* In violation of RFC2616, libsoup will change a POST request to + a GET on receiving a 302 redirect. */ + printf("Working around libsoup bug with redirect\n"); + g_object_set (msg, SOUP_MESSAGE_METHOD, "POST", NULL); + + soup_message_set_request(msg, "text/xml", SOUP_MEMORY_COPY, + (gchar *)buf->buffer->content, + buf->buffer->use); +} int main(int argc, char **argv) { SoupSession *sess; @@ -93,6 +106,8 @@ int main(int argc, char **argv) soup_message_set_request(msg, "application/xml", SOUP_MEMORY_COPY, (gchar *)buf->buffer->content, buf->buffer->use); + + g_signal_connect (msg, "restarted", G_CALLBACK (soap_restarted), buf); status = soup_session_send_message(sess, msg); -- 2.49.0