| 1 |
HTTP/Parser |
| 2 |
=========== |
| 3 |
|
| 4 |
HTTP::Parser is a stateful HTTP request/response parsing module. |
| 5 |
|
| 6 |
It accepts chunks of data passed to it and returns either a completion hint |
| 7 |
or an HTTP::Request (or Response) object when it has the entire request. It |
| 8 |
was originally written to be part of a simple Event.pm-based HTTP server. |
| 9 |
|
| 10 |
e.g. |
| 11 |
|
| 12 |
use HTTP::Parser; |
| 13 |
|
| 14 |
my $parser = HTTP::Parser->new(); |
| 15 |
my @lines = ('GET / HTTP/1.1','Host: localhost','Connection: close','',''); |
| 16 |
|
| 17 |
my $result; |
| 18 |
foreach my $line (@lines) { |
| 19 |
$result = $parser->add("$line\x0d\x0a"); |
| 20 |
print "passing '$line' got '$result'\n"; |
| 21 |
} |
| 22 |
print $parser->object->as_string(); |
| 23 |
|
| 24 |
|
| 25 |
gives: |
| 26 |
|
| 27 |
GET / |
| 28 |
Connection: close |
| 29 |
Host: localhost |
| 30 |
X-HTTP-Version: 1.1 |
| 31 |
|
| 32 |
INSTALLATION |
| 33 |
|
| 34 |
To install this module type the following: |
| 35 |
|
| 36 |
perl Makefile.PL |
| 37 |
make |
| 38 |
make test |
| 39 |
make install |
| 40 |
|
| 41 |
DEPENDENCIES |
| 42 |
|
| 43 |
This module requires these other modules and libraries: |
| 44 |
|
| 45 |
perl 5.6.1 |
| 46 |
|
| 47 |
HTTP::Request |
| 48 |
HTTP::Response (both part of libwww-perl) |
| 49 |
URI |
| 50 |
|
| 51 |
COPYRIGHT AND LICENCE |
| 52 |
|
| 53 |
Copyright (C) 2004-2007 David B. Robins |
| 54 |
Some fixes for 0.05 supplied by David Cannings |
| 55 |
|
| 56 |
This library is free software; you can redistribute it and/or modify |
| 57 |
it under the same terms as Perl itself. |
| 58 |
|