Git Product home page Git Product logo

cookie-xs's Introduction

NAME
    Cookie::XS - HTTP Cookie parser in C (Please use CGI::Cookie::XS
    instead)

VERSION
    This document describes Cookie::XS 0.11 released on September 12, 2008.

SYNOPSIS
        use Cookie::XS;

        my $raw_cookie = 'foo=a%20phrase; haha; bar=yes%2C%20a%20phrase; baz=%5Ewibble&leiyh; qux=%27';
        my $res = Cookie::XS->parse($raw_cookie);
        # $res is something like:
        #    {
        #      'bar' => [
        #                 'yes, a phrase'
        #               ],
        #      'baz' => [
        #                 '^wibble',
        #                 'leiyh'
        #               ],
        #      'foo' => [
        #                 'a phrase'
        #               ],
        #      'qux' => [
        #                 '\''
        #               ]
        #    };

        # or directly read raw cookies from the CGI environments:
        $res = Cookie::XS->fetch;

DESCRIPTION
    WARNING: This module is obsolete now; please use CGI::Cookie::XS
    instead.

    This module implements a very simple parser for cookies used in HTTP
    applications. We've found CGI::Simple::Cookie and CGI::Cookie rather
    slow according to the profiling results for our OpenResty project, hence
    the rewrite in C.

    This library is still in pre-alpha stage and the API is still in flux.
    We're just following the "release early, releaes often" guideline. So
    please check back often ;)

METHODS
    We currently provide 2 static methods, "parse" and "fetch". They work
    mostly the same way as those methods found in CGI::Cookie and
    CGI::Simple::Cookie but with the exception that our version returns
    plain Perl data structures rather than hashes of Perl objects (due to
    performance considerations).

    We'll implement some cookie dump methods in the near future.

    "$ref = Cookie::XS->parse($raw_cookie)"
        Parses $raw_cookie and returns the reference of a hash of arrays.
        The keys of the hash are cookie variables' names while the values of
        the hash are lists of cookie variable's values.

        There is a length limit on the $raw_cookie. If $raw_cookie is longer
        than 4 KB (i.e. 4 * 1024 bytes, excluding the trailing '\0'), the
        overflowing part will be truncated.

        Also note that, "fetch" does not assume any encoding on the cookie
        values. It just decodes the encoded entries verbatim and treat them
        as plain "binary" stuff.

    "$ref = Cookie::XS->fetch()"
        Reads the raw cookie from the "HTTP_COOKIE" and "COOKIE"
        environments (which are usually set by HTTP servers like lighttd or
        apache) and then parses the value using the "parse" method and
        finally returns the results.

TODO
    *   Removing trailing spaces in cookie values.

SOURCE CONTROL
    For the very latest version of this module, check out the source from
    the SVN repos below:

    <http://svn.openfoundry.org/cookieparser>

    There is anonymous access to all. If you'd like a commit bit, please let
    us know. :)

BUGS
    There must be some serious bugs lurking somewhere. We haven't done
    comprehensive testing for our code yet. It's a TODO.

    Please report bugs or send wish-list to
    <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Cookie-XS>.

SEE ALSO
    CGI::Cookie, CGI::Cookie::Simple.

AUTHOR
    yuting "<yuting at alibaba-inc.com>"
    agentzh "<agentzh at yahoo.cn>"

COPYRIGHT
    Copyright (c) 2008 by Yahoo! China EEEE Works, Alibaba Inc.

License
    The "MIT" License

    Permission is hereby granted, free of charge, to any person obtaining a
    copy of this software and associated documentation files (the
    "Software"), to deal in the Software without restriction, including
    without limitation the rights to use, copy, modify, merge, publish,
    distribute, sublicense, and/or sell copies of the Software, and to
    permit persons to whom the Software is furnished to do so, subject to
    the following conditions:

    The above copyright notice and this permission notice shall be included
    in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

cookie-xs's People

Contributors

agentzh avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.