HTTP::Headers::Util - Online Linux Manual PageSection : 3
Updated : 2022-01-21
Source : perl v5.34.0
Note : User Contributed Perl Documentation

NAMEHTTP::Headers::Util − Header value parsing utility functions

VERSIONversion 6.36

SYNOPSIS​ use HTTP::Headers::Util qw(split_header_words); ​ @values = split_header_words($h−>header("Content−Type"));

DESCRIPTIONThis module provides a few functions that helps parsing and construction of valid HTTP header values. None of the functions are exported by default. The following functions are available: split_header_words( @header_values ) This function will parse the header values given as argument into a list of anonymous arrays containing key/value pairs. The function knows how to deal with ,, ; and = as well as quoted values after ​=. A list of space separated tokens are parsed as if they were separated by ;. If the @header_values passed as argument contains multiple values, then they are treated as if they were a single value separated by comma ,. This means that this function is useful for parsing header fields that follow this syntax (BNF as from the HTTP/1.1 specification, but we relax the requirement for tokens). ​ headers = #header ​ header = (token | parameter) *( [";"] (token | parameter)) ​ ​ token = 1*<any CHAR except CTLs or separators> ​ separators = "(" | ")" | "<" | ">" | "@" ​ | "," | ";" | ":" | "\" | <"> ​ | "/" | "[" | "]" | "?" | "=" ​ | "{" | "}" | SP | HT ​ ​ quoted−string = ( <"> *(qdtext | quoted−pair ) <"> ) ​ qdtext = <any TEXT except <">> ​ quoted−pair = "\" CHAR ​ ​ parameter = attribute "=" value ​ attribute = token ​ value = token | quoted−string Each header is represented by an anonymous array of key/value pairs. The keys will be all be forced to lower case. The value for a simple token (not part of a parameter) is undef. Syntactically incorrect headers will not necessarily be parsed as you would want. This is easier to describe with some examples: ​ split_header_words('foo="bar"; port="80,81"; DISCARD, BAR=baz'); ​ split_header_words('text/html; charset="iso−8859−1"'); ​ split_header_words('Basic realm="\\"foo\\\\bar\\""'); will return [foo=>'bar', port=>'80,81', discard=> undef], [bar=>'baz' ]['text/html' => undef, charset => 'iso−8859−1'][basic => undef, realm => "\"foo\\bar\""] If you don't want the function to convert tokens and attribute keys to lower case you can call it as _split_header_words instead (with a leading underscore). join_header_words( @arrays ) This will do the opposite of the conversion done by split_header_words(). It takes a list of anonymous arrays as arguments (or a list of key/value pairs) and produces a single header value. Attribute values are quoted if needed. Example: ​ join_header_words(["text/plain" => undef, charset => "iso−8859/1"]); ​ join_header_words("text/plain" => undef, charset => "iso−8859/1"); will both return the string: ​ text/plain; charset="iso−8859/1"

AUTHORGisle Aas <gisle@activestate.com>

COPYRIGHT AND LICENSEThis software is copyright (c) 1994 by Gisle Aas. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
0
Johanes Gumabo
Data Size   :   12,930 byte
man-HTTP::Headers::Util.3pmBuild   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   4 / 166,959
Visitor ID   :     :  
Visitor IP   :   3.144.15.34   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.

ERROR : Need New Coding :         (parse_manual_page_|249|HTTP::Headers::Util.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\| )         (htmlprn|149|HTTP::Headers::Util.3pm|36/37|.el══─{─══. ds --  —  |.el══─{─══. ds -- \|\(em\| )         (parse_manual_page_|249|HTTP::Headers::Util.3pm|43|br══─}─══|'br══─}─══ )         (htmlprn|149|HTTP::Headers::Util.3pm|43|'br══─}─══ |'br══─}─══ )