argra****@users*****
argra****@users*****
2009年 4月 18日 (土) 21:13:21 JST
Index: docs/modules/libwww-perl-5.813/HTTP/Headers.pod diff -u /dev/null docs/modules/libwww-perl-5.813/HTTP/Headers.pod:1.1 --- /dev/null Sat Apr 18 21:13:21 2009 +++ docs/modules/libwww-perl-5.813/HTTP/Headers.pod Sat Apr 18 21:13:21 2009 @@ -0,0 +1,880 @@ + +=encoding euc-jp + +=head1 NAME + +=begin original + +HTTP::Headers - Class encapsulating HTTP Message headers + +=end original + +HTTP::Headers - HTTPメッセージヘッダをカプセル化するクラス + +=head1 SYNOPSIS + + require HTTP::Headers; + $h = HTTP::Headers->new; + + $h->header('Content-Type' => 'text/plain'); # set + $ct = $h->header('Content-Type'); # get + $h->remove_header('Content-Type'); # delete + +=head1 DESCRIPTION + +=begin original + +The C<HTTP::Headers> class encapsulates HTTP-style message headers. +The headers consist of attribute-value pairs also called fields, which +may be repeated, and which are printed in a particular order. The +field names are cases insensitive. + +=end original + +HTTP::HeadersクラスはHTTP形式メッセージヘッダをカプセル化します。 +ヘッダはフィールドとも呼ばれる属性-値の組み合わせで構成され、それは +繰り返しがあるかも知れず、特定の順序で出力されます。 +フィールド名は大文字小文字を無視します。 + +=begin original + +Instances of this class are usually created as member variables of the +C<HTTP::Request> and C<HTTP::Response> classes, internal to the +library. + +=end original + +このクラスのインスタンスは通常、C<HTTP::Request> や +C<HTTP::Response> クラスのメンバ変数として、ライブラリ内部用に +作成されます。 + +=begin original + +The following methods are available: + +=end original + +以下のメソッドが利用できます: + +=over 4 + +=item $h = HTTP::Headers->new + +=begin original + +Constructs a new C<HTTP::Headers> object. You might pass some initial +attribute-value pairs as parameters to the constructor. I<E.g.>: + +=end original + +新しい C<HTTP::Headers> オブジェクトを組み立てます。 +コンストラクタのパラメータを通して初期の属性-値の組を渡すことが出来ます。 +I<例えば>: + + $h = HTTP::Headers->new( + Date => 'Thu, 03 Feb 1994 00:00:00 GMT', + Content_Type => 'text/html; version=3.2', + Content_Base => 'http://www.perl.org/'); + +=begin original + +The constructor arguments are passed to the C<header> method which is +described below. + +=end original + +The constructor arguments are passed to the C<header> method which is +described below. +(TBT) + +=item $h->clone + +=begin original + +Returns a copy of this C<HTTP::Headers> object. + +=end original + +C<HTTP::Headers> オブジェクトのコピーを返します。 + +=item $h->header( $field ) + +=item $h->header( $field => $value, ... ) + +=begin original + +Get or set the value of one or more header fields. The header field +name ($field) is not case sensitive. To make the life easier for perl +users who wants to avoid quoting before the => operator, you can use +'_' as a replacement for '-' in header names. + +=end original + +ひとつまたは複数のヘッダフィールドの値を取得あるいは設定します。 +ヘッダフィールド名($field)は大文字小文字を区別しません。 +=> 演算子の前にクォートしたくない Perl ユーザに簡単なように、ヘッダ名での +'-' の代わりとして '_' を使うことが出来ます。 + +=begin original + +The header() method accepts multiple ($field => $value) pairs, which +means that you can update several fields with a single invocation. + +=end original + +header()メソッドは複数の($field => $values) の組をうけとるので、 +1 回の呼び出しでたくさんのフィールドを更新することが出来ます。 + +=begin original + +The $value argument may be a plain string or a reference to an array +of strings for a multi-valued field. If the $value is provided as +C<undef> then the field is removed. If the $value is not given, then +that header field will remain unchanged. + +=end original + +$value 引数は普通の文字列または複数の値を持つフィールドのための +文字列のリストへのリファレンスにすることができます。 +$value 引数が C<undef> の場合、フィールドは削除されます。 +$value が指定されなければヘッダは変更されません。 + +=begin original + +The old value (or values) of the last of the header fields is returned. +If no such field exists C<undef> will be returned. + +=end original + +最後のヘッダフィールドの古い値が返されます。 +If no such field exists C<undef> will be returned. +(TBT) + +=begin original + +A multi-valued field will be returned as separate values in list +context and will be concatenated with ", " as separator in scalar +context. The HTTP spec (RFC 2616) promise that joining multiple +values in this way will not change the semantic of a header field, but +in practice there are cases like old-style Netscape cookies (see +L<HTTP::Cookies>) where "," is used as part of the syntax of a single +field value. + +=end original + +複数の値を持つフィールドは、 +リストコンテキストでは別々の値として返され、 +スカラコンテキストでは ", " を区切り文字としてつなげられます。 +The HTTP spec (RFC 2616) promise that joining multiple +values in this way will not change the semantic of a header field, but +in practice there are cases like old-style Netscape cookies (see +L<HTTP::Cookies>) where "," is used as part of the syntax of a single +field value. +(TBT) + +=begin original + +Examples: + +=end original + +例: + + $header->header(MIME_Version => '1.0', + User_Agent => 'My-Web-Client/0.01'); + $header->header(Accept => "text/html, text/plain, image/*"); + $header->header(Accept => [qw(text/html text/plain image/*)]); + @accepts = $header->header('Accept'); # get multiple values + $accepts = $header->header('Accept'); # get values as a single string + +=item $h->push_header( $field => $value ) + +=begin original + +Add a new field value for the specified header field. Previous values +for the same field are retained. + +=end original + +指定されたヘッダに新しいフィールドの値を追加します。 +同じフィールドの以前の値は残ります。 + +=begin original + +As for the header() method, the field name ($field) is not case +sensitive and '_' can be used as a replacement for '-'. + +=end original + +As for the header() method, the field name ($field) is not case +sensitive and '_' can be used as a replacement for '-'. +(TBT) + +=begin original + +The $value argument may be a scalar or a reference to a list of +scalars. + +=end original + +$value 引数にはスカラやスカラのリストへのリファレンスを指定することが +出来ます。 + + $header->push_header(Accept => 'image/jpeg'); + $header->push_header(Accept => [map "image/$_", qw(gif png tiff)]); + +=item $h->init_header( $field => $value ) + +=begin original + +Set the specified header to the given value, but only if no previous +value for that field is set. + +=end original + +Set the specified header to the given value, but only if no previous +value for that field is set. +(TBT) + +=begin original + +The header field name ($field) is not case sensitive and '_' +can be used as a replacement for '-'. + +=end original + +The header field name ($field) is not case sensitive and '_' +can be used as a replacement for '-'. +(TBT) + +=begin original + +The $value argument may be a scalar or a reference to a list of +scalars. + +=end original + +The $value argument may be a scalar or a reference to a list of +scalars. +(TBT) + +=item $h->remove_header( $field, ... ) + +=begin original + +This function removes the header fields with the specified names. + +=end original + +この関数は指定された名前を持つヘッダフィールドを削除します。 + +=begin original + +The header field names ($field) are not case sensitive and '_' +can be used as a replacement for '-'. + +=end original + +The header field names ($field) are not case sensitive and '_' +can be used as a replacement for '-'. +(TBT) + +=begin original + +The return value is the values of the fields removed. In scalar +context the number of fields removed is returned. + +=end original + +The return value is the values of the fields removed. In scalar +context the number of fields removed is returned. +(TBT) + +=begin original + +Note that if you pass in multiple field names then it is generally not +possible to tell which of the returned values belonged to which field. + +=end original + +Note that if you pass in multiple field names then it is generally not +possible to tell which of the returned values belonged to which field. +(TBT) + +=item $h->remove_content_headers + +=begin original + +This will remove all the header fields used to describe the content of +a message. All header field names prefixed with C<Content-> falls +into this category, as well as C<Allow>, C<Expires> and +C<Last-Modified>. RFC 2616 denote these fields as I<Entity Header +Fields>. + +=end original + +This will remove all the header fields used to describe the content of +a message. All header field names prefixed with C<Content-> falls +into this category, as well as C<Allow>, C<Expires> and +C<Last-Modified>. RFC 2616 denote these fields as I<Entity Header +Fields>. +(TBT) + +=begin original + +The return value is a new C<HTTP::Headers> object that contains the +removed headers only. + +=end original + +The return value is a new C<HTTP::Headers> object that contains the +removed headers only. +(TBT) + +=item $h->clear + +=begin original + +This will remove all header fields. + +=end original + +This will remove all header fields. +(TBT) + +=item $h->header_field_names + +=begin original + +Returns the list of distinct names for the fields present in the +header. The field names have case as suggested by HTTP spec, and the +names are returned in the recommended "Good Practice" order. + +=end original + +Returns the list of distinct names for the fields present in the +header. The field names have case as suggested by HTTP spec, and the +names are returned in the recommended "Good Practice" order. +(TBT) + +=begin original + +In scalar context return the number of distinct field names. + +=end original + +In scalar context return the number of distinct field names. +(TBT) + +=item $h->scan( \&process_header_field ) + +=begin original + +Apply a subroutine to each header field in turn. The callback routine +is called with two parameters; the name of the field and a single +value (a string). If a header field is multi-valued, then the +routine is called once for each value. The field name passed to the +callback routine has case as suggested by HTTP spec, and the headers +will be visited in the recommended "Good Practice" order. + +=end original + +各ヘッダフィールドそれぞれにサブルーチンを適用します。 +コールバックルーチンは 2 引数で呼び出されます:フィールド名と +1 つの値(文字列)です。 +ヘッダフィールドが複数の値を持っていれば、ルーチンはそれぞれの値につき +1 回呼ばれます。 +コールバックルーチンに渡されるフィールド名は +HTTP 仕様で提案されている大文字/小文字をもち、推奨されている +"Good Practice" の順でやってきます。 + +=begin original + +Any return values of the callback routine are ignored. The loop can +be broken by raising an exception (C<die>), but the caller of scan() +would have to trap the exception itself. + +=end original + +Any return values of the callback routine are ignored. The loop can +be broken by raising an exception (C<die>), but the caller of scan() +would have to trap the exception itself. +(TBT) + +=item $h->as_string + +=item $h->as_string( $eol ) + +=begin original + +Return the header fields as a formatted MIME header. Since it +internally uses the C<scan> method to build the string, the result +will use case as suggested by HTTP spec, and it will follow +recommended "Good Practice" of ordering the header fields. Long header +values are not folded. + +=end original + +フォーマットされた MIME ヘッダとしてヘッダフィールドを返します。 +文字列を組み立てるために内部で C<scan> メソッドを使っているので、結果は +HTTP 仕様で提案されている大文字小文字で、ヘッダ・フィールドの順序の +推奨されている "Good Practice" に従います。 +長いヘッダの値はたたまれません。 + +=begin original + +The optional $eol parameter specifies the line ending sequence to +use. The default is "\n". Embedded "\n" characters in header field +values will be substituted with this line ending sequence. + +=end original + +オプションの $eol パラメータは使用する行末シーケンスを指定します。 +デフォルトは "\n" です。 +ヘッダフィールドの値に埋め込まれた "\n" 文字は、この行末シーケンスで +置きかえられます。 + +=back + +=head1 CONVENIENCE METHODS + +=begin original + +The most frequently used headers can also be accessed through the +following convenience Methods. These methods can both be used to read +and to set the value of a header. The header value is set if you pass +an argument to the method. The old header value is always returned. +If the given header did not exist then C<undef> is returned. + +=end original + +よく利用されるヘッダは以下の便宜メソッドを通してもアクセスすることが出来ます。 +これらのメソッドはヘッダの値を読むこと設定することの両方に使うことできます。 +メソッドに引数を渡せばヘッダの値が設定されます。 +ヘッダの古い値は常に返されます。 +If the given header did not exist then C<undef> is returned. +(TBT) + +=begin original + +Methods that deal with dates/times always convert their value to system +time (seconds since Jan 1, 1970) and they also expect this kind of +value when the header value is set. + +=end original + +日付/時刻を扱うメソッドは常にその値をシステム時刻(1970 年 1 月 1 日からの +秒数)に変換し、ヘッダの値が設定される場合には、値がそうした種類であることを +期待します。 + +=over 4 + +=item $h->date + +=begin original + +This header represents the date and time at which the message was +originated. I<E.g.>: + +=end original + +このヘッダはメッセージが発行された日付と時刻を表します。 +I<例えば>: + + $h->date(time); # set current date + +=item $h->expires + +=begin original + +This header gives the date and time after which the entity should be +considered stale. + +=end original + +このヘッダは、それ以降はそのエントリが新鮮でない(stale)であると考えられる +日付と時刻を示します。 + +=item $h->if_modified_since + +=item $h->if_unmodified_since + +=begin original + +These header fields are used to make a request conditional. If the requested +resource has (or has not) been modified since the time specified in this field, +then the server will return a C<304 Not Modified> response instead of +the document itself. + +=end original + +これらヘッダフィールドはリクエストを条件付きにします。 +もしリクエストされたリソースがこのフィールドで指定された時刻から変更された +(あるいは変更されていない)なら、、サーバはドキュメント自身の代りに +C<304 Not Modified> レスポンスを返します。 + +=item $h->last_modified + +=begin original + +This header indicates the date and time at which the resource was last +modified. I<E.g.>: + +=end original + +このヘッダはそのリソースが最後に変更された日付と時刻を返します。 +I<例えば>: + + # check if document is more than 1 hour old + if (my $last_mod = $h->last_modified) { + if ($last_mod < time - 60*60) { + ... + } + } + +=item $h->content_type + +=begin original + +The Content-Type header field indicates the media type of the message +content. I<E.g.>: + +=end original + +Content-Type ヘッダフィールドはメッセージ内容のメディアタイプを示します。 +I<例えば>: + + $h->content_type('text/html'); + +=begin original + +The value returned will be converted to lower case, and potential +parameters will be chopped off and returned as a separate value if in +an array context. If there is no such header field, then the empty +string is returned. This makes it safe to do the following: + +=end original + +返される値は小文字に変換され、潜在的なパラメータが切り落とされ、 +配列コンテキストであれば、分けられた値として返されます。 +If there is no such header field, then the empty +string is returned. +これは以下のようにすることを安全にします: +(TBT) + + if ($h->content_type eq 'text/html') { + # we enter this place even if the real header value happens to + # be 'TEXT/HTML; version=3.0' + ... + } + +=item $h->content_encoding + +=begin original + +The Content-Encoding header field is used as a modifier to the +media type. When present, its value indicates what additional +encoding mechanism has been applied to the resource. + +=end original + +Content-Encoding ヘッダフィールドはメディアタイプの修飾子として +使われます。 +もしあれば、その値はどんな追加のエンコーディング機能がそのリソースに +適用されたのかを示します。 + +=item $h->content_length + +=begin original + +A decimal number indicating the size in bytes of the message content. + +=end original + +メッセージ内容の大きさをバイト数で示す 10 進数。 + +=item $h->content_language + +=begin original + +The natural language(s) of the intended audience for the message +content. The value is one or more language tags as defined by RFC +1766. Eg. "no" for some kind of Norwegian and "en-US" for English the +way it is written in the US. + +=end original + +メッセージ内容が対象としている聞き手の自然言語。 +この値は RFC1766 で定義されている 1 つまたは複数の言語タグです。 +例えば "no" は何らかのノルウェー語、"en-US" は +アメリカで使われている英語です。 + +=item $h->title + +=begin original + +The title of the document. In libwww-perl this header will be +initialized automatically from the E<lt>TITLE>...E<lt>/TITLE> element +of HTML documents. I<This header is no longer part of the HTTP +standard.> + +=end original + +ドキュメントのタイトル。 +libwww-perl では、このヘッダは自動的に HTML ドキュメントの +E<lt>TITLE>...E<lt>/TITLE> 要素から初期化されます。 +I<このヘッダはもはや HTTP 標準の一部ではありません。> + +=item $h->user_agent + +=begin original + +This header field is used in request messages and contains information +about the user agent originating the request. I<E.g.>: + +=end original + +このヘッダはリクエストメッセージで使われ、そのリクエストを発行した +ユーザエージェントについての情報が入っています。 +I<例えば>: + + $h->user_agent('Mozilla/1.2'); + +=item $h->server + +=begin original + +The server header field contains information about the software being +used by the originating server program handling the request. + +=end original + +server ヘッダフィールドには、そのリクエストを取り扱う +サーバプログラムによって使われたソフトウェアについての情報が入っています。 + +=item $h->from + +=begin original + +This header should contain an Internet e-mail address for the human +user who controls the requesting user agent. The address should be +machine-usable, as defined by RFC822. E.g.: + +=end original + +このヘッダにはリクエストしているユーザエージェントを制御している人のための +インターネット e-mail アドレスが入っていなければなりません。 +そのアドレスは、RFC822 によって定義されているように、機械で +使えなければなりません。 +I<例えば>: + + $h->from('King Kong <king****@kong*****>'); + +=begin original + +I<This header is no longer part of the HTTP standard.> + +=end original + +I<このヘッダはもはや HTTP 標準の一部ではありません。> + +=item $h->referer + +=begin original + +Used to specify the address (URI) of the document from which the +requested resource address was obtained. + +=end original + +そこからリクエストされたリソースアドレスが取得された、ドキュメントの +アドレス (URI) を指定するために使われます。 + +=begin original + +The "Free On-line Dictionary of Computing" as this to say about the +word I<referer>: + +=end original + +The "Free On-line Dictionary of Computing" as this to say about the +word I<referer>: +(TBT) + + <World-Wide Web> A misspelling of "referrer" which + somehow made it into the {HTTP} standard. A given {web + page}'s referer (sic) is the {URL} of whatever web page + contains the link that the user followed to the current + page. Most browsers pass this information as part of a + request. + + (1998-10-19) + +=begin original + +By popular demand C<referrer> exists as an alias for this method so you +can avoid this misspelling in your programs and still send the right +thing on the wire. + +=end original + +By popular demand C<referrer> exists as an alias for this method so you +can avoid this misspelling in your programs and still send the right +thing on the wire. +(TBT) + +=begin original + +When setting the referrer, this method removes the fragment from the +given URI if it is present, as mandated by RFC2616. Note that +the removal does I<not> happen automatically if using the header(), +push_header() or init_header() methods to set the referrer. + +=end original + +When setting the referrer, this method removes the fragment from the +given URI if it is present, as mandated by RFC2616. Note that +the removal does I<not> happen automatically if using the header(), +push_header() or init_header() methods to set the referrer. +(TBT) + +=item $h->www_authenticate + +=begin original + +This header must be included as part of a C<401 Unauthorized> response. +The field value consist of a challenge that indicates the +authentication scheme and parameters applicable to the requested URI. + +=end original + +このヘッダは C<401 Unauthorized> レスポンスの一部として +入らなければなりません。 +フィールドの値は、リクエストされた URI へ適用できる +認証スキームとパラメータを示すチャレンジにより構成されます。 + +=item $h->proxy_authenticate + +=begin original + +This header must be included in a C<407 Proxy Authentication Required> +response. + +=end original + +このヘッダは C<407 Proxy Authentication Required> レスポンスに +入らなければなりません。 + +=item $h->authorization + +=item $h->proxy_authorization + +=begin original + +A user agent that wishes to authenticate itself with a server or a +proxy, may do so by including these headers. + +=end original + +サーバまたはプロキシでそれ自身を認証して欲しいユーザエージェントは、 +これらのヘッダを入れることによりそうなるかもしれません。 + +=item $h->authorization_basic + +=begin original + +This method is used to get or set an authorization header that use the +"Basic Authentication Scheme". In array context it will return two +values; the user name and the password. In scalar context it will +return I<"uname:password"> as a single string value. + +=end original + +このヘッダは「基本認証機能」を使う認証ヘッダを取得および設定するために +使われます。 +配列コンテキストでは 2 つの値を返します; ユーザ名とパスワードです。 +スカラコンテキストでは 1 つの文字列として I<"uname:password"> を返します。 + +=begin original + +When used to set the header value, it expects two arguments. I<E.g.>: + +=end original + +ヘッダの値を設定するために使われるときは、2つの引数が期待されます。 +I<例えば>: + + $h->authorization_basic($uname, $password); + +=begin original + +The method will croak if the $uname contains a colon ':'. + +=end original + +もし $uname にコロン ':' が入っていれば croak します。 + +=item $h->proxy_authorization_basic + +=begin original + +Same as authorization_basic() but will set the "Proxy-Authorization" +header instead. + +=end original + +authorization_basic() と同様ですが、 +しかし代わりに "Proxy-Authorization" ヘッダを設定します。 + +=back + +=head1 NON-CANONICALIZED FIELD NAMES + +=begin original + +The header field name spelling is normally canonicalized including the +'_' to '-' translation. There are some application where this is not +appropriate. Prefixing field names with ':' allow you to force a +specific spelling. For example if you really want a header field name +to show up as C<foo_bar> instead of "Foo-Bar", you might set it like +this: + +=end original + +The header field name spelling is normally canonicalized including the +'_' to '-' translation. There are some application where this is not +appropriate. Prefixing field names with ':' allow you to force a +specific spelling. For example if you really want a header field name +to show up as C<foo_bar> instead of "Foo-Bar", you might set it like +this: +(TBT) + + $h->header(":foo_bar" => 1); + +=begin original + +These field names are returned with the ':' intact for +$h->header_field_names and the $h->scan callback, but the colons do +not show in $h->as_string. + +=end original + +These field names are returned with the ':' intact for +$h->header_field_names and the $h->scan callback, but the colons do +not show in $h->as_string. +(TBT) + +=head1 COPYRIGHT + +Copyright 1995-2005 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 + Index: docs/modules/libwww-perl-5.813/HTTP/Request.pod diff -u /dev/null docs/modules/libwww-perl-5.813/HTTP/Request.pod:1.1 --- /dev/null Sat Apr 18 21:13:21 2009 +++ docs/modules/libwww-perl-5.813/HTTP/Request.pod Sat Apr 18 21:13:21 2009 @@ -0,0 +1,212 @@ + +=encoding euc-jp + +=head1 NAME + +=begin original + +HTTP::Request - HTTP style request message + +=end original + +HTTP::Request - HTTP 形式のリクエストメッセージ + +=head1 SYNOPSIS + + require HTTP::Request; + $request = HTTP::Request->new(GET => 'http://www.example.com/'); + +=begin original + +and usually used like this: + +=end original + +そして通常は以下のようにして使います: + + $ua = LWP::UserAgent->new; + $response = $ua->request($request); + +=head1 DESCRIPTION + +=begin original + +C<HTTP::Request> is a class encapsulating HTTP style requests, +consisting of a request line, some headers, and a content body. Note +that the LWP library uses HTTP style requests even for non-HTTP +protocols. Instances of this class are usually passed to the +request() method of an C<LWP::UserAgent> object. + +=end original + +C<HTTP::Request> クラスは HTTP 形式のリクエストをカプセル化します。 +レスポンスはリクエスト行、いくつかのヘッダ、そして内容の本体(content body)で +構成されます。 +LWP ライブラリは HTTP プロトコルでないスキームにも、HTTP 形式のリクエストを +使っていることに注意してください。 +Instances of this class are usually passed to the +request() method of an C<LWP::UserAgent> object. +(TBT) + +=begin original + +C<HTTP::Request> is a subclass of C<HTTP::Message> and therefore +inherits its methods. The following additional methods are available: + +=end original + +C<HTTP::Request> は C<HTTP::Message> のサブクラスなので、そのメソッドを +継承しています。 +以下の追加のメソッドが利用できます: + +=over 4 + +=item $r = HTTP::Request->new( $method, $uri ) + +=item $r = HTTP::Request->new( $method, $uri, $header ) + +=item $r = HTTP::Request->new( $method, $uri, $header, $content ) + +=begin original + +Constructs a new C<HTTP::Request> object describing a request on the +object $uri using method $method. The $method argument must be a +string. The $uri argument can be either a string, or a reference to a +C<URI> object. The optional $header argument should be a reference to +an C<HTTP::Headers> object or a plain array reference of key/value +pairs. The optional $content argument should be a string of bytes. + +=end original + +オブジェクト $uri へメソッド $method を使ったリクエストについて記述する +C<HTTP::Request> オブジェクトを組みたてます。 +$method 引数は文字列でなければなりません。 +$uri 引数は文字列か C<URI> オブジェクトへのリファレンスが指定できます。 +オプションの $header 引数は C<HTTP::Headers> オブジェクトへの +リファレンスか、キー/値のペアの配列へのリファレンスでなければなりません。 +オプションの $content 引数はバイト列の文字列です。 + +=item $r = HTTP::Request->parse( $str ) + +=begin original + +This constructs a new request object by parsing the given string. + +=end original + +This constructs a new request object by parsing the given string. +(TBT) + +=item $r->method + +=item $r->method( $val ) + +=begin original + +This is used to get/set the method attribute. The method should be a +short string like "GET", "HEAD", "PUT" or "POST". + +=end original + +This is used to get/set the method attribute. The method should be a +short string like "GET", "HEAD", "PUT" or "POST". +(TBT) + +=item $r->uri + +=item $r->uri( $val ) + +=begin original + +This is used to get/set the uri attribute. The $val can be a +reference to a URI object or a plain string. If a string is given, +then it should be parseable as an absolute URI. + +=end original + +これは uri 属性を取得/設定するために使います。 +$val は URI オブジェクトか普通の文字列のどちらかです。 +文字列が与えられた場合、絶対 URI として解析できるものでなければなりません。 + +=item $r->header( $field ) + +=item $r->header( $field => $value ) + +=begin original + +This is used to get/set header values and it is inherited from +C<HTTP::Headers> via C<HTTP::Message>. See L<HTTP::Headers> for +details and other similar methods that can be used to access the +headers. + +=end original + +This is used to get/set header values and it is inherited from +C<HTTP::Headers> via C<HTTP::Message>. See L<HTTP::Headers> for +details and other similar methods that can be used to access the +headers. +(TBT) + +=item $r->content + +=item $r->content( $bytes ) + +=begin original + +This is used to get/set the content and it is inherited from the +C<HTTP::Message> base class. See L<HTTP::Message> for details and +other methods that can be used to access the content. + +=end original + +This is used to get/set the content and it is inherited from the +C<HTTP::Message> base class. See L<HTTP::Message> for details and +other methods that can be used to access the content. +(TBT) + +=begin original + +Note that the content should be a string of bytes. Strings in perl +can contain characters outside the range of a byte. The C<Encode> +module can be used to turn such strings into a string of bytes. + +=end original + +Note that the content should be a string of bytes. Strings in perl +can contain characters outside the range of a byte. The C<Encode> +module can be used to turn such strings into a string of bytes. +(TBT) + +=item $r->as_string + +=item $r->as_string( $eol ) + +=begin original + +Method returning a textual representation of the request. + +=end original + +リクエストのテキスト形式表現を返します。 + +=back + +=head1 SEE ALSO + +L<HTTP::Headers>, L<HTTP::Message>, L<HTTP::Request::Common>, +L<HTTP::Response> + +=head1 COPYRIGHT + +Copyright 1995-2004 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 + Index: docs/modules/libwww-perl-5.813/HTTP/Response.pod diff -u /dev/null docs/modules/libwww-perl-5.813/HTTP/Response.pod:1.1 --- /dev/null Sat Apr 18 21:13:21 2009 +++ docs/modules/libwww-perl-5.813/HTTP/Response.pod Sat Apr 18 21:13:21 2009 @@ -0,0 +1,566 @@ + +=encoding euc-jp + +=head1 NAME + +=begin original + +HTTP::Response - HTTP style response message + +=end original + +HTTP::Response - HTTP 形式のレスポンスメッセージ + +=head1 SYNOPSIS + +=begin original + +Response objects are returned by the request() method of the C<LWP::UserAgent>: + +=end original + +Response objects are returned by the request() method of the C<LWP::UserAgent>: +(TBT) + + # ... + $response = $ua->request($request) + if ($response->is_success) { + print $response->content; + } + else { + print STDERR $response->status_line, "\n"; + } + +=head1 DESCRIPTION + +=begin original + +The C<HTTP::Response> class encapsulates HTTP style responses. A +response consists of a response line, some headers, and a content +body. Note that the LWP library uses HTTP style responses even for +non-HTTP protocol schemes. Instances of this class are usually +created and returned by the request() method of an C<LWP::UserAgent> +object. + +=end original + +C<HTTP::Response> クラスは HTTP 形式のレスポンスをカプセル化します。 +レスポンスはレスポンス行、いくつかのヘッダ、そして内容の本体(content body)で +構成されます。 +LWP ライブラリは HTTP プロトコルでないスキームにも、HTTP 形式のレスポンスを +使っていることに注意してください。 +Instances of this class are usually +created and returned by the request() method of an C<LWP::UserAgent> +object. +(TBT) + +=begin original + +C<HTTP::Response> is a subclass of C<HTTP::Message> and therefore +inherits its methods. The following additional methods are available: + +=end original + +C<HTTP::Response> は C<HTTP::Message> のサブクラスなので、そのメソッドを +継承しています。 +以下の追加のメソッドが利用できます: + +=over 4 + +=item $r = HTTP::Response->new( $code ) + +=item $r = HTTP::Response->new( $code, $msg ) + +=item $r = HTTP::Response->new( $code, $msg, $header ) + +=item $r = HTTP::Response->new( $code, $msg, $header, $content ) + +=begin original + +Constructs a new C<HTTP::Response> object describing a response with +response code $code and optional message $msg. The optional $header +argument should be a reference to an C<HTTP::Headers> object or a +plain array reference of key/value pairs. The optional $content +argument should be a string of bytes. The meaning these arguments are +described below. + +=end original + +応答コード $code で、オプションのメッセージ $msg を記述する、新しい +C<HTTP::Response> オブジェクトを組みたてます。 +The optional $header +argument should be a reference to an C<HTTP::Headers> object or a +plain array reference of key/value pairs. The optional $content +argument should be a string of bytes. The meaning these arguments are +described below. +(TBT) + +=item $r = HTTP::Response->parse( $str ) + +=begin original + +This constructs a new response object by parsing the given string. + +=end original + +This constructs a new response object by parsing the given string. +(TBT) + +=item $r->code + +=item $r->code( $code ) + +=begin original + +This is used to get/set the code attribute. The code is a 3 digit +number that encode the overall outcome of a HTTP response. The +C<HTTP::Status> module provide constants that provide mnemonic names +for the code attribute. + +=end original + +This is used to get/set the code attribute. The code is a 3 digit +number that encode the overall outcome of a HTTP response. The +C<HTTP::Status> module provide constants that provide mnemonic names +for the code attribute. +(TBT) + +=item $r->message + +=item $r->message( $message ) + +=begin original + +This is used to get/set the message attribute. The message is a short +human readable single line string that explains the response code. + +=end original + +This is used to get/set the message attribute. +メッセージは短く、人が読める、応答コードを説明する 1 行の文字列です。 +(TBT) + +=item $r->header( $field ) + +=item $r->header( $field => $value ) + +=begin original + +This is used to get/set header values and it is inherited from +C<HTTP::Headers> via C<HTTP::Message>. See L<HTTP::Headers> for +details and other similar methods that can be used to access the +headers. + +=end original + +This is used to get/set header values and it is inherited from +C<HTTP::Headers> via C<HTTP::Message>. See L<HTTP::Headers> for +details and other similar methods that can be used to access the +headers. +(TBT) + +=item $r->content + +=item $r->content( $bytes ) + +=begin original + +This is used to get/set the raw content and it is inherited from the +C<HTTP::Message> base class. See L<HTTP::Message> for details and +other methods that can be used to access the content. + +=end original + +This is used to get/set the raw content and it is inherited from the +C<HTTP::Message> base class. See L<HTTP::Message> for details and +other methods that can be used to access the content. +(TBT) + +=item $r->decoded_content( %options ) + +=begin original + +This will return the content after any C<Content-Encoding> and +charsets have been decoded. See L<HTTP::Message> for details. + +=end original + +This will return the content after any C<Content-Encoding> and +charsets have been decoded. See L<HTTP::Message> for details. +(TBT) + +=item $r->request + +=item $r->request( $request ) + +=begin original + +This is used to get/set the request attribute. The request attribute +is a reference to the the request that caused this response. It does +not have to be the same request passed to the $ua->request() method, +because there might have been redirects and authorization retries in +between. + +=end original + +これは request 属性を取得/設定するために使われます。 +request 属性はこのレスポンスを発生したリクエストへのリファレンスです。 +これは $ua->request() メソッドに渡されたものと同じ +リクエストである必要はありません。 +というのもその間にリダイレクトや認証のリトライがあったかもしれないからです。 + +=item $r->previous + +=item $r->previous( $response ) + +=begin original + +This is used to get/set the previous attribute. The previous +attribute is used to link together chains of responses. You get +chains of responses if the first response is redirect or unauthorized. +The value is C<undef> if this is the first response in a chain. + +=end original + +これは previous 属性を取得/設定するために使われます。 +previous 属性はレスポンスのチェーンをたどるために使われます。 +最初のレスポンスがリダイレトクトまたは認証されていなければ、 +レスポンスのチェーンを取得します。 +The value is C<undef> if this is the first response in a chain. +(TBT) + +=item $r->status_line + +=begin original + +Returns the string "E<lt>code> E<lt>message>". If the message attribute +is not set then the official name of E<lt>code> (see L<HTTP::Status>) +is substituted. + +=end original + +文字列 "E<lt>code> E<lt>message>" を返します。 +もし message 属性が設定されていなければ、E<lt>code>の公式の名前 +(L<HTTP::Status> を参照してください)に置き換えられます。 + +=item $r->base + +=begin original + +Returns the base URI for this response. The return value will be a +reference to a URI object. + +=end original + +このレスポンスの基本 URI を返します。 +戻り値は URI オブジェクトへのリファレンスになります。 + +=begin original + +The base URI is obtained from one the following sources (in priority +order): + +=end original + +基本 URI は以下のいずれかの情報源から(この優先順で)取得されます: + +=over 4 + +=item 1. + +=begin original + +Embedded in the document content, for instance <BASE HREF="..."> +in HTML documents. + +=end original + +ドキュメント内容に埋め込まれたもの; 例えば HTML ドキュメント内での +<BASE HREF="...">。 + +=item 2. + +=begin original + +A "Content-Base:" or a "Content-Location:" header in the response. + +=end original + +レスポンスでの "Content-Base:" または "Content-Locatin:" ヘッダ。 + +=begin original + +For backwards compatibility with older HTTP implementations we will +also look for the "Base:" header. + +=end original + +古い HTTP 実装との後方互換性のため、"Base:" ヘッダも探します。 + +=item 3. + +=begin original + +The URI used to request this response. This might not be the original +URI that was passed to $ua->request() method, because we might have +received some redirect responses first. + +=end original + +このレスポンスを要求した URI。 +これは $ua->request() メソッドに渡された、元の URI でないかもしれません。 +というのもレスポンスの前に、いくつかのリダイレクトを +受信しているかもしれないからです。 + +=back + +=begin original + +If none of these sources provide an absolute URI, undef is returned. + +=end original + +If none of these sources provide an absolute URI, undef is returned. +(TBT) + +=begin original + +When the LWP protocol modules produce the HTTP::Response object, then +any base URI embedded in the document (step 1) will already have +initialized the "Content-Base:" header. This means that this method +only performs the last 2 steps (the content is not always available +either). + +=end original + +LWP プロトコルモジュールが HTTP::Response オブジェクトを作成すると、 +ドキュメントに埋め込まれたなんらかの基 本URI(step 1)が、 +"Content-Base:" ヘッダを初期化しているでしょう。 +つまりこのメソッドは残り 2 つのステップだけを行います +(どちらも内容は常に使えるわけではありません)。 + +=item $r->filename + +=begin original + +Returns a filename for this response. Note that doing sanity checks +on the returned filename (eg. removing characters that cannot be used +on the target filesystem where the filename would be used, and +laundering it for security purposes) are the caller's responsibility; +the only related thing done by this method is that it makes a simple +attempt to return a plain filename with no preceding path segments. + +=end original + +Returns a filename for this response. Note that doing sanity checks +on the returned filename (eg. removing characters that cannot be used +on the target filesystem where the filename would be used, and +laundering it for security purposes) are the caller's responsibility; +the only related thing done by this method is that it makes a simple +attempt to return a plain filename with no preceding path segments. +(TBT) + +=begin original + +The filename is obtained from one the following sources (in priority +order): + +=end original + +The filename is obtained from one the following sources (in priority +order): +(TBT) + +=over 4 + +=item 1. + +=begin original + +A "Content-Disposition:" header in the response. Proper decoding of +RFC 2047 encoded filenames requires the C<MIME::QuotedPrint> (for "Q" +encoding), C<MIME::Base64> (for "B" encoding), and C<Encode> modules. + +=end original + +A "Content-Disposition:" header in the response. Proper decoding of +RFC 2047 encoded filenames requires the C<MIME::QuotedPrint> (for "Q" +encoding), C<MIME::Base64> (for "B" encoding), and C<Encode> modules. +(TBT) + +=item 2. + +=begin original + +A "Content-Location:" header in the response. + +=end original + +A "Content-Location:" header in the response. +(TBT) + +=item 3. + +=begin original + +The URI used to request this response. This might not be the original +URI that was passed to $ua->request() method, because we might have +received some redirect responses first. + +=end original + +The URI used to request this response. This might not be the original +URI that was passed to $ua->request() method, because we might have +received some redirect responses first. +(TBT) + +=back + +=begin original + +If a filename cannot be derived from any of these sources, undef is +returned. + +=end original + +If a filename cannot be derived from any of these sources, undef is +returned. +(TBT) + +=item $r->as_string + +=item $r->as_string( $eol ) + +=begin original + +Returns a textual representation of the response. + +=end original + +レスポンスのテキストによる表現を返します。 + +=item $r->is_info + +=item $r->is_success + +=item $r->is_redirect + +=item $r->is_error + +=begin original + +These methods indicate if the response was informational, successful, a +redirection, or an error. See L<HTTP::Status> for the meaning of these. + +=end original + +これらのメソッドはレスポンスが情報的(informational)であるか、 +成功したか、リダイレクトであるか、エラーであるかを示します。 +See L<HTTP::Status> for the meaning of these. +(TBT) + +=item $r->error_as_HTML + +=begin original + +Returns a string containing a complete HTML document indicating what +error occurred. This method should only be called when $r->is_error +is TRUE. + +=end original + +何のエラーが発生したかを示す完全なHTMLドキュメントが入っている +文字列を返します。 +このメソッドは $r->is_error が TRUE のときだけ呼ばれるべきです。 + +=item $r->current_age + +=begin original + +Calculates the "current age" of the response as specified by RFC 2616 +section 13.2.3. The age of a response is the time since it was sent +by the origin server. The returned value is a number representing the +age in seconds. + +=end original + +RFC 2616 section 13.2.3 によって指定されたレスポンスの +「現在の年齢」("current age")を計算します。 +レスポンスの年齢は元のサーバによって送信されてからの時間です。 +返される値は、年齢を秒で表した数字です。 + +=item $r->freshness_lifetime + +=begin original + +Calculates the "freshness lifetime" of the response as specified by +RFC 2616 section 13.2.4. The "freshness lifetime" is the length of +time between the generation of a response and its expiration time. +The returned value is a number representing the freshness lifetime in +seconds. + +=end original + +RFC 2616 section 13.2.4 で指定された、そのレスポンスの「新鮮保持期間」 +("freshness lifetime")を計算します。 +「新鮮保持期間」はレスポンスが生成されてから破棄されるまでの時間の長さです。 +返される値は秒で新鮮保持期間を表した数字です。 + +=begin original + +If the response does not contain an "Expires" or a "Cache-Control" +header, then this function will apply some simple heuristic based on +'Last-Modified' to determine a suitable lifetime. + +=end original + +もし "Expires" または"Cache-Control" ヘッダがレスポンスに入っていなければ、 +適切な期間を決めるため、この関数は 'Last-Modified' をベースに単純な自分で +発見する方法を適用します。 + +=item $r->is_fresh + +=begin original + +Returns TRUE if the response is fresh, based on the values of +freshness_lifetime() and current_age(). If the response is no longer +fresh, then it has to be refetched or revalidated by the origin +server. + +=end original + +freshness_lifetime() と current_age() の値をベースに、レスポンスが +新鮮であれば TRUE を返します。 +レスポンスがもはや新鮮でなければ、もう一度取り出されるか、 +元のサーバによって再評価されるべきです。 + +=item $r->fresh_until + +=begin original + +Returns the time when this entity is no longer fresh. + +=end original + +このエンティティがもはや新鮮ではなくなる刻を返します。 + +=back + +=head1 SEE ALSO + +L<HTTP::Headers>, L<HTTP::Message>, L<HTTP::Status>, L<HTTP::Request> + +=head1 COPYRIGHT + +Copyright 1995-2004 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 +