argra****@users*****
argra****@users*****
2010年 7月 4日 (日) 19:36:21 JST
Index: docs/modules/libwww-perl-5.813/HTTP/Headers/Util.pod diff -u /dev/null docs/modules/libwww-perl-5.813/HTTP/Headers/Util.pod:1.1 --- /dev/null Sun Jul 4 19:36:21 2010 +++ docs/modules/libwww-perl-5.813/HTTP/Headers/Util.pod Sun Jul 4 19:36:21 2010 @@ -0,0 +1,189 @@ + +=encoding euc-jp + +=head1 NAME + +=begin original + +HTTP::Headers::Util - Header value parsing utility functions + +=end original + +HTTP::Headers::Util - ヘッダの値を解析するユーティリティ関数 + +=head1 SYNOPSIS + + use HTTP::Headers::Util qw(split_header_words); + @values = split_header_words($h->header("Content-Type")); + +=head1 DESCRIPTION + +=begin original + +This module provides a few functions that helps parsing and +construction of valid HTTP header values. None of the functions are +exported by default. + +=end original + +このモジュールは正しい HTTP ヘッダ値の解析と組みたてを助けるいくつかの関数を +提供します。 +デフォルトでは何も関数をエクスポートしません。 + +=begin original + +The following functions are available: + +=end original + +以下の関数がつかえます: + +=over 4 + +=item split_header_words( @header_values ) + +=begin original + +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 ";". + +=end original + +この関数は引数で与えられたヘッダの値をキー/値の組が入った無名配列の +リストに解析します。 +この関数は ",", ";", "=" を、"=" の後のクォートされた値と同じくらい +扱い方をよく知っています。 +空白で区切られたトークンは ";" で区切られているように解析されます。 + +=begin original + +If the @header_values passed as argument contains multiple values, +then they are treated as if they were a single value separated by +comma ",". + +=end original + +もし複数の値が入った @header_values が引数として渡されると、カンマ +"," で区切られた一つの値であるかのように扱われます。 + +=begin original + +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). + +=end original + +つまりこの関数は以下の文法に従ったヘッダフィールドを解析するのに便利です。 +(HTTP/1.1 仕様をからの BNF、しかしトークンへの要求は緩めています) 。 + + 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 + +=begin original + +Each I<header> is represented by an anonymous array of key/value +pairs. The value for a simple token (not part of a parameter) is C<undef>. +Syntactically incorrect headers will not necessary be parsed as you +would want. + +=end original + +各 I<header> はキー/値の組の無名配列で表されます。 +単純なトークンの値は (パラメータの一部ではなく) は C<undef> です。 +文法的に正しくないヘッダは、必らずしもあなたの要求通りには解析されません。 + +=begin original + +This is easier to describe with some examples: + +=end original + +幾つかの例で説明するとより簡単です: + + 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\\""'); + +=begin original + +will return + +=end original + +これは以下のように返します。 + + [foo=>'bar', port=>'80,81', discard=> undef], [bar=>'baz' ] + ['text/html' => undef, charset => 'iso-8859-1'] + [Basic => undef, realm => "\"foo\\bar\""] + +=item join_header_words( @arrays ) + +=begin original + +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. + +=end original + +これは split_header_words() によって行われる変換の反対をやります。 +これは無名配列のリスト (あるいはキー/値の組のリスト) を引数として取ります。 +そして一つのヘッダ値を作成します。 +必要であれば属性値はクォートされます。 + +=begin original + +Example: + +=end original + +例: + + join_header_words(["text/plain" => undef, charset => "iso-8859/1"]); + join_header_words("text/plain" => undef, charset => "iso-8859/1"); + +=begin original + +will both return the string: + +=end original + +両方とも以下のような文字列を返します。 + + text/plain; charset="iso-8859/1" + +=back + +=head1 COPYRIGHT + +Copyright 1997-1998, Gisle Aas + +This library is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=begin meta + +Translated: Hippo2000 <GCD00****@nifty*****> (5.48) +Updated: Kentaro SHIRAKATA <argra****@ub32*****> (5.813) + +=end meta +