From 79d02aeab7ba4c85440f22fea07f9d0bec18f8db Mon Sep 17 00:00:00 2001 From: Ramanan Sivaranjan Date: Fri, 24 Oct 2014 16:55:14 -0400 Subject: [PATCH] Add support for the PATCH verb to Pound. PATCH is another HTTP verb commonly used in modern API frameworks to indicate a user is making a partial change to a resource. It's now an option included when you also activate PUT and DELETE. --- config.c | 16 ++++++++-------- pound.8 | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/config.c b/config.c index d37b2fa..6839aca 100644 --- a/config.c +++ b/config.c @@ -8,15 +8,15 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * Pound is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Contact information: * Apsis GmbH * P.O.Box @@ -91,10 +91,10 @@ static regmatch_t matches[5]; static char *xhttp[] = { "^(GET|POST|HEAD) ([^ ]+) HTTP/1.[01]$", - "^(GET|POST|HEAD|PUT|DELETE) ([^ ]+) HTTP/1.[01]$", - "^(GET|POST|HEAD|PUT|DELETE|LOCK|UNLOCK|PROPFIND|PROPPATCH|SEARCH|MKCOL|MOVE|COPY|OPTIONS|TRACE|MKACTIVITY|CHECKOUT|MERGE|REPORT) ([^ ]+) HTTP/1.[01]$", - "^(GET|POST|HEAD|PUT|DELETE|LOCK|UNLOCK|PROPFIND|PROPPATCH|SEARCH|MKCOL|MOVE|COPY|OPTIONS|TRACE|MKACTIVITY|CHECKOUT|MERGE|REPORT|SUBSCRIBE|UNSUBSCRIBE|BPROPPATCH|POLL|BMOVE|BCOPY|BDELETE|BPROPFIND|NOTIFY|CONNECT) ([^ ]+) HTTP/1.[01]$", - "^(GET|POST|HEAD|PUT|DELETE|LOCK|UNLOCK|PROPFIND|PROPPATCH|SEARCH|MKCOL|MOVE|COPY|OPTIONS|TRACE|MKACTIVITY|CHECKOUT|MERGE|REPORT|SUBSCRIBE|UNSUBSCRIBE|BPROPPATCH|POLL|BMOVE|BCOPY|BDELETE|BPROPFIND|NOTIFY|CONNECT|RPC_IN_DATA|RPC_OUT_DATA) ([^ ]+) HTTP/1.[01]$", + "^(GET|POST|HEAD|PUT|DELETE|PATCH) ([^ ]+) HTTP/1.[01]$", + "^(GET|POST|HEAD|PUT|DELETE|PATCH|LOCK|UNLOCK|PROPFIND|PROPPATCH|SEARCH|MKCOL|MOVE|COPY|OPTIONS|TRACE|MKACTIVITY|CHECKOUT|MERGE|REPORT) ([^ ]+) HTTP/1.[01]$", + "^(GET|POST|HEAD|PUT|DELETE|PATCH|LOCK|UNLOCK|PROPFIND|PROPPATCH|SEARCH|MKCOL|MOVE|COPY|OPTIONS|TRACE|MKACTIVITY|CHECKOUT|MERGE|REPORT|SUBSCRIBE|UNSUBSCRIBE|BPROPPATCH|POLL|BMOVE|BCOPY|BDELETE|BPROPFIND|NOTIFY|CONNECT) ([^ ]+) HTTP/1.[01]$", + "^(GET|POST|HEAD|PUT|DELETE|PATCH|LOCK|UNLOCK|PROPFIND|PROPPATCH|SEARCH|MKCOL|MOVE|COPY|OPTIONS|TRACE|MKACTIVITY|CHECKOUT|MERGE|REPORT|SUBSCRIBE|UNSUBSCRIBE|BPROPPATCH|POLL|BMOVE|BCOPY|BDELETE|BPROPFIND|NOTIFY|CONNECT|RPC_IN_DATA|RPC_OUT_DATA) ([^ ]+) HTTP/1.[01]$", }; static int log_level = 1; @@ -502,7 +502,7 @@ static IMPLEMENT_LHASH_HASH_FN(t, TABNODE) #else static IMPLEMENT_LHASH_HASH_FN(t_hash, const TABNODE *) #endif - + static int t_cmp(const TABNODE *d1, const TABNODE *d2) { diff --git a/pound.8 b/pound.8 index 5706a6e..b0a1043 100755 --- a/pound.8 +++ b/pound.8 @@ -365,7 +365,7 @@ Defines which HTTP verbs are accepted. The possible values are: (default) accept only standard HTTP requests (GET, POST, HEAD). .IP .I 1 -additionally allow extended HTTP requests (PUT, DELETE). +additionally allow extended HTTP requests (PUT, PATCH, DELETE). .IP .I 2 additionally allow standard WebDAV verbs (LOCK, UNLOCK, PROPFIND,