r54059 - in /branches/upstream/libhttp-parser-xs-perl/current: Changes META.yml Makefile.PL README XS.xs lib/HTTP/Parser/XS.pm picohttpparser/picohttpparser.c
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Thu Mar 11 02:21:33 UTC 2010
Author: jawnsy-guest
Date: Thu Mar 11 02:21:25 2010
New Revision: 54059
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=54059
Log:
[svn-upgrade] Integrating new upstream version, libhttp-parser-xs-perl (0.07)
Modified:
branches/upstream/libhttp-parser-xs-perl/current/Changes
branches/upstream/libhttp-parser-xs-perl/current/META.yml
branches/upstream/libhttp-parser-xs-perl/current/Makefile.PL
branches/upstream/libhttp-parser-xs-perl/current/README
branches/upstream/libhttp-parser-xs-perl/current/XS.xs
branches/upstream/libhttp-parser-xs-perl/current/lib/HTTP/Parser/XS.pm
branches/upstream/libhttp-parser-xs-perl/current/picohttpparser/picohttpparser.c
Modified: branches/upstream/libhttp-parser-xs-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-parser-xs-perl/current/Changes?rev=54059&op=diff
==============================================================================
--- branches/upstream/libhttp-parser-xs-perl/current/Changes (original)
+++ branches/upstream/libhttp-parser-xs-perl/current/Changes Thu Mar 11 02:21:25 2010
@@ -1,4 +1,11 @@
Revision history for Perl extension HTTP::Parser::XS.
+
+0.07 Tue Mar 02 15:40:00 2010
+ - fix build error when using older versions of Pod::Text
+
+0.06 Tue Feb 23 06:16:00 2010
+ - fix memory leak, add more checks (thanks to charsbar)
+ - prereq Test::More (see rt.cpan.org #54358)
0.05 Fri Oct 23 21:12:00 2009
- no more (implicitly) depend on Exporter 5.63 (see http://rt.cpan.org/Public/Bug/Display.html?id=50607, thanks to ANDK for reporting)
Modified: branches/upstream/libhttp-parser-xs-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-parser-xs-perl/current/META.yml?rev=54059&op=diff
==============================================================================
--- branches/upstream/libhttp-parser-xs-perl/current/META.yml (original)
+++ branches/upstream/libhttp-parser-xs-perl/current/META.yml Thu Mar 11 02:21:25 2010
@@ -1,21 +1,14 @@
--- #YAML:1.0
-name: HTTP-Parser-XS
-version: 0.05
-abstract: a fast, primitive HTTP request parser
-author:
+name: HTTP-Parser-XS
+version: 0.07
+abstract: a fast, primitive HTTP request parser
+license: ~
+author:
- Kazuho Oku
-license: unknown
-distribution_type: module
-configure_requires:
- ExtUtils::MakeMaker: 0
-build_requires:
- ExtUtils::MakeMaker: 0
-requires: {}
-no_index:
- directory:
- - t
- - inc
-generated_by: ExtUtils::MakeMaker version 6.54
+generated_by: ExtUtils::MakeMaker version 6.42
+distribution_type: module
+requires:
+ Test::More: 0
meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ url: http://module-build.sourceforge.net/META-spec-v1.3.html
+ version: 1.3
Modified: branches/upstream/libhttp-parser-xs-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-parser-xs-perl/current/Makefile.PL?rev=54059&op=diff
==============================================================================
--- branches/upstream/libhttp-parser-xs-perl/current/Makefile.PL (original)
+++ branches/upstream/libhttp-parser-xs-perl/current/Makefile.PL Thu Mar 11 02:21:25 2010
@@ -3,10 +3,28 @@
WriteMakefile(
NAME => 'HTTP::Parser::XS',
VERSION_FROM => 'lib/HTTP/Parser/XS.pm',
- PREREQ_PM => {},
+ PREREQ_PM => {
+ 'Test::More' => 0,
+ },
ABSTRACT_FROM => 'lib/HTTP/Parser/XS.pm',
AUTHOR => 'Kazuho Oku',
LIBS => [],
DEFINE => '',
INC => '-I.',
);
+
+eval {
+ require Pod::Text;
+ my $p = Pod::Text->new;
+ $p->output_fh(do {
+ open my $fh, '>', "README.$$" or die $!;
+ $fh;
+ });
+ $p->parse_file('lib/HTTP/Parser/XS.pm');
+ undef $p;
+ rename "README.$$", 'README'
+ or die $!;
+};
+
+print "Warning: no README, please install newest Pod::Text and rerun Makefile.PL\n"
+ unless -e 'README';
Modified: branches/upstream/libhttp-parser-xs-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-parser-xs-perl/current/README?rev=54059&op=diff
==============================================================================
--- branches/upstream/libhttp-parser-xs-perl/current/README (original)
+++ branches/upstream/libhttp-parser-xs-perl/current/README Thu Mar 11 02:21:25 2010
@@ -1,1 +1,57 @@
-see lib/HTTP/Parser/XS.pm
+NAME
+ HTTP::Parser::XS - a fast, primitive HTTP request parser
+
+SYNOPSIS
+ use HTTP::Parser::XS qw(parse_http_request);
+
+ my $ret = parse_http_request(
+ "GET / HTTP/1.0\r\nHost: ...\r\n\r\n",
+ \%env,
+ );
+ if ($ret == -2) {
+ # request is incomplete
+ ...
+ } elsif ($ret == -1) {
+ # request is broken
+ ...
+ } else {
+ # $ret includes the size of the request, %env now contains a PSGI
+ # request, if it is a POST / PUT request, read request content by
+ # yourself
+ ...
+ }
+
+DESCRIPTION
+ HTTP::Parser::XS is a fast, primitive HTTP request parser that can be
+ used either for writing a synchronous HTTP server or a event-driven
+ server.
+
+METHODS
+ parse_http_request($request_string, \%env)
+ Tries to parse given request string, and if successful, inserts
+ variables into %env. For the name of the variables inserted, please
+ refer to the PSGI specification. The return values are:
+
+ >=0 length of the request (request line and the request
+ headers), in bytes
+
+ -1 given request is corrupt
+
+ -2 given request is incomplete
+
+COPYRIGHT
+ Copyright 2009- Kazuho Oku
+
+AUTHOR
+ Kazuho Oku
+
+THANKS TO
+ nothingmuch charsbar
+
+SEE ALSO
+ HTTP::Parser HTTP::HeaderParser::XS
+
+LICENSE
+ This library is free software; you can redistribute it and/or modify it
+ under the same terms as Perl itself.
+
Modified: branches/upstream/libhttp-parser-xs-perl/current/XS.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-parser-xs-perl/current/XS.xs?rev=54059&op=diff
==============================================================================
--- branches/upstream/libhttp-parser-xs-perl/current/XS.xs (original)
+++ branches/upstream/libhttp-parser-xs-perl/current/XS.xs Thu Mar 11 02:21:25 2010
@@ -66,8 +66,10 @@
if (s[i] == '%') {
int hi, lo;
if ((hi = hex_decode(s[i + 1])) == -1
- || (lo = hex_decode(s[i + 2])) == -1)
- return NULL;
+ || (lo = hex_decode(s[i + 2])) == -1) {
+ free(dbuf);
+ return NULL;
+ }
*d++ = hi * 16 + lo;
i += 3;
} else
@@ -120,6 +122,9 @@
if (ret < 0)
goto done;
+ if (!SvROK(envref))
+ Perl_croak(aTHX_ "second param to parse_http_request should be a hashref");
+
env = (HV*)SvRV(envref);
if (SvTYPE(env) != SVt_PVHV)
Perl_croak(aTHX_ "second param to parse_http_request should be a hashref");
Modified: branches/upstream/libhttp-parser-xs-perl/current/lib/HTTP/Parser/XS.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-parser-xs-perl/current/lib/HTTP/Parser/XS.pm?rev=54059&op=diff
==============================================================================
--- branches/upstream/libhttp-parser-xs-perl/current/lib/HTTP/Parser/XS.pm (original)
+++ branches/upstream/libhttp-parser-xs-perl/current/lib/HTTP/Parser/XS.pm Thu Mar 11 02:21:25 2010
@@ -11,7 +11,7 @@
our @EXPORT_OK = @{$EXPORT_TAGS{all}};
our @EXPORT = ();
-our $VERSION = '0.05';
+our $VERSION = '0.07';
require XSLoader;
XSLoader::load('HTTP::Parser::XS', $VERSION);
@@ -74,13 +74,18 @@
=back
+=head1 COPYRIGHT
+
+Copyright 2009- Kazuho Oku
+
=head1 AUTHOR
-Kazuho Oku E<lt>kazuhooku at gmail.comE<gt>
+Kazuho Oku
=head1 THANKS TO
nothingmuch
+charsbar
=head1 SEE ALSO
Modified: branches/upstream/libhttp-parser-xs-perl/current/picohttpparser/picohttpparser.c
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-parser-xs-perl/current/picohttpparser/picohttpparser.c?rev=54059&op=diff
==============================================================================
--- branches/upstream/libhttp-parser-xs-perl/current/picohttpparser/picohttpparser.c (original)
+++ branches/upstream/libhttp-parser-xs-perl/current/picohttpparser/picohttpparser.c Thu Mar 11 02:21:25 2010
@@ -6,7 +6,7 @@
return -2; \
}
-#define EXPECT(ch) \
+#define EXPECT_CHAR(ch) \
CHECK_EOF(); \
if (*buf++ != ch) { \
return -1; \
@@ -32,7 +32,7 @@
if (*buf == '\r') {
++buf;
CHECK_EOF();
- EXPECT('\n');
+ EXPECT_CHAR('\n');
++ret_cnt;
} else if (*buf == '\n') {
++buf;
@@ -70,7 +70,7 @@
CHECK_EOF();
if (*buf == '\r') {
++buf;
- EXPECT('\n');
+ EXPECT_CHAR('\n');
} else if (*buf == '\n') {
++buf;
}
@@ -84,8 +84,8 @@
ADVANCE_TOKEN();
*path_len = buf - *path;
++buf;
- EXPECT('H'); EXPECT('T'); EXPECT('T'); EXPECT('P'); EXPECT('/'); EXPECT('1');
- EXPECT('.');
+ EXPECT_CHAR('H'); EXPECT_CHAR('T'); EXPECT_CHAR('T'); EXPECT_CHAR('P'); EXPECT_CHAR('/'); EXPECT_CHAR('1');
+ EXPECT_CHAR('.');
*minor_version = 0;
for (; ; ++buf) {
CHECK_EOF();
@@ -97,7 +97,7 @@
}
if (*buf == '\r') {
++buf;
- EXPECT('\n');
+ EXPECT_CHAR('\n');
} else if (*buf == '\n') {
++buf;
} else {
@@ -110,7 +110,7 @@
CHECK_EOF();
if (*buf == '\r') {
++buf;
- EXPECT('\n');
+ EXPECT_CHAR('\n');
break;
} else if (*buf == '\n') {
++buf;
@@ -148,7 +148,7 @@
if (*buf == '\r') {
headers[*num_headers].value_len = buf - headers[*num_headers].value;
++buf;
- EXPECT('\n');
+ EXPECT_CHAR('\n');
break;
} else if (*buf == '\n') {
headers[*num_headers].value_len = buf - headers[*num_headers].value;
@@ -162,5 +162,5 @@
}
#undef CHECK_EOF
-#undef EXPECT
+#undef EXPECT_CHAR
#undef ADVACE_TOKEN
More information about the Pkg-perl-cvs-commits
mailing list