New upstream release 1.0

- Remove patches, no longer needed for nodejs
- Fix typo in -devel description
- use github tarball instead of checkout
This commit is contained in:
Matěj Cepl 2011-08-23 13:15:02 +02:00
parent 4b6f69bcd3
commit 0cf3a66044
5 changed files with 18 additions and 185 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/http-parser.tar.gz
/ry-http-parser-v1.0-0-g32c0e11.tar.gz

View File

@ -1,106 +0,0 @@
From d56a0700d0d9ccad427995e3da88856a96d2a455 Mon Sep 17 00:00:00 2001
From: Nathan Rajlich <nathan@tootallnate.net>
Date: Tue, 12 Oct 2010 11:23:22 -0700
Subject: [PATCH 1/2] Add support for "M-SEARCH" and "NOTIFY" request methods.
Allow a request path of "*" (for SSDP requests).
---
http_parser.c | 9 +++++++--
http_parser.h | 3 +++
test.c | 25 +++++++++++++++++++++++++
3 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/http_parser.c b/http_parser.c
index 492ef17..57a1b94 100644
--- a/http_parser.c
+++ b/http_parser.c
@@ -93,6 +93,8 @@ static const char *method_strings[] =
, "MKACTIVITY"
, "CHECKOUT"
, "MERGE"
+ , "M-SEARCH"
+ , "NOTIFY"
};
@@ -575,7 +577,8 @@ size_t http_parser_execute (http_parser *parser,
case 'G': parser->method = HTTP_GET; break;
case 'H': parser->method = HTTP_HEAD; break;
case 'L': parser->method = HTTP_LOCK; break;
- case 'M': parser->method = HTTP_MKCOL; /* or MOVE, MKACTIVITY, MERGE */ break;
+ case 'M': parser->method = HTTP_MKCOL; /* or MOVE, MKACTIVITY, MERGE, M-SEARCH */ break;
+ case 'N': parser->method = HTTP_NOTIFY; break;
case 'O': parser->method = HTTP_OPTIONS; break;
case 'P': parser->method = HTTP_POST; /* or PROPFIND or PROPPATCH or PUT */ break;
case 'R': parser->method = HTTP_REPORT; break;
@@ -608,6 +611,8 @@ size_t http_parser_execute (http_parser *parser,
parser->method = HTTP_MOVE;
} else if (index == 1 && ch == 'E') {
parser->method = HTTP_MERGE;
+ } else if (index == 1 && ch == '-') {
+ parser->method = HTTP_MSEARCH;
} else if (index == 2 && ch == 'A') {
parser->method = HTTP_MKACTIVITY;
}
@@ -628,7 +633,7 @@ size_t http_parser_execute (http_parser *parser,
{
if (ch == ' ') break;
- if (ch == '/') {
+ if (ch == '/' || ch == '*') {
MARK(url);
MARK(path);
state = s_req_path;
diff --git a/http_parser.h b/http_parser.h
index ca7f562..43cc1bd 100644
--- a/http_parser.h
+++ b/http_parser.h
@@ -101,6 +101,9 @@ enum http_method
, HTTP_MKACTIVITY
, HTTP_CHECKOUT
, HTTP_MERGE
+ /* ssdp */
+ , HTTP_MSEARCH
+ , HTTP_NOTIFY
};
diff --git a/test.c b/test.c
index d1feae0..e5699aa 100644
--- a/test.c
+++ b/test.c
@@ -557,6 +557,31 @@ const struct message requests[] =
,.body= ""
}
+#define MSEARCH_REQ 19
+, {.name= "m-search request"
+ ,.type= HTTP_REQUEST
+ ,.raw= "M-SEARCH * HTTP/1.1\r\n"
+ "HOST: 239.255.255.250:1900\r\n"
+ "MAN: \"ssdp:discover\"\r\n"
+ "ST: \"ssdp:all\"\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_MSEARCH
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "*"
+ ,.request_url= "*"
+ ,.num_headers= 3
+ ,.headers= { { "HOST", "239.255.255.250:1900" }
+ , { "MAN", "\"ssdp:discover\"" }
+ , { "ST", "\"ssdp:all\"" }
+ }
+ ,.body= ""
+ }
+
, {.name= NULL } /* sentinel */
};
--
1.7.3.4

View File

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

View File

@ -1,20 +1,17 @@
%global somajor 0
%global sominor 3
%global somajor 1
%global sominor 0
%global git_hash 32c0e11
Name: http-parser
Version: %{somajor}.%{sominor}
Release: 6.20100911git%{?dist}
Release: 1%{?dist}
Summary: HTTP request/response parser for C
Group: System Environment/Libraries
License: MIT
URL: http://github.com/ry/http-parser
# git clone http://github.com/ry/http-parser.git
# cd http-parser/
# git archive 459507f5 --prefix=http-parser/ |gzip -9 >../http-parser.tar.gz
Source0: http-parser.tar.gz
Patch0: 0001-Add-support-for-M-SEARCH-and-NOTIFY-request-methods.patch
Patch1: 0002-Added-support-for-SUBSCRIBE-and-UNSUBSCRIBE-request-.patch
# download from https://github.com/ry/http-parser/tarball/v%%{version}
Source0: ry-http-parser-v%{version}-0-g%{git_hash}.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
%description
@ -32,13 +29,11 @@ Summary: Development headers and libraries for http-parser
Requires: %{name} = %{version}-%{release}
%description devel
Development headers and libraries for htt-parser.
Development headers and libraries for http-parser.
%prep
%setup -q -n %{name}
%patch0 -p1
%patch1 -p1
%setup -q -n ry-http-parser-%{git_hash}
%build
@ -82,13 +77,19 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Mon Aug 22 2011 T.C. Hollingsworth <tchollingsworth@gmail.com> - 1.0-1
- New upstream release 1.0
- Remove patches, no longer needed for nodejs
- Fix typo in -devel description
- use github tarball instead of checkout
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3-6.20100911git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Tue Jan 11 2011 Lubomir Rintel <lkundrak@v3.sk> - 0.3-5.20100911git
- Add support for methods used by node.js
* Thu Nov 4 2010 Dan Horák <dan[at]danny.cz> - 0.3-4.20100911git
* Thu Nov 4 2010 Dan Horák <dan[at]danny.cz> - 0.3-4.20100911git
- build with -fsigned-char
* Wed Sep 29 2010 jkeating - 0.3-3.20100911git
@ -98,4 +99,4 @@ rm -rf $RPM_BUILD_ROOT
- Call ldconfig (Peter Lemenkov)
* Fri Sep 17 2010 Lubomir Rintel <lkundrak@v3.sk> - 0.3-1.20100911git
- Initial packaging
- Initial packaging

View File

@ -1 +1 @@
d6a9377a4ed8288a8cb544389fd9bf88 http-parser.tar.gz
c24c8f016eebcb30afb96c51ee938b0a ry-http-parser-v1.0-0-g32c0e11.tar.gz