Last active
December 14, 2015 09:19
-
-
Save sherman/5063949 to your computer and use it in GitHub Desktop.
Support handling of HTTP 307 (repost to the given location)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From e623f4d152f175cd804d063543b848471fa422f5 Mon Sep 17 00:00:00 2001 | |
From: "d.gabaydulin" <[email protected]> | |
Date: Fri, 1 Mar 2013 15:01:33 +0400 | |
Subject: [PATCH] * support handling of HTTP 307 (repost to the given | |
location) | |
--- | |
src/client.c | 12 ++++++++++++ | |
1 file changed, 12 insertions(+) | |
diff --git a/src/client.c b/src/client.c | |
index 27815ec..2bf8685 100644 | |
--- a/src/client.c | |
+++ b/src/client.c | |
@@ -403,6 +403,7 @@ http_request(CONN *C, URL *U, CLIENT *client) | |
URL *redirect_url; /* URL in redirection request */ | |
case 301: | |
case 302: | |
+ case 307: | |
redirect_url = (URL*)xmalloc(sizeof(URL)); | |
if (my.follow && head->redirect[0]) { | |
debug ("%s:%d parse redirection URL %s", __FILE__, __LINE__, head->redirect); | |
@@ -412,6 +413,17 @@ http_request(CONN *C, URL *U, CLIENT *client) | |
} else { | |
redirect_url = add_url(head->redirect, U->urlid); | |
} | |
+ if (head->code == 307) { | |
+ redirect_url->calltype = U->calltype; | |
+ | |
+ if (redirect_url->calltype == URL_POST) { | |
+ redirect_url->postlen = U->postlen; | |
+ redirect_url->postdata = xmalloc(U->postlen); | |
+ memcpy(redirect_url->postdata, U->postdata, U->postlen); | |
+ redirect_url->conttype = xmalloc(strlen(U->conttype)); | |
+ memcpy(redirect_url->conttype,U->conttype, strlen(U->conttype)); | |
+ } | |
+ } | |
if ((http_request(C, redirect_url, client)) == FALSE) | |
return FALSE; | |
} | |
-- | |
1.7.9.5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment