{
    "mode": "perldoc",
    "parameter": "HTTP::Config",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/HTTP%3A%3AConfig/json",
    "generated": "2026-06-12T05:48:04Z",
    "synopsis": "use HTTP::Config;\nmy $c = HTTP::Config->new;\n$c->add(mdomain => \".example.com\", mscheme => \"http\", verbose => 1);\nuse HTTP::Request;\nmy $request = HTTP::Request->new(GET => \"http://www.example.com\");\nif (my @m = $c->matching($request)) {\nprint \"Yadayada\\n\" if $m[0]->{verbose};\n}",
    "sections": {
        "NAME": {
            "content": "HTTP::Config - Configuration for request and response objects\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 6.36\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use HTTP::Config;\nmy $c = HTTP::Config->new;\n$c->add(mdomain => \".example.com\", mscheme => \"http\", verbose => 1);\n\nuse HTTP::Request;\nmy $request = HTTP::Request->new(GET => \"http://www.example.com\");\n\nif (my @m = $c->matching($request)) {\nprint \"Yadayada\\n\" if $m[0]->{verbose};\n}\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "An \"HTTP::Config\" object is a list of entries that can be matched against request or\nrequest/response pairs. Its purpose is to hold configuration data that can be looked up given a\nrequest or response object.\n\nEach configuration entry is a hash. Some keys specify matching to occur against attributes of\nrequest/response objects. Other keys can be used to hold user data.\n\nThe following methods are provided:\n\n$conf = HTTP::Config->new\nConstructs a new empty \"HTTP::Config\" object and returns it.\n\n$conf->entries\nReturns the list of entries in the configuration object. In scalar context returns the\nnumber of entries.\n\n$conf->empty\nReturn true if there are no entries in the configuration object. This is just a shorthand\nfor \"not $conf->entries\".\n\n$conf->add( %matchspec, %other )\n$conf->add( \\%entry )\nAdds a new entry to the configuration. You can either pass separate key/value pairs or a\nhash reference.\n\n$conf->remove( %spec )\nRemoves (and returns) the entries that have matches for all the key/value pairs in %spec. If\n%spec is empty this will match all entries; so it will empty the configuration object.\n\n$conf->matching( $uri, $request, $response )\n$conf->matching( $uri )\n$conf->matching( $request )\n$conf->matching( $response )\nReturns the entries that match the given $uri, $request and $response triplet.\n\nIf called with a single $request object then the $uri is obtained by calling its\n'uricanonical' method. If called with a single $response object, then the request object is\nobtained by calling its 'request' method; and then the $uri is obtained as if a single\n$request was provided.\n\nThe entries are returned with the most specific matches first. In scalar context returns the\nmost specific match or \"undef\" in none match.\n\n$conf->additem( $item, %matchspec )\n$conf->removeitems( %spec )\n$conf->matchingitems( $uri, $request, $response )\nWrappers that hides the entries themselves.\n",
            "subsections": [
                {
                    "name": "Matching",
                    "content": "The following keys on a configuration entry specify matching. For all of these you can provide\nan array of values instead of a single value. The entry matches if at least one of the values in\nthe array matches.\n\nEntries that require match against a response object attribute will never match unless a\nresponse object was provided.\n\nmscheme => $scheme\nMatches if the URI uses the specified scheme; e.g. \"http\".\n\nmsecure => $bool\nIf $bool is TRUE; matches if the URI uses a secure scheme. If $bool is FALSE; matches if the\nURI does not use a secure scheme. An example of a secure scheme is \"https\".\n\nmhostport => \"$hostname:$port\"\nMatches if the URI's hostport method return the specified value.\n\nmhost => $hostname\nMatches if the URI's host method returns the specified value.\n\nmport => $port\nMatches if the URI's port method returns the specified value.\n\nmdomain => \".$domain\"\nMatches if the URI's host method return a value that within the given domain. The hostname\n\"www.example.com\" will for instance match the domain \".com\".\n\nmpath => $path\nMatches if the URI's path method returns the specified value.\n\nmpathprefix => $path\nMatches if the URI's path is the specified path or has the specified path as prefix.\n\nmpathmatch => $Regexp\nMatches if the regular expression matches the URI's path. Eg. qr/\\.html$/.\n\nmmethod => $method\nMatches if the request method matches the specified value. Eg. \"GET\" or \"POST\".\n\nmcode => $digit\nmcode => $statuscode\nMatches if the response status code matches. If a single digit is specified; matches for all\nresponse status codes beginning with that digit.\n\nmproxy => $url\nMatches if the request is to be sent to the given Proxy server.\n\nmmediatype => \"*/*\"\nmmediatype => \"text/*\"\nmmediatype => \"html\"\nmmediatype => \"xhtml\"\nmmediatype => \"text/html\"\nMatches if the response media type matches.\n\nWith a value of \"html\" matches if $response->contentishtml returns TRUE. With a value of\n\"xhtml\" matches if $response->contentisxhtml returns TRUE.\n\nmuri*$method* => undef\nMatches if the URI object provides the method.\n\nmuri*$method* => $string\nMatches if the URI's $method method returns the given value.\n\nmheader*$field* => $string\nMatches if either the request or the response have a header $field with the given value.\n\nmresponseattr*$key* => undef\nmresponseattr*$key* => $string\nMatches if the response object has that key, or the entry has the given value.\n"
                }
            ]
        },
        "SEE ALSO": {
            "content": "URI, HTTP::Request, HTTP::Response\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Gisle Aas <gisle@activestate.com>\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "This software is copyright (c) 1994 by Gisle Aas.\n\nThis is free software; you can redistribute it and/or modify it under the same terms as the Perl\n5 programming language system itself.\n",
            "subsections": []
        }
    },
    "summary": "HTTP::Config - Configuration for request and response objects",
    "flags": [],
    "examples": [],
    "see_also": []
}