]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
http: Add support for RFC2324/RFC7168.
authorGraham Leggett <minfrin@apache.org>
Wed, 1 Apr 2015 10:03:56 +0000 (10:03 +0000)
committerGraham Leggett <minfrin@apache.org>
Wed, 1 Apr 2015 10:03:56 +0000 (10:03 +0000)
Sample implementation: http://people.apache.org/~minfrin/mod_teapot.c

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1670594 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
include/ap_mmn.h
include/httpd.h
modules/http/http_protocol.c

diff --git a/CHANGES b/CHANGES
index 6646e29697d46e5deb5ee4b1d85dbbf5d0a169a9..1ea17b7fcfc640d873f28633af467e1a00c43304 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) http: Add support for RFC2324/RFC7168. [Graham Leggett]
+
   *) mod_proxy_wstunnel: Avoid an empty response by failing with 502 (Bad
      Gateway) when no response is ever received from the backend.
      [Jan Kaluza]
index 280835d6535f26a3f4815b8690fdf4b462532a11..816810968f0eab43104b1d18af63fa29bc23ee85 100644 (file)
  * 20150121.2 (2.5.0-dev)  Add response_code_exprs to http_core.h
  * 20150222.0 (2.5.0-dev)  ssl pre_handshake hook now indicates proxy|client
  * 20150222.1 (2.5.0-dev)  Add keep_alive_timeout_set to server_rec
+ * 20150222.2 (2.5.0-dev)  Add response code 418 as per RFC2324/RFC7168
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20150222
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 1                 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 2                 /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
index e6cf10fe80f0d9a334d68ef56635507f81c274fa..6e6eab57a7c97bb51a060e1a28a9b825dec95077 100644 (file)
@@ -518,6 +518,7 @@ AP_DECLARE(const char *) ap_get_server_built(void);
 #define HTTP_UNSUPPORTED_MEDIA_TYPE          415
 #define HTTP_RANGE_NOT_SATISFIABLE           416
 #define HTTP_EXPECTATION_FAILED              417
+#define HTTP_IM_A_TEAPOT                     418
 #define HTTP_UNPROCESSABLE_ENTITY            422
 #define HTTP_LOCKED                          423
 #define HTTP_FAILED_DEPENDENCY               424
@@ -605,6 +606,8 @@ AP_DECLARE(const char *) ap_get_server_built(void);
 #define M_BASELINE_CONTROL      24
 #define M_MERGE                 25
 #define M_INVALID               26      /** no valid method */
+#define M_BREW                  27      /** RFC 2324: HTCPCP/1.0 */
+#define M_WHEN                  28      /** RFC 2324: HTCPCP/1.0 */
 
 /**
  * METHODS needs to be equal to the number of bits
index fc7ec6ccbe7ff79e9374b3f6c70c0de89b73d4e2..8cdcc6e65faed30d8b09b877a64c294128a2fd3d 100644 (file)
@@ -132,7 +132,7 @@ static const char * const status_lines[RESPONSE_CODES] =
     "415 Unsupported Media Type",
     "416 Requested Range Not Satisfiable",
     "417 Expectation Failed",
-    NULL, /* 418 */
+    "418 I'm A Teapot",
     NULL, /* 419 */
     NULL, /* 420 */
     NULL, /* 421 */
@@ -695,6 +695,8 @@ AP_DECLARE(void) ap_method_registry_init(apr_pool_t *p)
     register_one_method(p, "MKACTIVITY", M_MKACTIVITY);
     register_one_method(p, "BASELINE-CONTROL", M_BASELINE_CONTROL);
     register_one_method(p, "MERGE", M_MERGE);
+    register_one_method(p, "BREW", M_BREW);
+    register_one_method(p, "WHEN", M_WHEN);
 }
 
 AP_DECLARE(int) ap_method_register(apr_pool_t *p, const char *methname)
@@ -793,6 +795,16 @@ static int lookup_builtin_method(const char *method, apr_size_t len)
                     && method[2] == 'P'
                     && method[3] == 'Y'
                     ? M_COPY : UNKNOWN_METHOD);
+        case 'B':
+            return (method[1] == 'R'
+                    && method[2] == 'E'
+                    && method[3] == 'W'
+                    ? M_BREW : UNKNOWN_METHOD);
+        case 'W':
+            return (method[1] == 'H'
+                    && method[2] == 'E'
+                    && method[3] == 'N'
+                    ? M_WHEN : UNKNOWN_METHOD);
         default:
             return UNKNOWN_METHOD;
         }
@@ -1293,6 +1305,9 @@ static const char *get_canned_error_string(int status,
     case HTTP_NETWORK_AUTHENTICATION_REQUIRED:
         return("<p>The client needs to authenticate to gain\n"
                "network access.</p>\n");
+    case HTTP_IM_A_TEAPOT:
+        return("<p>The resulting entity body MAY be short and\n"
+                "stout.</p>\n");
     default:                    /* HTTP_INTERNAL_SERVER_ERROR */
         /*
          * This comparison to expose error-notes could be modified to