No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib/HTTP Need binding to preserve Nilness Aug 14, 2018
t Add test for #4 Nov 6, 2016
.gitignore
.travis.yml
LICENSE
META6.json Remove leading 'v' for suppressing panda warning Jan 14, 2016
README.md regen readme Nov 5, 2015

README.md

Build Status

NAME

HTTP::Parser - HTTP parser.

SYNOPSIS

use HTTP::Parser;

my ($result, $env) = parse-http-request("GET / HTTP/1.0\x0d\x0acontent-type: text/html\x0d\x0a\x0d\x0a".encode("ascii"));
# $result => 43
# $env => ${:CONTENT_TYPE("text/html"), :PATH_INFO("/"), :QUERY_STRING(""), :REQUEST_METHOD("GET")}

DESCRIPTION

HTTP::Parser is tiny http request parser library for perl6.

FUNCTIONS

  • my ($result, $env) = sub parse-http-request(Blob[uint8] $req) is export

parse http request.

$req must be Blob[uint8]. Not utf8.

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 AND LICENSE

Copyright 2015 Tokuhiro Matsuno tokuhirom@gmail.com

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.