[libsoup] soup-session: Add support for status code 308 Permanent Redirect
- From: Patrick Griffis <pgriffis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] soup-session: Add support for status code 308 Permanent Redirect
- Date: Sun, 19 Jul 2020 17:19:35 +0000 (UTC)
commit bfdcd72d11c15d5aafd38e1e193fff5ae6c015d1
Author: Benjamin Kaufmann <benjamin kaufmann teufel de>
Date: Tue Jul 14 17:31:09 2020 +0200
soup-session: Add support for status code 308 Permanent Redirect
libsoup/soup-session.c | 1 +
libsoup/soup-status.h | 1 +
tests/redirect-test.c | 10 ++++++----
3 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index b8608538..6d68c9fb 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -1076,6 +1076,7 @@ auth_manager_authenticate (SoupAuthManager *manager, SoupMessage *msg,
#define SOUP_SESSION_WOULD_REDIRECT_AS_SAFE(session, msg) \
(((msg)->status_code == SOUP_STATUS_MOVED_PERMANENTLY || \
+ (msg)->status_code == SOUP_STATUS_PERMANENT_REDIRECT || \
(msg)->status_code == SOUP_STATUS_TEMPORARY_REDIRECT || \
(msg)->status_code == SOUP_STATUS_FOUND) && \
SOUP_METHOD_IS_SAFE ((msg)->method))
diff --git a/libsoup/soup-status.h b/libsoup/soup-status.h
index 5263df33..5b0db2aa 100644
--- a/libsoup/soup-status.h
+++ b/libsoup/soup-status.h
@@ -58,6 +58,7 @@ typedef enum {
SOUP_STATUS_USE_PROXY = 305,
SOUP_STATUS_NOT_APPEARING_IN_THIS_PROTOCOL = 306, /* (reserved) */
SOUP_STATUS_TEMPORARY_REDIRECT = 307,
+ SOUP_STATUS_PERMANENT_REDIRECT = 308,
SOUP_STATUS_BAD_REQUEST = 400,
SOUP_STATUS_UNAUTHORIZED = 401,
diff --git a/tests/redirect-test.c b/tests/redirect-test.c
index ccdd4c29..e5f5fa6d 100644
--- a/tests/redirect-test.c
+++ b/tests/redirect-test.c
@@ -37,6 +37,9 @@ static TestCase tests[] = {
{ { { "GET", "/307", 307 },
{ "GET", "/", 200 },
{ NULL } }, 200, NULL },
+ { { { "GET", "/308", 308 },
+ { "GET", "/", 200 },
+ { NULL } }, 200, NULL },
{ { { "HEAD", "/301", 301 },
{ "HEAD", "/", 200 },
{ NULL } }, 200, "551190" },
@@ -52,6 +55,9 @@ static TestCase tests[] = {
{ { { "HEAD", "/307", 307 },
{ "HEAD", "/", 200 },
{ NULL } }, 200, "551190" },
+ { { { "HEAD", "/308", 308 },
+ { "HEAD", "/", 200 },
+ { NULL } }, 200, "551190" },
/* A non-redirecty response to a GET or HEAD should not */
@@ -63,8 +69,6 @@ static TestCase tests[] = {
{ NULL } }, 305, NULL },
{ { { "GET", "/306", 306 },
{ NULL } }, 306, NULL },
- { { { "GET", "/308", 308 },
- { NULL } }, 308, NULL },
{ { { "HEAD", "/300", 300 },
{ NULL } }, 300, "551190" },
{ { { "HEAD", "/304", 304 },
@@ -73,8 +77,6 @@ static TestCase tests[] = {
{ NULL } }, 305, "551190" },
{ { { "HEAD", "/306", 306 },
{ NULL } }, 306, "551190" },
- { { { "HEAD", "/308", 308 },
- { NULL } }, 308, "551190" },
/* Test double-redirect */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]