]> www.infradead.org Git - users/dwmw2/ews-sync.git/commitdiff
Work around libsoup violating RFC2616 master
authorDavid Woodhouse <David.Woodhouse@intel.com>
Thu, 18 Aug 2011 12:07:50 +0000 (13:07 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Thu, 18 Aug 2011 12:07:50 +0000 (13:07 +0100)
ews_autodiscover.c

index bc1aac2a493a96614de461448a2268186d36b6fa..d123dd06f8ef3ace0e2af1089a5fa3be85cc981b 100644 (file)
@@ -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);