Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Support handling of HTTP 307 (repost to the given location)

View gist:5063949
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
From e623f4d152f175cd804d063543b848471fa422f5 Mon Sep 17 00:00:00 2001
From: "d.gabaydulin" <D.Gabaydulin@qiwi.ru>
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
Something went wrong with that request. Please try again.