You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2017/06/20 22:21:46 UTC

[trafficserver] branch master updated: handle 307 and 308 when building redirect response

This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 3f22b4a  handle 307 and 308 when building redirect response
3f22b4a is described below

commit 3f22b4af3aaf3dd973a9b4d15966e76311de13ae
Author: Derek Dagit <de...@yahoo-inc.com>
AuthorDate: Tue Jun 20 18:43:37 2017 +0000

    handle 307 and 308 when building redirect response
---
 proxy/hdrs/HTTP.h                                  |   1 +
 proxy/http/HttpTransact.cc                         |  22 +++--
 .../gold_tests/autest-site/trafficserver.test.ext  |  17 ++--
 .../body_factory/http204_response.test.py          |  16 ++--
 .../body_factory/http204_response_plugin.test.py   |  11 ++-
 .../headers/data/www.redirect301.test_get.txt      |   2 +
 .../headers/data/www.redirect302.test_get.txt      |   2 +
 .../headers/data/www.redirect308.test_get.txt      |   2 +
 .../headers/domain-blacklist-307.test.py           |  69 --------------
 .../headers/domain-blacklist-30x.test.py           | 103 +++++++++++++++++++++
 tests/gold_tests/headers/redirect301_get.gold      |  22 +++++
 tests/gold_tests/headers/redirect302_get.gold      |  22 +++++
 tests/gold_tests/headers/redirect307_get.gold      |  15 ++-
 tests/gold_tests/headers/redirect308_get.gold      |  22 +++++
 14 files changed, 221 insertions(+), 105 deletions(-)

