Blame 0002-Added-support-for-SUBSCRIBE-and-UNSUBSCRIBE-request-.patch

389fac3
From f825b52b7f2d4bf86c3300ae33ceb3dd1fa64571 Mon Sep 17 00:00:00 2001
389fac3
From: Nathan Rajlich <nathan@tootallnate.net>
389fac3
Date: Tue, 12 Oct 2010 14:09:34 -0700
389fac3
Subject: [PATCH 2/2] Added support for "SUBSCRIBE" and "UNSUBSCRIBE" request methods.
389fac3
389fac3
---
389fac3
 http_parser.c |    7 ++++++-
389fac3
 http_parser.h |    4 +++-
389fac3
 2 files changed, 9 insertions(+), 2 deletions(-)
389fac3
389fac3
diff --git a/http_parser.c b/http_parser.c
389fac3
index 57a1b94..5a0972a 100644
389fac3
--- a/http_parser.c
389fac3
+++ b/http_parser.c
389fac3
@@ -95,6 +95,8 @@ static const char *method_strings[] =
389fac3
   , "MERGE"
389fac3
   , "M-SEARCH"
389fac3
   , "NOTIFY"
389fac3
+  , "SUBSCRIBE"
389fac3
+  , "UNSUBSCRIBE"
389fac3
   };
389fac3
 
389fac3
 
389fac3
@@ -582,8 +584,9 @@ size_t http_parser_execute (http_parser *parser,
389fac3
           case 'O': parser->method = HTTP_OPTIONS; break;
389fac3
           case 'P': parser->method = HTTP_POST; /* or PROPFIND or PROPPATCH or PUT */ break;
389fac3
           case 'R': parser->method = HTTP_REPORT; break;
389fac3
+          case 'S': parser->method = HTTP_SUBSCRIBE; break;
389fac3
           case 'T': parser->method = HTTP_TRACE; break;
389fac3
-          case 'U': parser->method = HTTP_UNLOCK; break;
389fac3
+          case 'U': parser->method = HTTP_UNLOCK; /* or UNSUBSCRIBE */ break;
389fac3
           default: goto error;
389fac3
         }
389fac3
         state = s_req_method;
389fac3
@@ -620,6 +623,8 @@ size_t http_parser_execute (http_parser *parser,
389fac3
           parser->method = HTTP_PROPFIND; /* or HTTP_PROPPATCH */
389fac3
         } else if (index == 1 && parser->method == HTTP_POST && ch == 'U') {
389fac3
           parser->method = HTTP_PUT;
389fac3
+        } else if (index == 2 && parser->method == HTTP_UNLOCK && ch == 'S') {
389fac3
+          parser->method = HTTP_UNSUBSCRIBE;
389fac3
         } else if (index == 4 && parser->method == HTTP_PROPFIND && ch == 'P') {
389fac3
           parser->method = HTTP_PROPPATCH;
389fac3
         } else {
389fac3
diff --git a/http_parser.h b/http_parser.h
389fac3
index 43cc1bd..c03ec05 100644
389fac3
--- a/http_parser.h
389fac3
+++ b/http_parser.h
389fac3
@@ -101,9 +101,11 @@ enum http_method
389fac3
   , HTTP_MKACTIVITY
389fac3
   , HTTP_CHECKOUT
389fac3
   , HTTP_MERGE
389fac3
-  /* ssdp */
389fac3
+  /* upnp */
389fac3
   , HTTP_MSEARCH
389fac3
   , HTTP_NOTIFY
389fac3
+  , HTTP_SUBSCRIBE
389fac3
+  , HTTP_UNSUBSCRIBE
389fac3
   };
389fac3
 
389fac3
 
389fac3
-- 
389fac3
1.7.3.4
389fac3