1HTTP::Parser::XS(3)   User Contributed Perl Documentation  HTTP::Parser::XS(3)
2
3
4

NAME

6       HTTP::Parser::XS - a fast, primitive HTTP request parser
7

SYNOPSIS

9         use HTTP::Parser::XS qw(parse_http_request);
10
11         my $ret = parse_http_request(
12             "GET / HTTP/1.0\r\nHost: ...\r\n\r\n",
13             \%env,
14         );
15         if ($ret == -2) {
16             # request is incomplete
17             ...
18         } elsif ($ret == -1) {
19             # request is broken
20             ...
21         } else {
22             # $ret includes the size of the request, %env now contains a PSGI
23             # request, if it is a POST / PUT request, read request content by
24             # yourself
25             ...
26         }
27

DESCRIPTION

29       HTTP::Parser::XS is a fast, primitive HTTP request parser that can be
30       used either for writing a synchronous HTTP server or a event-driven
31       server.
32

METHODS

34       parse_http_request($request_string, \%env)
35           Tries to parse given request string, and if successful, inserts
36           variables into %env.  For the name of the variables inserted,
37           please refer to the PSGI specification.  The return values are:
38
39           >=0     length of the request (request line and the request
40                   headers), in bytes
41
42           -1      given request is corrupt
43
44           -2      given request is incomplete
45
47       Copyright 2009- Kazuho Oku
48

AUTHOR

50       Kazuho Oku
51

THANKS TO

53       nothingmuch charsbar
54

SEE ALSO

56       HTTP::Parser HTTP::HeaderParser::XS
57

LICENSE

59       This library is free software; you can redistribute it and/or modify it
60       under the same terms as Perl itself.
61
62
63
64perl v5.12.0                      2010-03-02               HTTP::Parser::XS(3)
Impressum