diff --git a/proxy/hdrs/HTTP.h b/proxy/hdrs/HTTP.h
index 386e2ca..00ad4e6 100644
--- a/proxy/hdrs/HTTP.h
+++ b/proxy/hdrs/HTTP.h
@@ -59,6 +59,7 @@ enum HTTPStatus {
   HTTP_STATUS_NOT_MODIFIED       = 304,
   HTTP_STATUS_USE_PROXY          = 305,
   HTTP_STATUS_TEMPORARY_REDIRECT = 307,
+  HTTP_STATUS_PERMANENT_REDIRECT = 308,
 
   HTTP_STATUS_BAD_REQUEST                   = 400,
   HTTP_STATUS_UNAUTHORIZED                  = 401,
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index e0183fd..56621e6 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -771,11 +771,21 @@ HttpTransact::EndRemapRequest(State *s)
   ////////////////////////////////////////////////////////////////
   if (s->remap_redirect != nullptr) {
     SET_VIA_STRING(VIA_DETAIL_TUNNEL, VIA_DETAIL_TUNNEL_NO_FORWARD);
-    if (s->http_return_code == HTTP_STATUS_MOVED_PERMANENTLY) {
-      build_error_response(s, HTTP_STATUS_MOVED_PERMANENTLY, "Redirect", "redirect#moved_permanently");
-    } else {
-      build_error_response(s, HTTP_STATUS_MOVED_TEMPORARILY, "Redirect", "redirect#moved_temporarily");
+    const char *error_body_type;
+    switch (s->http_return_code) {
+    case HTTP_STATUS_MOVED_PERMANENTLY:
+    case HTTP_STATUS_PERMANENT_REDIRECT:
+      error_body_type = "redirect#moved_permanently";
+      break;
+    case HTTP_STATUS_MOVED_TEMPORARILY:
+    case HTTP_STATUS_TEMPORARY_REDIRECT:
+      error_body_type = "redirect#moved_temporarily";
+      break;
+    default:
+      Warning("Invalid status code for redirect '%d'. Building a response for a temporary redirect.", s->http_return_code);
+      error_body_type = "redirect#moved_temporarily";
     }
+    build_error_response(s, s->http_return_code, "Redirect", error_body_type);
     ats_free(s->remap_redirect);
     s->reverse_proxy = false;
     goto done;
@@ -7989,8 +7999,8 @@ HttpTransact::build_error_response(State *s, HTTPStatus status_code, const char
   s->hdr_info.client_response.field_delete(MIME_FIELD_EXPIRES, MIME_LEN_EXPIRES);
   s->hdr_info.client_response.field_delete(MIME_FIELD_LAST_MODIFIED, MIME_LEN_LAST_MODIFIED);
 
-  if ((status_code == HTTP_STATUS_TEMPORARY_REDIRECT || status_code == HTTP_STATUS_MOVED_TEMPORARILY ||
-       status_code == HTTP_STATUS_MOVED_PERMANENTLY) &&
+  if ((status_code == HTTP_STATUS_PERMANENT_REDIRECT || status_code == HTTP_STATUS_TEMPORARY_REDIRECT ||
+       status_code == HTTP_STATUS_MOVED_TEMPORARILY || status_code == HTTP_STATUS_MOVED_PERMANENTLY) &&
       s->remap_redirect) {
     s->hdr_info.client_response.value_set(MIME_FIELD_LOCATION, MIME_LEN_LOCATION, s->remap_redirect, strlen(s->remap_redirect));
   }
diff --git a/tests/gold_tests/autest-site/trafficserver.test.ext b/tests/gold_tests/autest-site/trafficserver.test.ext
index af1c541..538a6a4 100755
--- a/tests/gold_tests/autest-site/trafficserver.test.ext
+++ b/tests/gold_tests/autest-site/trafficserver.test.ext
@@ -175,6 +175,13 @@ def MakeATSProcess(obj, name, command='traffic_server', select_ports=True):
         "FATAL:", "diags.log should not contain errors")
 
     # config files
+    def MakeConfigFile(self, fname):
+        tmpname = os.path.join(config_dir, fname)
+        return self.File(tmpname, id=make_id(fname), typename="ats:config")
+
+    AddMethodToInstance(p.Disk, MakeConfigFile)
+
+    # "Core" config files are pre-defined as variables.
     fname = "records.config"
     tmpname = os.path.join(config_dir, fname)
     p.Disk.File(tmpname, id=make_id(fname), typename="ats:config:records")
@@ -221,16 +228,6 @@ def MakeATSProcess(obj, name, command='traffic_server', select_ports=True):
     tmpname = os.path.join(config_dir, fname)
     p.Disk.File(tmpname, id=make_id(fname), typename="ats:config")
 
-    # This is for header_rewrite plugin.
-    fname = "header_rewrite_rules.conf"
-    tmpname = os.path.join(config_dir, fname)
-    p.Disk.File(tmpname, id=make_id(fname), typename="ats:config")
-
-    # This is for regex_remap plugin.
-    fname = "maps.reg"
-    tmpname = os.path.join(config_dir, fname)
-    p.Disk.File(tmpname, id=make_id(fname), typename="ats:config")
-
     fname = "socks.config"
     tmpname = os.path.join(config_dir, fname)
     p.Disk.File(tmpname, id=make_id(fname), typename="ats:config")
diff --git a/tests/gold_tests/body_factory/http204_response.test.py b/tests/gold_tests/body_factory/http204_response.test.py
index 0ce06c8..54d61dc 100644
--- a/tests/gold_tests/body_factory/http204_response.test.py
+++ b/tests/gold_tests/body_factory/http204_response.test.py
@@ -56,15 +56,17 @@ Description: According to rfc7231 I should not have been sent to you!
 </BODY>
 """)
 
+regex_remap_conf_file = "maps.reg"
+
 ts.Disk.remap_config.AddLine(
-    'map http://{0} http://127.0.0.1:{1} @plugin=regex_remap.so @pparam=maps.reg @pparam=no-query-string @pparam=host'
-                    .format(DEFAULT_204_HOST, server.Variables.Port)
-)
+    'map http://{0} http://127.0.0.1:{1} @plugin=regex_remap.so @pparam={2} @pparam=no-query-string @pparam=host'
+                    .format(DEFAULT_204_HOST, server.Variables.Port, regex_remap_conf_file)
+    )
 ts.Disk.remap_config.AddLine(
-    'map http://{0} http://127.0.0.1:{1} @plugin=regex_remap.so @pparam=maps.reg @pparam=no-query-string @pparam=host @plugin=conf_remap.so @pparam=proxy.config.body_factory.template_base={0}'
-                    .format(CUSTOM_TEMPLATE_204_HOST, server.Variables.Port)
-)
-ts.Disk.maps_reg.AddLine(
+    'map http://{0} http://127.0.0.1:{1} @plugin=regex_remap.so @pparam={2} @pparam=no-query-string @pparam=host @plugin=conf_remap.so @pparam=proxy.config.body_factory.template_base={0}'
+                    .format(CUSTOM_TEMPLATE_204_HOST, server.Variables.Port, regex_remap_conf_file)
+    )
+ts.Disk.MakeConfigFile(regex_remap_conf_file).AddLine(
     '//.*/ http://127.0.0.1:{0} @status=204'
     .format(server.Variables.Port)
 )
diff --git a/tests/gold_tests/body_factory/http204_response_plugin.test.py b/tests/gold_tests/body_factory/http204_response_plugin.test.py
index 2b064ed..a2ec580 100644
--- a/tests/gold_tests/body_factory/http204_response_plugin.test.py
+++ b/tests/gold_tests/body_factory/http204_response_plugin.test.py
@@ -30,11 +30,14 @@ server = Test.MakeOriginServer("server")
 
 CUSTOM_PLUGIN_204_HOST = 'www.customplugin204.test'
 
+regex_remap_conf_file = "maps.reg"
+
 ts.Disk.remap_config.AddLine(
-    'map http://{0} http://127.0.0.1:{1} @plugin=regex_remap.so @pparam=maps.reg @pparam=no-query-string @pparam=host'
-    .format(CUSTOM_PLUGIN_204_HOST, server.Variables.Port)
-)
-ts.Disk.maps_reg.AddLine('//.*/ http://donotcare.test @status=204')
+    'map http://{0} http://127.0.0.1:{1} @plugin=regex_remap.so @pparam={2} @pparam=no-query-string @pparam=host'
+            .format(CUSTOM_PLUGIN_204_HOST, server.Variables.Port,
+              regex_remap_conf_file)
+    )
+ts.Disk.MakeConfigFile(regex_remap_conf_file).AddLine('//.*/ http://donotcare.test @status=204')
 
 Test.prepare_plugin(os.path.join(Test.Variables.AtsTestToolsDir, 'plugins', 'custom204plugin.cc'), ts)
 
diff --git a/tests/gold_tests/headers/data/www.redirect301.test_get.txt b/tests/gold_tests/headers/data/www.redirect301.test_get.txt
new file mode 100644
index 0000000..4835267
--- /dev/null
+++ b/tests/gold_tests/headers/data/www.redirect301.test_get.txt
@@ -0,0 +1,2 @@
+GET http://www.redirect301.test/ HTTP/1.1
+
diff --git a/tests/gold_tests/headers/data/www.redirect302.test_get.txt b/tests/gold_tests/headers/data/www.redirect302.test_get.txt
new file mode 100644
index 0000000..6aae266
--- /dev/null
+++ b/tests/gold_tests/headers/data/www.redirect302.test_get.txt
@@ -0,0 +1,2 @@
+GET http://www.redirect302.test/ HTTP/1.1
+
diff --git a/tests/gold_tests/headers/data/www.redirect308.test_get.txt b/tests/gold_tests/headers/data/www.redirect308.test_get.txt
new file mode 100644
index 0000000..05bcbf8
--- /dev/null
+++ b/tests/gold_tests/headers/data/www.redirect308.test_get.txt
@@ -0,0 +1,2 @@
+GET http://www.redirect308.test/ HTTP/1.1
+
diff --git a/tests/gold_tests/headers/domain-blacklist-307.test.py b/tests/gold_tests/headers/domain-blacklist-307.test.py
deleted file mode 100644
index bfdd008..0000000
--- a/tests/gold_tests/headers/domain-blacklist-307.test.py
+++ /dev/null
@@ -1,69 +0,0 @@
-'''
-Tests 307 responses are returned for matching domains
-'''
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-
-import os
-
-Test.Summary = '''
-Tests 307 responses are returned for matching domains
-'''
-
-Test.SkipUnless(Condition.HasProgram("grep","grep needs to be installed on system for this test to work"))
-
-ts=Test.MakeATSProcess("ts")
-server=Test.MakeOriginServer("server")
-
-REDIRECT_HOST='www.redirect307.test'
-PASSTHRU_HOST='www.passthrough.test'
-
-ts.Disk.remap_config.AddLine("""\
-regex_map http://{0}/ http://{0}/ @plugin=header_rewrite.so @pparam=header_rewrite_rules.conf
-""".format(REDIRECT_HOST)
-)
-
-ts.Disk.header_rewrite_rules_conf.AddLine("""\
-cond %{SEND_RESPONSE_HDR_HOOK}
-set-header Location "%<cque>"
-set-status 307
-""")
-
-ts.Disk.records_config.update({
-        'proxy.config.diags.debug.enabled': 1,
-        'proxy.config.diags.debug.tags': 'remap,header_rewrite,dbg_header_rewrite,header_rewrite_dbg',
-    })
-
-Test.Setup.Copy(os.path.join(os.pardir,os.pardir,'tools','tcp_client.py'))
-Test.Setup.Copy('data')
-
-redirect307tr=Test.AddTestRun("Test domain {0}".format(REDIRECT_HOST))
-redirect307tr.Processes.Default.StartBefore(Test.Processes.ts)
-redirect307tr.StillRunningAfter = ts
-redirect307tr.Processes.Default.Command="python tcp_client.py 127.0.0.1 {0} {1} | grep -v '^Date: '| grep -v '^Server: ATS/'".\
-    format(ts.Variables.port, 'data/{0}_get.txt'.format(REDIRECT_HOST))
-redirect307tr.Processes.Default.TimeOut=5 # seconds
-redirect307tr.Processes.Default.ReturnCode=0
-redirect307tr.Processes.Default.Streams.stdout="redirect307_get.gold"
-
-passthroughtr=Test.AddTestRun("Test domain {0}".format(PASSTHRU_HOST))
-passthroughtr.StillRunningBefore = ts
-passthroughtr.StillRunningAfter = ts
-passthroughtr.Processes.Default.Command="python tcp_client.py 127.0.0.1 {0} {1} | grep -v '^Date: '| grep -v '^Server: ATS/'".\
-    format(ts.Variables.port, 'data/{0}_get.txt'.format(PASSTHRU_HOST))
-passthroughtr.Processes.Default.TimeOut=5 # seconds
-passthroughtr.Processes.Default.ReturnCode=0
-passthroughtr.Processes.Default.Streams.stdout="passthrough_get.gold"
diff --git a/tests/gold_tests/headers/domain-blacklist-30x.test.py b/tests/gold_tests/headers/domain-blacklist-30x.test.py
new file mode 100644
index 0000000..aef08d6
--- /dev/null
+++ b/tests/gold_tests/headers/domain-blacklist-30x.test.py
@@ -0,0 +1,103 @@
+'''
+Tests 30x responses are returned for matching domains
+'''
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+import os
+
+Test.Summary = '''
+Tests 30x responses are returned for matching domains
+'''
+
+Test.SkipUnless(Condition.HasProgram("grep","grep needs to be installed on system for this test to work"))
+
+ts=Test.MakeATSProcess("ts")
+server=Test.MakeOriginServer("server")
+
+REDIRECT_301_HOST='www.redirect301.test'
+REDIRECT_302_HOST='www.redirect302.test'
+REDIRECT_307_HOST='www.redirect307.test'
+REDIRECT_308_HOST='www.redirect308.test'
+PASSTHRU_HOST='www.passthrough.test'
+
+ts.Disk.records_config.update({
+        'proxy.config.diags.debug.enabled': 1,
+        'proxy.config.diags.debug.tags': 'header_rewrite|dbg_header_rewrite',
+        'proxy.config.body_factory.enable_logging': 1,
+        })
+
+ts.Disk.remap_config.AddLine("""\
+regex_map http://{0}/ http://{0}/ @plugin=header_rewrite.so @pparam=header_rewrite_rules_301.conf
+regex_map http://{1}/ http://{1}/ @plugin=header_rewrite.so @pparam=header_rewrite_rules_302.conf
+regex_map http://{2}/ http://{2}/ @plugin=header_rewrite.so @pparam=header_rewrite_rules_307.conf
+regex_map http://{3}/ http://{3}/ @plugin=header_rewrite.so @pparam=header_rewrite_rules_308.conf
+""".format(REDIRECT_301_HOST, REDIRECT_302_HOST, REDIRECT_307_HOST, REDIRECT_308_HOST)
+)
+
+for x in (1,2,7,8):
+  ts.Disk.MakeConfigFile("header_rewrite_rules_30{0}.conf".format(x)).AddLine("""\
+set-redirect 30{0} "%<cque>"
+""".format(x))
+
+Test.Setup.Copy(os.path.join(os.pardir,os.pardir,'tools','tcp_client.py'))
+Test.Setup.Copy('data')
+
+redirect301tr=Test.AddTestRun("Test domain {0}".format(REDIRECT_301_HOST))
+redirect301tr.Processes.Default.StartBefore(Test.Processes.ts)
+redirect301tr.StillRunningAfter = ts
+redirect301tr.Processes.Default.Command="python tcp_client.py 127.0.0.1 {0} {1} | grep -v '^Date: '| grep -v '^Server: ATS/'".\
+    format(ts.Variables.port, 'data/{0}_get.txt'.format(REDIRECT_301_HOST))
+redirect301tr.Processes.Default.TimeOut=5 # seconds
+redirect301tr.Processes.Default.ReturnCode=0
+redirect301tr.Processes.Default.Streams.stdout="redirect301_get.gold"
+
+redirect302tr=Test.AddTestRun("Test domain {0}".format(REDIRECT_302_HOST))
+redirect302tr.StillRunningBefore = ts
+redirect302tr.StillRunningAfter = ts
+redirect302tr.Processes.Default.Command="python tcp_client.py 127.0.0.1 {0} {1} | grep -v '^Date: '| grep -v '^Server: ATS/'".\
+    format(ts.Variables.port, 'data/{0}_get.txt'.format(REDIRECT_302_HOST))
+redirect302tr.Processes.Default.TimeOut=5 # seconds
+redirect302tr.Processes.Default.ReturnCode=0
+redirect302tr.Processes.Default.Streams.stdout="redirect302_get.gold"
+
+
+redirect307tr=Test.AddTestRun("Test domain {0}".format(REDIRECT_307_HOST))
+redirect302tr.StillRunningBefore = ts
+redirect307tr.StillRunningAfter = ts
+redirect307tr.Processes.Default.Command="python tcp_client.py 127.0.0.1 {0} {1} | grep -v '^Date: '| grep -v '^Server: ATS/'".\
+    format(ts.Variables.port, 'data/{0}_get.txt'.format(REDIRECT_307_HOST))
+redirect307tr.Processes.Default.TimeOut=5 # seconds
+redirect307tr.Processes.Default.ReturnCode=0
+redirect307tr.Processes.Default.Streams.stdout="redirect307_get.gold"
+
+redirect308tr=Test.AddTestRun("Test domain {0}".format(REDIRECT_308_HOST))
+redirect308tr.StillRunningBefore = ts
+redirect308tr.StillRunningAfter = ts
+redirect308tr.Processes.Default.Command="python tcp_client.py 127.0.0.1 {0} {1} | grep -v '^Date: '| grep -v '^Server: ATS/'".\
+    format(ts.Variables.port, 'data/{0}_get.txt'.format(REDIRECT_308_HOST))
+redirect308tr.Processes.Default.TimeOut=5 # seconds
+redirect308tr.Processes.Default.ReturnCode=0
+redirect308tr.Processes.Default.Streams.stdout="redirect308_get.gold"
+
+passthroughtr=Test.AddTestRun("Test domain {0}".format(PASSTHRU_HOST))
+passthroughtr.StillRunningBefore = ts
+passthroughtr.StillRunningAfter = ts
+passthroughtr.Processes.Default.Command="python tcp_client.py 127.0.0.1 {0} {1} | grep -v '^Date: '| grep -v '^Server: ATS/'".\
+    format(ts.Variables.port, 'data/{0}_get.txt'.format(PASSTHRU_HOST))
+passthroughtr.Processes.Default.TimeOut=5 # seconds
+passthroughtr.Processes.Default.ReturnCode=0
+passthroughtr.Processes.Default.Streams.stdout="passthrough_get.gold"
diff --git a/tests/gold_tests/headers/redirect301_get.gold b/tests/gold_tests/headers/redirect301_get.gold
new file mode 100644
index 0000000..6d70fa3
--- /dev/null
+++ b/tests/gold_tests/headers/redirect301_get.gold
@@ -0,0 +1,22 @@
+HTTP/1.1 301 Redirect
+Connection: keep-alive
+Cache-Control: no-store
+Location: http://www.redirect301.test/
+Content-Type: text/html
+Content-Language: en
+Content-Length: 310
+
+<HTML>
+<HEAD>
+<TITLE>Document Has Moved</TITLE>
+</HEAD>
+
+<BODY BGCOLOR="white" FGCOLOR="black">
+<H1>Document Has Moved</H1>
+<HR>
+
+<FONT FACE="Helvetica,Arial"><B>
+Description: The document you requested has moved to a new location.  The new location is "http://www.redirect301.test/".
+</B></FONT>
+<HR>
+</BODY>
diff --git a/tests/gold_tests/headers/redirect302_get.gold b/tests/gold_tests/headers/redirect302_get.gold
new file mode 100644
index 0000000..8baafcb
--- /dev/null
+++ b/tests/gold_tests/headers/redirect302_get.gold
@@ -0,0 +1,22 @@
+HTTP/1.1 302 Redirect
+Connection: keep-alive
+Cache-Control: no-store
+Location: http://www.redirect302.test/
+Content-Type: text/html
+Content-Language: en
+Content-Length: 310
+
+<HTML>
+<HEAD>
+<TITLE>Document Has Moved</TITLE>
+</HEAD>
+
+<BODY BGCOLOR="white" FGCOLOR="black">
+<H1>Document Has Moved</H1>
+<HR>
+
+<FONT FACE="Helvetica,Arial"><B>
+Description: The document you requested has moved to a new location.  The new location is "http://www.redirect302.test/".
+</B></FONT>
+<HR>
+</BODY>
diff --git a/tests/gold_tests/headers/redirect307_get.gold b/tests/gold_tests/headers/redirect307_get.gold
index f4b8767..282993b 100644
--- a/tests/gold_tests/headers/redirect307_get.gold
+++ b/tests/gold_tests/headers/redirect307_get.gold
@@ -1,25 +1,22 @@
-HTTP/1.1 307 Temporary Redirect
+HTTP/1.1 307 Redirect
 Connection: keep-alive
 Cache-Control: no-store
+Location: http://www.redirect307.test/
 Content-Type: text/html
 Content-Language: en
-Location: http://www.redirect307.test/
-Content-Length: 391
+Content-Length: 310
 
 <HTML>
 <HEAD>
-<TITLE>Unknown Host</TITLE>
+<TITLE>Document Has Moved</TITLE>
 </HEAD>
 
 <BODY BGCOLOR="white" FGCOLOR="black">
-<H1>Unknown Host</H1>
+<H1>Document Has Moved</H1>
 <HR>
 
 <FONT FACE="Helvetica,Arial"><B>
-Description: Unable to locate the server requested ---
-the server does not have a DNS entry.  Perhaps there is a misspelling
-in the server name, or the server no longer exists.  Double-check the
-name and try again.
+Description: The document you requested has moved to a new location.  The new location is "http://www.redirect307.test/".
 </B></FONT>
 <HR>
 </BODY>
diff --git a/tests/gold_tests/headers/redirect308_get.gold b/tests/gold_tests/headers/redirect308_get.gold
new file mode 100644
index 0000000..05cae3d
--- /dev/null
+++ b/tests/gold_tests/headers/redirect308_get.gold
@@ -0,0 +1,22 @@
+HTTP/1.1 308 Redirect
+Connection: keep-alive
+Cache-Control: no-store
+Location: http://www.redirect308.test/
+Content-Type: text/html
+Content-Language: en
+Content-Length: 310
+
+<HTML>
+<HEAD>
+<TITLE>Document Has Moved</TITLE>
+</HEAD>
+
+<BODY BGCOLOR="white" FGCOLOR="black">
+<H1>Document Has Moved</H1>
+<HR>
+
+<FONT FACE="Helvetica,Arial"><B>
+Description: The document you requested has moved to a new location.  The new location is "http://www.redirect308.test/".
+</B></FONT>
+<HR>
+</BODY>

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].