user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] http: use Plack::HTTPParser for HTTP parsing
Date: Sat, 12 Mar 2016 03:59:08 +0000	[thread overview]
Message-ID: <20160312035908.30538-1-e@80x24.org> (raw)

This allows us to reduce installation dependencies while
retaining performance as it favors HTTP::Parser::XS when
it is installed and available.

PLACK_HTTP_PARSER_PP may be set to 1 to force a pure Perl
parser for testing.
---
 lib/PublicInbox/HTTP.pm | 2 +-
 t/httpd-corner.t        | 2 +-
 t/httpd-unix.t          | 2 +-
 t/httpd.t               | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm
index 2888311..a5c56e2 100644
--- a/lib/PublicInbox/HTTP.pm
+++ b/lib/PublicInbox/HTTP.pm
@@ -13,7 +13,7 @@ use warnings;
 use base qw(Danga::Socket);
 use fields qw(httpd env rbuf input_left remote_addr remote_port);
 use Fcntl qw(:seek);
-use HTTP::Parser::XS qw(parse_http_request); # supports pure Perl fallback
+use Plack::HTTPParser qw(parse_http_request); # XS or pure Perl
 use HTTP::Status qw(status_message);
 use HTTP::Date qw(time2str);
 use IO::File;
diff --git a/t/httpd-corner.t b/t/httpd-corner.t
index 59f37aa..b64f334 100644
--- a/t/httpd-corner.t
+++ b/t/httpd-corner.t
@@ -7,7 +7,7 @@ use warnings;
 use Test::More;
 
 foreach my $mod (qw(Plack::Util Plack::Request Plack::Builder Danga::Socket
-			HTTP::Parser::XS HTTP::Date HTTP::Status)) {
+			HTTP::Date HTTP::Status)) {
 	eval "require $mod";
 	plan skip_all => "$mod missing for httpd-corner.t" if $@;
 }
diff --git a/t/httpd-unix.t b/t/httpd-unix.t
index 13df676..00adf13 100644
--- a/t/httpd-unix.t
+++ b/t/httpd-unix.t
@@ -6,7 +6,7 @@ use warnings;
 use Test::More;
 
 foreach my $mod (qw(Plack::Util Plack::Request Plack::Builder Danga::Socket
-			HTTP::Parser::XS HTTP::Date HTTP::Status)) {
+			HTTP::Date HTTP::Status)) {
 	eval "require $mod";
 	plan skip_all => "$mod missing for httpd-unix.t" if $@;
 }
diff --git a/t/httpd.t b/t/httpd.t
index 25b4f41..28f507d 100644
--- a/t/httpd.t
+++ b/t/httpd.t
@@ -5,7 +5,7 @@ use warnings;
 use Test::More;
 
 foreach my $mod (qw(Plack::Util Plack::Request Plack::Builder Danga::Socket
-			HTTP::Parser::XS HTTP::Date HTTP::Status)) {
+			HTTP::Date HTTP::Status)) {
 	eval "require $mod";
 	plan skip_all => "$mod missing for httpd.t" if $@;
 }
-- 
EW


                 reply	other threads:[~2016-03-12  3:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160312035908.30538-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).