libwww-perl-5.813 > 6.04 との差分

LWP::UserAgent 6.04 と 5.813 の差分

11
22=encoding euc-jp
33
44=head1 NAME
55
66=begin original
77
88LWP::UserAgent - Web user agent class
99
1010=end original
1111
1212LWP::UserAgent - Web ユーザエージェントクラス
1313
1414=head1 SYNOPSIS
1515
1616 require LWP::UserAgent;
1717
1818 my $ua = LWP::UserAgent->new;
1919 $ua->timeout(10);
2020 $ua->env_proxy;
2121
2222 my $response = $ua->get('http://search.cpan.org/');
2323
2424 if ($response->is_success) {
25 print $response->decoded_content; # or whatever
25 print $response->content; # or whatever
2626 }
2727 else {
2828 die $response->status_line;
2929 }
3030
3131=head1 DESCRIPTION
3232
3333=begin original
3434
3535The C<LWP::UserAgent> is a class implementing a web user agent.
3636C<LWP::UserAgent> objects can be used to dispatch web requests.
3737
3838=end original
3939
4040C<LWP::UserAgent> は web ユーザエージェントを実装するクラスです。
4141C<LWP::UserAgent> オブジェクトは web リクエストを発行(dispatch)するために
4242使えます。
4343
4444=begin original
4545
4646In normal use the application creates an C<LWP::UserAgent> object, and
4747then configures it with values for timeouts, proxies, name, etc. It
4848then creates an instance of C<HTTP::Request> for the request that
4949needs to be performed. This request is then passed to one of the
5050request method the UserAgent, which dispatches it using the relevant
5151protocol, and returns a C<HTTP::Response> object. There are
5252convenience methods for sending the most common request types: get(),
53head(), post(), put() and delete(). When using these methods then the
53head() and post(). When using these methods then the creation of the
54creation of the request object is hidden as shown in the synopsis above.
54request object is hidden as shown in the synopsis above.
5555
5656=end original
5757
5858通常の使用では、アプリケーションは C<LWP::UserAgent> クラスを作成し、
5959タイムアウト、プロキシ、名前などのための値でそれを設定します。
6060それから実行される必要があるリクエストのために C<HTTP::Request> の
6161インスタンスを作成します。
6262そしてこのリクエストは UserAgent のリクエストメソッドの一つに渡されます;
6363これは対応するプロトコルを使ってそれを発行し、
6464C<HTTP::Response> オブジェクトを返します。
65もっとも一般的なリクエスト型のための便利メソッド get(), head(), post(),
65もっとも一般的なリクエスト型のための便利メソッド get(), head(), post()
66put(), delete() があります。
66があります。
6767これらのメソッドを使うときは、上述の用例の通り、
6868リクエストオブジェクトの作成は隠蔽されます。
6969
7070=begin original
7171
7272The basic approach of the library is to use HTTP style communication
7373for all protocol schemes. This means that you will construct
7474C<HTTP::Request> objects and receive C<HTTP::Response> objects even
7575for non-HTTP resources like I<gopher> and I<ftp>. In order to achieve
7676even more similarity to HTTP style communications, gopher menus and
7777file directories are converted to HTML documents.
7878
7979=end original
8080
8181このライブラリの基本的なアプローチは、HTTP 式通信をすべての
8282プロトコルスキームに使うことです。
8383つまり I<gopher> や I<ftp> のような非 HTTP リソースでも
8484C<HTTP::Request> オブジェクトを構築して
8585C<HTTP::Response> オブジェクトを受け取るということです。
8686より HTTP 式通信に似せるため、gopher メニューとファイルディレクトリは
8787HTML ドキュメントに変換されます。
8888
8989=head1 CONSTRUCTOR METHODS
9090
9191(コンストラクタメソッド)
9292
9393=begin original
9494
9595The following constructor methods are available:
9696
9797=end original
9898
9999以下のコンストラクタメソッドが利用可能です:
100100
101101=over 4
102102
103103=item $ua = LWP::UserAgent->new( %options )
104104
105105=begin original
106106
107107This method constructs a new C<LWP::UserAgent> object and returns it.
108108Key/value pair arguments may be provided to set up the initial state.
109109The following options correspond to attribute methods described below:
110110
111111=end original
112112
113113このメソッドは新しい C<LWP::UserAgent> オブジェクトを構成して、それを
114114返します。
115115初期状態を設定するためにキー-値のペアの引数を指定できます。
116116以下のオプションは後述する属性メソッドに対応します:
117117
118118 KEY DEFAULT
119119 ----------- --------------------
120 agent "libwww-perl/#.#<#del>#"
120 agent "libwww-perl/#.##"
121121 from undef
122122 conn_cache undef
123123 cookie_jar undef
124124 default_headers HTTP::Headers->new
125 local_address undef
126 ssl_opts { verify_hostname => 1 }
127125 max_size undef
128126 max_redirect 7
129127 parse_head 1
130128 protocols_allowed undef
131129 protocols_forbidden undef
132130 requests_redirectable ['GET', 'HEAD']
133131 timeout 180
134132
135133=begin original
136134
137The following additional options are also accepted: If the C<env_proxy> option
135The following additional options are also accepted: If the
138is passed in with a TRUE value, then proxy settings are read from environment
136C<env_proxy> option is passed in with a TRUE value, then proxy
139variables (see env_proxy() method below). If C<env_proxy> isn't provided the
137settings are read from environment variables (see env_proxy() method
140C<PERL_LWP_ENV_PROXY> environment variable controls if env_proxy() is called
138below). If the C<keep_alive> option is passed in, then a
141during initalization. If the C<keep_alive> option is passed in, then a
139C<LWP::ConnCache> is set up (see conn_cache() method below). The
142C<LWP::ConnCache> is set up (see conn_cache() method below). The C<keep_alive>
140C<keep_alive> value is passed on as the C<total_capacity> for the
143value is passed on as the C<total_capacity> for the connection cache.
141connection cache.
144142
145143=end original
146144
147145以下の追加のオプションも指定できます:
148146C<env_proxy> オプションが真の値とともに渡されると、プロキシセッティングは
149147環境変数から読み込まれます(後述する env_proxy() メソッドを参照してください)。
150C<env_proxy> が提供されない場合、C<PERL_LWP_ENV_PROXY> 環境変数は、
151初期化中に env_proxy() が呼び出されるかを制御します。
152148C<keep_alive> オプションが渡されると、
153149C<LWP::ConnCache> が設定されます(後述する conn_cache() メソッドを
154150参照してください)。
155151C<keep_alive> の値は接続キャッシュのための C<total_capacity> として
156152渡されます。
157153
158154=item $ua->clone
159155
160156=begin original
161157
162158Returns a copy of the LWP::UserAgent object.
163159
164160=end original
165161
166162LWP::UserAgent オブジェクトのコピーを返します。
167163
168164=back
169165
170166=head1 ATTRIBUTES
171167
172168(属性)
173169
174170=begin original
175171
176172The settings of the configuration attributes modify the behaviour of the
177173C<LWP::UserAgent> when it dispatches requests. Most of these can also
178174be initialized by options passed to the constructor method.
179175
180176=end original
181177
182178設定属性は、C<LWP::UserAgent> がリクエストを発行するときの振る舞いを
183179変更します。
184180これらのほとんどはコンストラクタメソッドに渡されたオプションによっても
185181初期化できます。
186182
187183=begin original
188184
189The following attribute methods are provided. The attribute value is
185The following attributes methods are provided. The attribute value is
190186left unchanged if no argument is given. The return value from each
191187method is the old attribute value.
192188
193189=end original
194190
195191以下の属性メソッドが提供されています。
196192引数がない場合は属性値は変更されません。
197193それぞれのメソッドの返り値は古い属性値です。
198194
199195=over
200196
201197=item $ua->agent
202198
203199=item $ua->agent( $product_id )
204200
205201=begin original
206202
207203Get/set the product token that is used to identify the user agent on
208204the network. The agent value is sent as the "User-Agent" header in
209205the requests. The default is the string returned by the _agent()
210206method (see below).
211207
212208=end original
213209
214210ネットワーク上でユーザエージェントを識別するために使われる
215211製品トークン(product token)を取得または設定します。
216212エージェントの値はリクエストの "User-Agent" ヘッダとして送信されます。
217213デフォルトは _agent() メソッド(後述)で返される文字列です。
218214
219215=begin original
220216
221217If the $product_id ends with space then the _agent() string is
222218appended to it.
223219
224220=end original
225221
226222$product_id が空白で終わっている場合は、その値に _agent() の文字列が
227223追加されます。
228224
229225=begin original
230226
231227The user agent string should be one or more simple product identifiers
232228with an optional version number separated by the "/" character.
233229Examples are:
234230
235231=end original
236232
237233ユーザエージェント文字列は、オプションで "/" 文字で
238234区切られたバージョン番号がついた、一つもしくはそれ以上の単純な
239235製品トークンです。
240236例を以下に示します:
241237
242238 $ua->agent('Checkbot/0.4 ' . $ua->_agent);
243239 $ua->agent('Checkbot/0.4 '); # same as above
244240 $ua->agent('Mozilla/5.0');
245241 $ua->agent(""); # don't identify
246242
247243=item $ua->_agent
248244
249245=begin original
250246
251247Returns the default agent identifier. This is a string of the form
252"libwww-perl/#.#<#del>#", where "#.###" is substituted with the version number
248"libwww-perl/#.##", where "#.##" is substituted with the version number
253249of this library.
254250
255251=end original
256252
257253デフォルトのエージェント識別子を返します。
258これは "libwww-perl/#.#<#del>#" 形式の文字列で、"#.###" はこのライブラリの
254これは "libwww-perl/#.##" 形式の文字列で、"#.##" はこのライブラリの
259255バージョン番号で置き換えられます。
260256
261257=item $ua->from
262258
263259=item $ua->from( $email_address )
264260
265261=begin original
266262
267263Get/set the e-mail address for the human user who controls
268264the requesting user agent. The address should be machine-usable, as
269265defined in RFC 822. The C<from> value is send as the "From" header in
270266the requests. Example:
271267
272268=end original
273269
274270リクエストしているユーザエージェントを制御している人間であるユーザの
275271e-mail アドレスを取得または設定します。
276272アドレスは RFC で定義されているように、機械で利用できなければなりません。
277273C<from> の値はリクエストでの "From" ヘッダとして送信されます。
278274例:
279275
280276 $ua->from('gaas@cpan.org');
281277
282278=begin original
283279
284280The default is to not send a "From" header. See the default_headers()
285281method for the more general interface that allow any header to be defaulted.
286282
287283=end original
288284
289285デフォルトでは、"From" ヘッダを送信しません。
290286任意のヘッダをデフォルトで指定できる、より一般的なインターフェースについては
291287default_headers() メソッドを参照してください。
292288
293289=item $ua->cookie_jar
294290
295291=item $ua->cookie_jar( $cookie_jar_obj )
296292
297293=begin original
298294
299295Get/set the cookie jar object to use. The only requirement is that
300296the cookie jar object must implement the extract_cookies($request) and
301297add_cookie_header($response) methods. These methods will then be
302298invoked by the user agent as requests are sent and responses are
303299received. Normally this will be a C<HTTP::Cookies> object or some
304300subclass.
305301
306302=end original
307303
308304使用するクッキー瓶(cookie jar)オブジェクトを取得または設定します。
309305唯一の必要条件は、クッキー瓶オブジェクトは
310306extract_cookies($request) メソッドと add_cookie_header($response) メソッドを
311307実装している必要があると言うことです。
312308これらのメソッドは、リクエストが送信されるときとレスポンスが受信されたときに
313309ユーザエージェントによって起動されます。
314310通常これは C<HTTP::Cookies> オブジェクトかそのサブクラスです。
315311
316312=begin original
317313
318314The default is to have no cookie_jar, i.e. never automatically add
319315"Cookie" headers to the requests.
320316
321317=end original
322318
323319デフォルトではクッキー瓶を使いません;
324320つまり自動的には "Cookie" ヘッダをリクエストに追加しません。
325321
326322=begin original
327323
328324Shortcut: If a reference to a plain hash is passed in as the
329325$cookie_jar_object, then it is replaced with an instance of
330326C<HTTP::Cookies> that is initialized based on the hash. This form also
331327automatically loads the C<HTTP::Cookies> module. It means that:
332328
333329=end original
334330
335331短縮形: もし単純なハッシュへのリファレンスが
336332$cookie_jar_object として渡されると、このハッシュを基にして初期化された
337333C<HTTP::Cookies> のインスタンスで置き換えられます。
338334この形式はまた、自動的に C<HTTP::Cookies> モジュールを読み込みます。
339335つまり、以下のようにすると:
340336
341337 $ua->cookie_jar({ file => "$ENV{HOME}/.cookies.txt" });
342338
343339=begin original
344340
345341is really just a shortcut for:
346342
347343=end original
348344
349345これは実際には以下の省略形です:
350346
351347 require HTTP::Cookies;
352348 $ua->cookie_jar(HTTP::Cookies->new(file => "$ENV{HOME}/.cookies.txt"));
353349
354350=item $ua->default_headers
355351
356352=item $ua->default_headers( $headers_obj )
357353
358354=begin original
359355
360356Get/set the headers object that will provide default header values for
361357any requests sent. By default this will be an empty C<HTTP::Headers>
362object.
358object. Example:
363359
364360=end original
365361
366362任意のレスポンスが送信されるときのデフォルトのヘッダ値を提供する
367363ヘッダオブジェクトを取得または設定します。
368364デフォルトではこれは空の C<HTTP::Headers> オブジェクトです。
365例:
369366
367 $ua->default_headers->push_header('Accept-Language' => "no, en");
368
370369=item $ua->default_header( $field )
371370
372371=item $ua->default_header( $field => $value )
373372
374373=begin original
375374
376375This is just a short-cut for $ua->default_headers->header( $field =>
377376$value ). Example:
378377
379378=end original
380379
381380これは単に $ua->default_headers->header( $field => $value ) の
382381短縮形です。
383382例:
384383
385 $ua->default_header('Accept-Encoding' => scalar HTTP::Message::decodable());
386384 $ua->default_header('Accept-Language' => "no, en");
387385
388386=item $ua->conn_cache
389387
390388=item $ua->conn_cache( $cache_obj )
391389
392390=begin original
393391
394392Get/set the C<LWP::ConnCache> object to use. See L<LWP::ConnCache>
395393for details.
396394
397395=end original
398396
399397使用する C<LWP::ConnCache> オブジェクトを取得または設定します。
400398詳しくは L<LWP::ConnCache> を参照してください。
401399
402=item $ua->credentials( $netloc, $realm )
403
404400=item $ua->credentials( $netloc, $realm, $uname, $pass )
405401
406402=begin original
407403
408Get/set the user name and password to be used for a realm.
404Set the user name and password to be used for a realm. It is often more
405useful to specialize the get_basic_credentials() method instead.
409406
410407=end original
411408
412あるレルムのために使われるユーザ名、パスワードを取得/設定します。
409あるレルムのために使われるユーザ名、パスワードを設定します。
410しばしば get_basic_credentials() メソッドを特殊化するよりも便利です。
413411
414412=begin original
415413
416The $netloc is a string of the form "<host>:<port>". The username and
414The $netloc a string of the form "<host>:<port>". The username and
417415password will only be passed to this server. Example:
418416
419417=end original
420418
421419$netloc は "<host>:<port>" の形式の文字列です。
422420ユーザ名とパスワードはこのサーバにのみ渡されます。
423421例:
424422
425423 $ua->credentials("www.example.com:80", "Some Realm", "foo", "secret");
426424
427=item $ua->local_address
428
429=item $ua->local_address( $address )
430
431=begin original
432
433Get/set the local interface to bind to for network connections. The interface
434can be specified as a hostname or an IP address. This value is passed as the
435C<LocalAddr> argument to L<IO::Socket::INET>.
436
437=end original
438
439ネットワーク接続のために bind するローカルインターフェースを取得/設定します。
440インターフェースはホスト名または IP アドレスとして指定できます。
441この値は L<IO::Socket::INET> に C<LocalAddr> 引数として渡されます。
442
443425=item $ua->max_size
444426
445427=item $ua->max_size( $bytes )
446428
447429=begin original
448430
449431Get/set the size limit for response content. The default is C<undef>,
450432which means that there is no limit. If the returned response content
451433is only partial, because the size limit was exceeded, then a
452434"Client-Aborted" header will be added to the response. The content
453435might end up longer than C<max_size> as we abort once appending a
454436chunk of data makes the length exceed the limit. The "Content-Length"
455437header, if present, will indicate the length of the full content and
456438will normally not be the same as C<< length($res->content) >>.
457439
458440=end original
459441
460442レスポンスの内容(content)の大きさの制限を取得または設定します。
461443デフォルトは C<undef> で、これは制限なしを意味します。
462444長さの制限を越えているために、戻されたレスポンスの内容が
463445一部だけであれば、"Client-Aborted" ヘッダがレスポンスに追加されます。
464446内容の長さが制限を超えることになるデータの固まりに追加するのを
465447中断するので、内容の長さは結局 C<max_size> を
466448超えることになることがあります。
467449もし "Content-Length" ヘッダがあれば、内容全体の長さを示していて、
468450これは通常は C<< length($res->content) >> と同じではありません。
469451
470452=item $ua->max_redirect
471453
472454=item $ua->max_redirect( $n )
473455
474456=begin original
475457
476458This reads or sets the object's limit of how many times it will obey
477459redirection responses in a given request cycle.
478460
479461=end original
480462
481463これは、1 回のリクエストで従うリダイレクトレスポンスの
482464回数の制限を読み込みまたは設定します。
483465
484466=begin original
485467
486468By default, the value is 7. This means that if you call request()
487469method and the response is a redirect elsewhere which is in turn a
488470redirect, and so on seven times, then LWP gives up after that seventh
489471request.
490472
491473=end original
492474
493475デフォルトでは、この値は 7 です。
494476これは、request() を呼び出して、リダイレクトされた先でさらに
495477リダイレクトされて、というのを 7 回繰り返すと、LWP は 7 回目の
496478リクエストの後に諦めます。
497479
498480=item $ua->parse_head
499481
500482=item $ua->parse_head( $boolean )
501483
502484=begin original
503485
504486Get/set a value indicating whether we should initialize response
505487headers from the E<lt>head> section of HTML documents. The default is
506488TRUE. Do not turn this off, unless you know what you are doing.
507489
508490=end original
509491
510492HTML ドキュメントの E<lt>head> セクションからレスポンスヘッダを
511493初期化すべきかどうかを示す値を取得または設定します。
512494デフォルトは TRUE です。
513495何をしているのかわからなければ、これをオフにしないで下さい。
514496
515497=item $ua->protocols_allowed
516498
517499=item $ua->protocols_allowed( \@protocols )
518500
519501=begin original
520502
521503This reads (or sets) this user agent's list of protocols that the
522504request methods will exclusively allow. The protocol names are case
523505insensitive.
524506
525507=end original
526508
527509これはこのユーザエージェントが排他的に許可されているプロトコルのリストを
528510読み込み(または設定)します。
529511プロトコル名は大文字小文字を無視します。
530512
531513=begin original
532514
533515For example: C<$ua-E<gt>protocols_allowed( [ 'http', 'https'] );>
534516means that this user agent will I<allow only> those protocols,
535517and attempts to use this user agent to access URLs with any other
536518schemes (like "ftp://...") will result in a 500 error.
537519
538520=end original
539521
540522例: C<$ua-E<gt>protocols_allowed( [ 'http', 'https'] );> というのは、
541523このユーザエージェントはこれらのプロトコル I<のみ許可されている> ことを
542524意味していて、このユーザエージェントが ("ftp://..." のような) その他の
543525スキームの URL にアクセスしようとすると 500 エラーとなります。
544526
545527=begin original
546528
547529To delete the list, call: C<$ua-E<gt>protocols_allowed(undef)>
548530
549531=end original
550532
551533リストを削除するには、以下のように呼び出します: C<$ua-E<gt>protocols_allowed(undef)>
552534
553535=begin original
554536
555537By default, an object has neither a C<protocols_allowed> list, nor a
556538C<protocols_forbidden> list.
557539
558540=end original
559541
560542デフォルトでは、オブジェクトは C<protocols_allowed> リストと
561543C<protocols_forbidden> リストのどちらも持ちません。
562544
563545=begin original
564546
565547Note that having a C<protocols_allowed> list causes any
566548C<protocols_forbidden> list to be ignored.
567549
568550=end original
569551
570552C<protocols_allowed> リストがあると C<protocols_forbidden> リストは
571553無視されることに注意してください。
572554
573555=item $ua->protocols_forbidden
574556
575557=item $ua->protocols_forbidden( \@protocols )
576558
577559=begin original
578560
579561This reads (or sets) this user agent's list of protocols that the
580562request method will I<not> allow. The protocol names are case
581563insensitive.
582564
583565=end original
584566
585567これはこのユーザエージェントが I<許可されていない> プロトコルのリストを
586568読み込み(または設定)します。
587569プロトコル名は大文字小文字を無視します。
588570
589571=begin original
590572
591573For example: C<$ua-E<gt>protocols_forbidden( [ 'file', 'mailto'] );>
592574means that this user agent will I<not> allow those protocols, and
593575attempts to use this user agent to access URLs with those schemes
594576will result in a 500 error.
595577
596578=end original
597579
598580例: C<$ua-E<gt>protocols_forbidden( [ 'file', 'mailto'] );> は
599581このユーザエージェントはこれらのプロトコルを I<許可せず>、
600582このユーザエージェントを使ってこれらのスキーマで URL に
601583アクセスしようとすると 500 エラーになります。
602584
603585=begin original
604586
605587To delete the list, call: C<$ua-E<gt>protocols_forbidden(undef)>
606588
607589=end original
608590
609591リストを削除するには、このように呼び出します: C<$ua-E<gt>protocols_forbidden(undef)>
610592
611593=item $ua->requests_redirectable
612594
613595=item $ua->requests_redirectable( \@requests )
614596
615597=begin original
616598
617599This reads or sets the object's list of request names that
618600C<$ua-E<gt>redirect_ok(...)> will allow redirection for. By
619601default, this is C<['GET', 'HEAD']>, as per RFC 2616. To
620602change to include 'POST', consider:
621603
622604=end original
623605
624606これは C<$ua-E<gt>redirect_ok(...)> がリダイレクトを許可する
625607リクエスト名のリストを読み込みまたは設定します。
626608デフォルトでは、これは RFC 2616 に従って C<['GET', 'HEAD']> になっています。
627609'POST' を含むようにするには、以下のようにします:
628610
629611 push @{ $ua->requests_redirectable }, 'POST';
630612
631=item $ua->show_progress
632
633=item $ua->show_progress( $boolean )
634
635=begin original
636
637Get/set a value indicating whether a progress bar should be displayed
638on on the terminal as requests are processed. The default is FALSE.
639
640=end original
641
642リクエストの処理時に端末にプログレスバーを表示するかどうかを示す
643値を取得/設定します。
644デフォルトは偽です。
645
646613=item $ua->timeout
647614
648615=item $ua->timeout( $secs )
649616
650617=begin original
651618
652619Get/set the timeout value in seconds. The default timeout() value is
653620180 seconds, i.e. 3 minutes.
654621
655622=end original
656623
657624秒単位のタイムアウト値を取得または設定します。
658625デフォルトの timeout() の値は 180 秒、つまり 3 分です。
659626
660627=begin original
661628
662629The requests is aborted if no activity on the connection to the server
663630is observed for C<timeout> seconds. This means that the time it takes
664631for the complete transaction and the request() method to actually
665632return might be longer.
666633
667634=end original
668635
669636サーバへの接続において C<timeout> 秒反応がないと、リクエストは中断します。
670637つまり、トランザクションが完了して request() メソッドが実際に返るまでの
671638時間を意味します。
672639
673=item $ua->ssl_opts
674
675=item $ua->ssl_opts( $key )
676
677=item $ua->ssl_opts( $key => $value )
678
679=begin original
680
681Get/set the options for SSL connections. Without argument return the list
682of options keys currently set. With a single argument return the current
683value for the given option. With 2 arguments set the option value and return
684the old. Setting an option to the value C<undef> removes this option.
685
686=end original
687
688SSL 接続のオプションを取得/設定します。
689引数なしの場合、現在設定されているオプションキーの一覧を返します。
6901 引数の場合、与えられたオプションの現在の値を返します。
6912 引数の場合、オプションの値を設定して、古いものを返します。
692オプションとして C<undef> 値を設定すると、このオプションを削除します。
693
694=begin original
695
696The options that LWP relates to are:
697
698=end original
699
700LWP に関するオプションは:
701
702=over
703
704=item C<verify_hostname> => $bool
705
706=begin original
707
708When TRUE LWP will for secure protocol schemes ensure it connects to servers
709that have a valid certificate matching the expected hostname. If FALSE no
710checks are made and you can't be sure that you communicate with the expected peer.
711The no checks behaviour was the default for libwww-perl-5.837 and earlier releases.
712
713=end original
714
715真の場合、LWP は、セキュアなプロトコルスキームで、
716妥当な証明書が想定されるホスト名に一致しているサーバに
717接続していることを確認します。
718偽の場合、チェックは行われず、想定している接続先と通信しているかを
719確認できません。
720チェックしない振る舞いは、libwww-perl-5.837 以前のリリースのデフォルトでした。
721
722=begin original
723
724This option is initialized from the L<PERL_LWP_SSL_VERIFY_HOSTNAME> environment
725variable. If this environment variable isn't set; then C<verify_hostname>
726defaults to 1.
727
728=end original
729
730このオプションは L<PERL_LWP_SSL_VERIFY_HOSTNAME> 環境変数で初期化されます。
731環境変数が設定されていない場合、C<verify_hostname> のデフォルトは 1 です。
732
733=item C<SSL_ca_file> => $path
734
735=begin original
736
737The path to a file containing Certificate Authority certificates.
738A default setting for this option is provided by checking the environment
739variables C<PERL_LWP_SSL_CA_FILE> and C<HTTPS_CA_FILE> in order.
740
741=end original
742
743Certificate Authority 証明書があるファイルのパス。
744このオプションのデフォルト設定は、環境変数 C<PERL_LWP_SSL_CA_FILE> と
745C<HTTPS_CA_FILE> をこの順序でチェックすることで提供されます。
746
747=item C<SSL_ca_path> => $path
748
749=begin original
750
751The path to a directory containing files containing Certificate Authority
752certificates.
753A default setting for this option is provided by checking the environment
754variables C<PERL_LWP_SSL_CA_PATH> and C<HTTPS_CA_DIR> in order.
755
756=end original
757
758Certificate Authority 証明書があるファイルのあるディレクトリへのパス。
759このオプションのデフォルト設定は、環境変数 C<PERL_LWP_SSL_CA_PATH> と
760C<HTTPS_CA_DIR> をこの順序でチェックすることで提供されます。
761
762640=back
763641
764=begin original
765
766Other options can be set and are processed directly by the SSL Socket implementation
767in use. See L<IO::Socket::SSL> or L<Net::SSL> for details.
768
769=end original
770
771その他のオプションは、使っている SSL Socket 実装によって直接設定および
772処理されます。
773詳しくは L<IO::Socket::SSL> や L<Net::SSL> を参照してください。
774
775=begin original
776
777The libwww-perl core no longer bundles protocol plugins for SSL. You will need
778to install L<LWP::Protocol::https> separately to enable support for processing
779https-URLs.
780
781=end original
782
783libwww-perl コアはもはや SSL のためのプロトコルプラグインを同梱しません。
784https-URL の処理の対応を有効にするために、個別に
785L<LWP::Protocol::https> をインストールする必要があります。
786
787=back
788
789642=head2 Proxy attributes
790643
791644(プロキシ属性)
792645
793646=begin original
794647
795648The following methods set up when requests should be passed via a
796649proxy server.
797650
798651=end original
799652
800653以下のメソッドはプロキシサーバー経由で渡されるべきリクエストを設定します。
801654
802655=over
803656
804657=item $ua->proxy(\@schemes, $proxy_url)
805658
806659=item $ua->proxy($scheme, $proxy_url)
807660
808661=begin original
809662
810663Set/retrieve proxy URL for a scheme:
811664
812665=end original
813666
814667あるスキームのためのプロキシ URL を設定または取得します:
815668
816669 $ua->proxy(['http', 'ftp'], 'http://proxy.sn.no:8001/');
817670 $ua->proxy('gopher', 'http://proxy.sn.no:8001/');
818671
819672=begin original
820673
821674The first form specifies that the URL is to be used for proxying of
822675access methods listed in the list in the first method argument,
823676i.e. 'http' and 'ftp'.
824677
825678=end original
826679
827680最初の形式はその URL がメソッドの最初に引数のリストに入っている
828681アクセスメソッド、つまり 'http' と 'ftp' のプロキシのために
829682使われることを指定します。
830683
831684=begin original
832685
833686The second form shows a shorthand form for specifying
834687proxy URL for a single access scheme.
835688
836689=end original
837690
8386912 番目の形式は一つのアクセス機能のためのプロキシ URL を
839692指定するための短縮した形式を示しています。
840693
841694=item $ua->no_proxy( $domain, ... )
842695
843696=begin original
844697
845698Do not proxy requests to the given domains. Calling no_proxy without
846699any domains clears the list of domains. Eg:
847700
848701=end original
849702
850703与えられたドメインへのリクエストをプロキシしません。
851704何もドメインを指定しないで no_proxy を呼ぶと、ドメインのリストを
852705クリアします。
853706例:
854707
855 $ua->no_proxy('localhost', 'example.com');
708 $ua->no_proxy('localhost', 'no', ...);
856709
857710=item $ua->env_proxy
858711
859712=begin original
860713
861714Load proxy settings from *_proxy environment variables. You might
862715specify proxies like this (sh-syntax):
863716
864717=end original
865718
866719*_proxy 環境変数からプロキシ設定をロードします。
867720以下のように指定できるでしょう(sh での書き方):
868721
869722 gopher_proxy=http://proxy.my.place/
870723 wais_proxy=http://proxy.my.place/
871 no_proxy="localhost,example.com"
724 no_proxy="localhost,my.domain"
872725 export gopher_proxy wais_proxy no_proxy
873726
874727=begin original
875728
876729csh or tcsh users should use the C<setenv> command to define these
877730environment variables.
878731
879732=end original
880733
881734csh または tcsh のユーザは、これらの環境変数を定義するために
882735C<setenv> コマンドを使わなければなりません。
883736
884737=begin original
885738
886739On systems with case insensitive environment variables there exists a
887740name clash between the CGI environment variables and the C<HTTP_PROXY>
888741environment variable normally picked up by env_proxy(). Because of
889742this C<HTTP_PROXY> is not honored for CGI scripts. The
890743C<CGI_HTTP_PROXY> environment variable can be used instead.
891744
892745=end original
893746
894747環境変数名に大文字小文字の区別がないシステムでは、
895748CGI 環境変数と、通常 env_proxy() によって読み込まれる C<HTTP_PROXY>
896749環境変数の間で名前の衝突があります。
897750この理由により、C<HTTP_PROXY> は CGI スクリプトのためのものではありません。
898751代わりに C<CGI_HTTP_PROXY> 環境変数を使えます。
899752
900753=back
901754
902=head2 Handlers
903
904(ハンドラ)
905
906=begin original
907
908Handlers are code that injected at various phases during the
909processing of requests. The following methods are provided to manage
910the active handlers:
911
912=end original
913
914ハンドラは、リクエストの処理中の様々なフェーズに注入されるコードです。
915アクティブなハンドラを管理するために次のメソッドが提供されています:
916
917=over
918
919=item $ua->add_handler( $phase => \&cb, %matchspec )
920
921=begin original
922
923Add handler to be invoked in the given processing phase. For how to
924specify %matchspec see L<HTTP::Config/"Matching">.
925
926=end original
927
928指定された処理フェーズで起動されるハンドラを追加します。
929%matchspec の指定方法については L<HTTP::Config/"Matching"> を
930参照してください。
931
932=begin original
933
934The possible values $phase and the corresponding callback signatures are:
935
936=end original
937
938取り得る $phase の値と、対応するコールバックのシグネチャは:
939
940=over
941
942=item request_preprepare => sub { my($request, $ua, $h) = @_; ... }
943
944=begin original
945
946The handler is called before the C<request_prepare> and other standard
947initialization of of the request. This can be used to set up headers
948and attributes that the C<request_prepare> handler depends on. Proxy
949initialization should take place here; but in general don't register
950handlers for this phase.
951
952=end original
953
954ハンドラは、C<request_prepare> とその他のリクエストの標準的な初期化の
955前に呼び出されます。
956これは C<request_prepare> ハンドラが依存するヘッダと属性を
957設定するのに使えます。
958プロキシ初期化はここに置く必要があります;
959しかし一般的にはこのフェーズにハンドルを登録しないでください。
960
961=item request_prepare => sub { my($request, $ua, $h) = @_; ... }
962
963=begin original
964
965The handler is called before the request is sent and can modify the
966request any way it see fit. This can for instance be used to add
967certain headers to specific requests.
968
969=end original
970
971ハンドラは、リクエストを送信する前に呼び出され、
972適合するならどのような形でもリクエストを変更できます。
973これは例えば特定のリクエストにある種のヘッダを追加するのに使えます。
974
975=begin original
976
977The method can assign a new request object to $_[0] to replace the
978request that is sent fully.
979
980=end original
981
982メソッドは、送られるリクエストを完全に置き換えるために、
983$_[0] に新しいリクエストオブジェクトを代入できます。
984
985=begin original
986
987The return value from the callback is ignored. If an exception is
988raised it will abort the request and make the request method return a
989"400 Bad request" response.
990
991=end original
992
993コールバックからの返り値は無視されます。
994例外が発生すると、リクエストを中止して、
995リクエストメソッドは "400 Bad request" レスポンスを返します。
996
997=item request_send => sub { my($request, $ua, $h) = @_; ... }
998
999=begin original
1000
1001This handler gets a chance of handling requests before they're sent to the
1002protocol handlers. It should return an HTTP::Response object if it
1003wishes to terminate the processing; otherwise it should return nothing.
1004
1005=end original
1006
1007このハンドラは、プロトコルハンドラに送られる前に
1008リクエストを扱う機会を与えます。
1009処理を終わらせることを望むなら HTTP::Response オブジェクトを返す
1010必要があります; さもなければ何も返さない必要があります。
1011
1012=begin original
1013
1014The C<response_header> and C<response_data> handlers will not be
1015invoked for this response, but the C<response_done> will be.
1016
1017=end original
1018
1019C<response_header> と C<response_data> のハンドラは
1020このレスポンスでは起動されませんが、
1021C<response_done> は起動されます。
1022
1023=item response_header => sub { my($response, $ua, $h) = @_; ... }
1024
1025=begin original
1026
1027This handler is called right after the response headers have been
1028received, but before any content data. The handler might set up
1029handlers for data and might croak to abort the request.
1030
1031=end original
1032
1033このハンドラは、レスポンスヘッダを受信した直後、本体データを
1034受信する前に呼び出されます。
1035ハンドラはデータのためにハンドラを設定したりリクエストを中止するために
1036croak したりできます。
1037
1038=begin original
1039
1040The handler might set the $response->{default_add_content} value to
1041control if any received data should be added to the response object
1042directly. This will initially be false if the $ua->request() method
1043was called with a $content_file or $content_cb argument; otherwise true.
1044
1045=end original
1046
1047ハンドラは、受信データが直接レスポンスオブジェクトに追加されるかどうかを
1048制御するために $response->{default_add_content} の値を設定できます。
1049これは、 $content_file または $content_cb 引数付きで $ua->request()
1050メソッドが呼び出されたときは偽です; さもなければ真です。
1051
1052=item response_data => sub { my($response, $ua, $h, $data) = @_; ... }
1053
1054=begin original
1055
1056This handler is called for each chunk of data received for the
1057response. The handler might croak to abort the request.
1058
1059=end original
1060
1061このハンドラは、レスポンスとしてデータの塊を受信する毎に呼び出されます。
1062このハンドラはリクエストを中止するために croak できます。
1063
1064=begin original
1065
1066This handler needs to return a TRUE value to be called again for
1067subsequent chunks for the same request.
1068
1069=end original
1070
1071このハンドラは、同じリクエストの引き続く塊のために再び呼び出されるために、
1072真の値を返す必要があります。
1073
1074=item response_done => sub { my($response, $ua, $h) = @_; ... }
1075
1076=begin original
1077
1078The handler is called after the response has been fully received, but
1079before any redirect handling is attempted. The handler can be used to
1080extract information or modify the response.
1081
1082=end original
1083
1084このハンドルは、レスポンスが完全に受信された後、リダイレクト処理を
1085試みる前に呼び出されます。
1086ハンドラは、情報を取り出したりレスポンスを修正したりするのに使えます。
1087
1088=item response_redirect => sub { my($response, $ua, $h) = @_; ... }
1089
1090=begin original
1091
1092The handler is called in $ua->request after C<response_done>. If the
1093handler returns an HTTP::Request object we'll start over with processing
1094this request instead.
1095
1096=end original
1097
1098このハンドルは $ua->request で、C<response_done> の後に呼び出されます。
1099ハンドラが HTTP::Request オブジェクトを返すと、代わりにこのリクエストを
1100処理してやり直します。
1101
1102=back
1103
1104=item $ua->remove_handler( undef, %matchspec )
1105
1106=item $ua->remove_handler( $phase, %matchspec )
1107
1108=begin original
1109
1110Remove handlers that match the given %matchspec. If $phase is not
1111provided remove handlers from all phases.
1112
1113=end original
1114
1115%matchspec に一致するハンドラを削除します。
1116$phase が指定されないと、全てのフェーズからハンドラを削除します。
1117
1118=begin original
1119
1120Be careful as calling this function with %matchspec that is not not
1121specific enough can remove handlers not owned by you. It's probably
1122better to use the set_my_handler() method instead.
1123
1124=end original
1125
1126自分が所有していないハンドラを削除しないのに十分な %matchspec で
1127この関数を呼び出すように注意してください。
1128おそらく代わりに set_my_handler() メソッドを使った方が良いです。
1129
1130=begin original
1131
1132The removed handlers are returned.
1133
1134=end original
1135
1136削除されたハンドラが返されます。
1137
1138=item $ua->set_my_handler( $phase, $cb, %matchspec )
1139
1140=begin original
1141
1142Set handlers private to the executing subroutine. Works by defaulting
1143an C<owner> field to the %matchspec that holds the name of the called
1144subroutine. You might pass an explicit C<owner> to override this.
1145
1146=end original
1147
1148サブルーチンを実行するのにプライベートなハンドラを設定します。
1149C<owner> フィールドに、呼び出したサブルーチン名を保持した %matchspec を
1150デフォルトで設定することで動作します。
1151これを上書きするために明示的な C<owner> を渡すことができます。
1152
1153=begin original
1154
1155If $cb is passed as C<undef>, remove the handler.
1156
1157=end original
1158
1159$cb が C<undef> として渡されると、ハンドラを削除します。
1160
1161=item $ua->get_my_handler( $phase, %matchspec )
1162
1163=item $ua->get_my_handler( $phase, %matchspec, $init )
1164
1165=begin original
1166
1167Will retrieve the matching handler as hash ref.
1168
1169=end original
1170
1171一致するハンドラをハッシュリファレンスとして受け取ります。
1172
1173=begin original
1174
1175If C<$init> is passed passed as a TRUE value, create and add the
1176handler if it's not found. If $init is a subroutine reference, then
1177it's called with the created handler hash as argument. This sub might
1178populate the hash with extra fields; especially the callback. If
1179$init is a hash reference, merge the hashes.
1180
1181=end original
1182
1183C<$init> に真の値が渡されると、見つからない場合に
1184新しくハンドラを作って追加します。
1185$init がサブルーチンリファレンスの場合、
1186作成されたハンドラハッシュを引数としてこれが呼び出されます。
1187このサブルーチンは、ハッシュに追加のフィールド、特にコールバックを
1188追加できます。
1189$init がハッシュリファレンスなら、ハッシュをマージします。
1190
1191=item $ua->handlers( $phase, $request )
1192
1193=item $ua->handlers( $phase, $response )
1194
1195=begin original
1196
1197Returns the handlers that apply to the given request or response at
1198the given processing phase.
1199
1200=end original
1201
1202指定された処理フェーズで指定されたリクエストまたはレスポンスに
1203適用されるハンドラを返します。
1204
1205=back
1206
1207755=head1 REQUEST METHODS
1208756
1209757(リクエストメソッド)
1210758
1211759=begin original
1212760
1213761The methods described in this section are used to dispatch requests
1214762via the user agent. The following request methods are provided:
1215763
1216764=end original
1217765
1218766この章で記述されているメソッドはユーザエージェント経由でリクエストを
1219767発行するために使われます。
1220768以下のリクエストメソッドが提供されています:
1221769
1222770=over
1223771
1224772=item $ua->get( $url )
1225773
1226774=item $ua->get( $url , $field_name => $value, ... )
1227775
1228776=begin original
1229777
1230778This method will dispatch a C<GET> request on the given $url. Further
1231779arguments can be given to initialize the headers of the request. These
1232780are given as separate name/value pairs. The return value is a
1233781response object. See L<HTTP::Response> for a description of the
1234782interface it provides.
1235783
1236784=end original
1237785
1238786このメソッドは、与えられた $url に C<GET> リクエストを発行します。
1239787リクエストのヘッダを初期化するために追加の引数を与えることもできます。
1240788これらは別々の名前/値の組で与えられます。
1241789返り値はレスポンスオブジェクトです。
1242790これが提供するインターフェースの説明については L<HTTP::Response> を
1243791参照してください。
1244792
1245793=begin original
1246794
1247There will still be a response object returned when LWP can't connect to the
1248server specified in the URL or when other failures in protocol handlers occur.
1249These internal responses use the standard HTTP status codes, so the responses
1250can't be differentiated by testing the response status code alone. Error
1251responses that LWP generates internally will have the "Client-Warning" header
1252set to the value "Internal response". If you need to differentiate these
1253internal responses from responses that a remote server actually generates, you
1254need to test this header value.
1255
1256=end original
1257
1258LWP が URL で指定されたサーバに接続できない場合や、プロトコルハンドラ内で
1259その他のエラーが発生した場合でも、レスポンスオブジェクトが返されます。
1260これらの内部レスポンスは標準の HTTP ステータスコードを使うので、
1261レスポンスステータスコードだけをテストしても、レスポンスを
1262区別することはできません。
1263LWP が内部で生成したエラーレスポンスは、"Client-Warning" ヘッダに
1264"Internal response" という値が設定されます。
1265これらの内部レスポンスを実際にリモートサーバが生成したレスポンスと
1266区別する必要がある場合は、このヘッダの値をテストする必要があります。
1267
1268=begin original
1269
1270795Fields names that start with ":" are special. These will not
1271796initialize headers of the request but will determine how the response
1272797content is treated. The following special field names are recognized:
1273798
1274799=end original
1275800
1276801":" で始まるフィールド名は特殊です。
1277802これらはリクエストのヘッダの初期化はせず、レスポンスオブジェクトが
1278803どのように扱われるかを決定します。
1279804以下の特殊フィールド名を認識します:
1280805
1281806 :content_file => $filename
1282807 :content_cb => \&callback
1283808 :read_size_hint => $bytes
1284809
1285810=begin original
1286811
1287812If a $filename is provided with the C<:content_file> option, then the
1288813response content will be saved here instead of in the response
1289814object. If a callback is provided with the C<:content_cb> option then
1290815this function will be called for each chunk of the response content as
1291816it is received from the server. If neither of these options are
1292817given, then the response content will accumulate in the response
1293818object itself. This might not be suitable for very large response
1294819bodies. Only one of C<:content_file> or C<:content_cb> can be
1295820specified. The content of unsuccessful responses will always
1296821accumulate in the response object itself, regardless of the
1297822C<:content_file> or C<:content_cb> options passed in.
1298823
1299824=end original
1300825
1301826C<:content_file> オプションで $filename が指定されると、レスポンスの内容は
1302827レスポンスオブジェクトの代わりにこのファイルに保存されます。
1303828C<:content_cb> オプションでコールバック関数が指定されると、
1304829レスポンスの内容の塊ををサーバから受信する毎にこの関数が呼び出されます。
1305830これらのオプションのどちらも指定されなかった場合、レスポンスの内容は
1306831レスポンスオブジェクト自身に蓄積されます。
1307832これはレスポンスボディがとても大きい場合には向いていません。
1308833C<:content_file> と C<:content_cb> のどちらか一つのみが指定できます。
1309834失敗したレスポンスの内容は、C<:content_file> や C<:content_cb> の
1310835オプションが指定されているかどうかに関わらず
1311836常にレスポンスオブジェクト自身に蓄積されます。
1312837
1313838=begin original
1314839
1315840The C<:read_size_hint> option is passed to the protocol module which
1316841will try to read data from the server in chunks of this size. A
1317842smaller value for the C<:read_size_hint> will result in a higher
1318843number of callback invocations.
1319844
1320845=end original
1321846
1322847C<:read_size_hint> オプションは、このサイズの塊でサーバからデータを
1323848読み込もうとするようにプロトコルモジュールに渡されます。
1324849C<:read_size_hint> の値を小さくすると、コールバックの起動回数は
1325850多くなります。
1326851
1327852=begin original
1328853
1329854The callback function is called with 3 arguments: a chunk of data, a
1330855reference to the response object, and a reference to the protocol
1331856object. The callback can abort the request by invoking die(). The
1332857exception message will show up as the "X-Died" header field in the
1333858response returned by the get() function.
1334859
1335860=end original
1336861
1337862コールバック関数は 3 引数で呼び出されます: データの塊、
1338863レスポンスオブジェクトへのリファレンス、プロトコルオブジェクトへの
1339864リファレンス、です。
1340865コールバックは die() を起動することでリクエストを中断できます。
1341866例外メッセージは、get() 関数で返されるレスポンスの中の
1342867"X-Died" ヘッダフィールドで得られます。
1343868
1344869=item $ua->head( $url )
1345870
1346871=item $ua->head( $url , $field_name => $value, ... )
1347872
1348873=begin original
1349874
1350875This method will dispatch a C<HEAD> request on the given $url.
1351876Otherwise it works like the get() method described above.
1352877
1353878=end original
1354879
1355880このメソッドは、与えられた $url に C<HEAD> リクエストを発行します。
1356881その他は上述の get() メソッドと同様に動作します。
1357882
1358883=item $ua->post( $url, \%form )
1359884
1360885=item $ua->post( $url, \@form )
1361886
1362887=item $ua->post( $url, \%form, $field_name => $value, ... )
1363888
1364889=item $ua->post( $url, $field_name => $value,... Content => \%form )
1365890
1366891=item $ua->post( $url, $field_name => $value,... Content => \@form )
1367892
1368893=item $ua->post( $url, $field_name => $value,... Content => $content )
1369894
1370895=begin original
1371896
1372897This method will dispatch a C<POST> request on the given $url, with
1373898%form or @form providing the key/value pairs for the fill-in form
1374899content. Additional headers and content options are the same as for
1375900the get() method.
1376901
1377902=end original
1378903
1379904このメソッドは、与えられた $url に、フォームの内容として
1380905%form または @form で与えられるキー/値の組を使って
1381906C<POST> リクエストを発行します。
1382907追加のヘッダと内容のオプションは get() メソッドと同じです。
1383908
1384909=begin original
1385910
1386911This method will use the POST() function from C<HTTP::Request::Common>
1387912to build the request. See L<HTTP::Request::Common> for a details on
1388913how to pass form content and other advanced features.
1389914
1390915=end original
1391916
1392917このメソッドは、リクエストを構築するために
1393918C<HTTP::Request::Common> の POST() 関数を使います。
1394919フォームの内容の渡し方とその他の高度な機能に関する詳細については
1395920L<HTTP::Request::Common> を参照してください。
1396921
1397=item $ua->put( $url, \%form )
1398
1399=item $ua->put( $url, \@form )
1400
1401=item $ua->put( $url, \%form, $field_name => $value, ... )
1402
1403=item $ua->put( $url, $field_name => $value,... Content => \%form )
1404
1405=item $ua->put( $url, $field_name => $value,... Content => \@form )
1406
1407=item $ua->put( $url, $field_name => $value,... Content => $content )
1408
1409=begin original
1410
1411This method will dispatch a C<PUT> request on the given $url, with
1412%form or @form providing the key/value pairs for the fill-in form
1413content. Additional headers and content options are the same as for
1414the get() method.
1415
1416=end original
1417
1418このメソッドは、与えられた $url に C<PUT> リクエストを発行します;
1419%form または @form でフォームの内容のためのキー/値の組を提供します。
1420追加のヘッダと本体オプションは get() メソッドと同様です。
1421
1422=begin original
1423
1424This method will use the PUT() function from C<HTTP::Request::Common>
1425to build the request. See L<HTTP::Request::Common> for a details on
1426how to pass form content and other advanced features.
1427
1428=end original
1429
1430このメソッドは、リクエストを構築するのに C<HTTP::Request::Common> の
1431PUT() 関数を使います。
1432フォームの内容の渡し方とその他の高度な機能に関する詳細については
1433L<HTTP::Request::Common> を参照してください。
1434
1435=item $ua->delete( $url )
1436
1437=item $ua->delete( $url, $field_name => $value, ... )
1438
1439=begin original
1440
1441This method will dispatch a C<DELETE> request on the given $url. Additional
1442headers and content options are the same as for the get() method.
1443
1444=end original
1445
1446このメソッドは、与えられた $url に C<DELETE> リクエストを発行します。
1447追加のヘッダと内容オプションは get() メソッドと同様です。
1448
1449=begin original
1450
1451This method will use the DELETE() function from C<HTTP::Request::Common>
1452to build the request. See L<HTTP::Request::Common> for a details on
1453how to pass form content and other advanced features.
1454
1455=end original
1456
1457このメソッドは、リクエストを構築するのに C<HTTP::Request::Common> の
1458DELETE() 関数を使います。
1459フォームの内容の渡し方とその他の高度な機能に関する詳細については
1460L<HTTP::Request::Common> を参照してください。
1461
1462922=item $ua->mirror( $url, $filename )
1463923
1464924=begin original
1465925
1466926This method will get the document identified by $url and store it in
1467927file called $filename. If the file already exists, then the request
1468928will contain an "If-Modified-Since" header matching the modification
1469929time of the file. If the document on the server has not changed since
1470930this time, then nothing happens. If the document has been updated, it
1471931will be downloaded again. The modification time of the file will be
1472932forced to match that of the server.
1473933
1474934=end original
1475935
1476936このメソッドは $url で識別されるドキュメントを取得し、$filename で
1477937指定されるファイルに保管します。
1478938ファイルが既に存在する場合、リクエストにはそのファイルの修正時刻に一致する
1479939"If-Modified-Since" ヘッダが含まれます。
1480940ドキュメントが更新されている場合は、再びダウンロードされます。
1481941ファイルの修正時刻はサーバ上での修正時刻と同じになります。
1482942
1483943=begin original
1484944
1485945The return value is the the response object.
1486946
1487947=end original
1488948
1489949返り値はレスポンスオブジェクトです。
1490950
1491951=item $ua->request( $request )
1492952
1493953=item $ua->request( $request, $content_file )
1494954
1495955=item $ua->request( $request, $content_cb )
1496956
1497957=item $ua->request( $request, $content_cb, $read_size_hint )
1498958
1499959=begin original
1500960
1501961This method will dispatch the given $request object. Normally this
1502962will be an instance of the C<HTTP::Request> class, but any object with
1503963a similar interface will do. The return value is a response object.
1504964See L<HTTP::Request> and L<HTTP::Response> for a description of the
1505965interface provided by these classes.
1506966
1507967=end original
1508968
1509969このメソッドは与えられた $request オブジェクトを発行します。
1510970通常これは C<HTTP::Request> クラスの実体ですが、似たような
1511971インターフェースを持つどのようなオブジェクトでも動作します。
1512972返り値はレスポンスオブジェクトです。
1513973これらのクラスによって提供されるインターフェースの記述については
1514974L<HTTP::Request> と L<HTTP::Response> を参照してください。
1515975
1516976=begin original
1517977
1518978The request() method will process redirects and authentication
1519979responses transparently. This means that it may actually send several
1520980simple requests via the simple_request() method described below.
1521981
1522982=end original
1523983
1524984request() メソッドはリダイレクトと認証を透過的に処理します。
1525985これは、実際には後述する simple_request() メソッドを使って単純な
1526986リクエストを複数回送信するかもしれないことを意味します。
1527987
1528988=begin original
1529989
1530990The request methods described above; get(), head(), post() and
1531991mirror(), will all dispatch the request they build via this method.
1532992They are convenience methods that simply hides the creation of the
1533993request object for you.
1534994
1535995=end original
1536996
1537997上述のリクエストメソッド: get(), head(), post(), mirror() は全て
1538998構築したリクエストをこのメソッド経由で発行します。
1539999これらは単にリクエストメソッドの作成をあなたから隠すための
15401000便利メソッドです。
15411001
15421002=begin original
15431003
15441004The $content_file, $content_cb and $read_size_hint all correspond to
15451005options described with the get() method above.
15461006
15471007=end original
15481008
15491009$content_file, $content_cb, $read_size_hint は全て上述の
15501010get() メソッドで記述したオプションに対応します。
15511011
15521012=begin original
15531013
15541014You are allowed to use a CODE reference as C<content> in the request
15551015object passed in. The C<content> function should return the content
15561016when called. The content can be returned in chunks. The content
15571017function will be invoked repeatedly until it return an empty string to
15581018signal that there is no more content.
15591019
15601020=end original
15611021
15621022リクエストオブジェクトに渡す C<content> としてコードリファレンスも使えます。
15631023C<content> 関数は、呼び出されたときに内容を返すようにします。
15641024内容は塊で返すこともできます。
15651025content 関数は、もう内容がないことを示すために空文字列が返されるまで
15661026繰り返し起動されます。
15671027
15681028=item $ua->simple_request( $request )
15691029
15701030=item $ua->simple_request( $request, $content_file )
15711031
15721032=item $ua->simple_request( $request, $content_cb )
15731033
15741034=item $ua->simple_request( $request, $content_cb, $read_size_hint )
15751035
15761036=begin original
15771037
15781038This method dispatches a single request and returns the response
15791039received. Arguments are the same as for request() described above.
15801040
15811041=end original
15821042
15831043このメソッドは 1 回のリクエストを発行し、受信したレスポンスを返します。
15841044引数は上述の request() のものと同じです。
15851045
15861046=begin original
15871047
15881048The difference from request() is that simple_request() will not try to
15891049handle redirects or authentication responses. The request() method
15901050will in fact invoke this method for each simple request it sends.
15911051
15921052=end original
15931053
15941054request() との違いは、simple_request() はリダイレクトや認証を
15951055扱おうとしないことです。
15961056実際のところ、request() メソッドは、単純なリクエストを送る度に
15971057このメソッドを起動します。
15981058
1599=item $ua->is_online
1600
1601=begin original
1602
1603Tries to determine if you have access to the Internet. Returns
1604TRUE if the built-in heuristics determine that the user agent is
1605able to access the Internet (over HTTP). See also L<LWP::Online>.
1606
1607=end original
1608
1609インターネットにアクセスできるかを判断しようとします。
1610ユーザーエージェントがインターネットに (HTTP で) アクセスできると
1611組み込みのヒューリスティックが判断した場合、真を返します。
1612L<LWP::Online> も参照してください。
1613
16141059=item $ua->is_protocol_supported( $scheme )
16151060
16161061=begin original
16171062
16181063You can use this method to test whether this user agent object supports the
16191064specified C<scheme>. (The C<scheme> might be a string (like 'http' or
16201065'ftp') or it might be an URI object reference.)
16211066
16221067=end original
16231068
16241069このユーザエージェントが指定された C<scheme> を
16251070サポートしているかどうかを調べるために使うことができます。
16261071(C<scheme> には ('http' や 'ftp' のような)文字列や、
16271072URI オブジェクトリファレンスを指定できます。)
16281073
16291074=begin original
16301075
16311076Whether a scheme is supported, is determined by the user agent's
16321077C<protocols_allowed> or C<protocols_forbidden> lists (if any), and by
16331078the capabilities of LWP. I.e., this will return TRUE only if LWP
16341079supports this protocol I<and> it's permitted for this particular
16351080object.
16361081
16371082=end original
16381083
16391084あるスキーマが対応しているかどうかは、(もしあれば)ユーザエージェントの
16401085C<protocols_allowed> と C<protocols_forbidden> のリスト、および
16411086LWP の能力によって決定されます。
16421087つまり、このメソッドは LWP がこのプロトコルに対応していて、I<かつ> それが
16431088このオブジェクトに対して許可されている場合にのみ TRUE を返します。
16441089
16451090=back
16461091
16471092=head2 Callback methods
16481093
16491094(コールバックメソッド)
16501095
16511096=begin original
16521097
16531098The following methods will be invoked as requests are processed. These
16541099methods are documented here because subclasses of C<LWP::UserAgent>
16551100might want to override their behaviour.
16561101
16571102=end original
16581103
16591104以下のメソッドはリクエストの処理中に起動されます。
16601105これらのメソッドは、C<LWP::UserAgent> のサブクラスが振る舞いを
16611106オーバーライドしたいかもしれないので、ここで記述されています。
16621107
16631108=over
16641109
16651110=item $ua->prepare_request( $request )
16661111
16671112=begin original
16681113
16691114This method is invoked by simple_request(). Its task is to modify the
16701115given $request object by setting up various headers based on the
16711116attributes of the user agent. The return value should normally be the
16721117$request object passed in. If a different request object is returned
16731118it will be the one actually processed.
16741119
16751120=end original
16761121
16771122このメソッドは simple_request() によって起動されます。
16781123その使命は、与えられた $request オブジェクトを、ユーザエージェントの
16791124属性によって様々なヘッダを設定することで変更することです。
16801125返り値は通常は渡された $request オブジェクトです。
16811126異なる request オブジェクトが返された場合、それは実際に処理されたものです。
16821127
16831128=begin original
16841129
16851130The headers affected by the base implementation are; "User-Agent",
16861131"From", "Range" and "Cookie".
16871132
16881133=end original
16891134
16901135基本実装によって影響を受けるヘッダは、
16911136"User-Agent", "From", "Range", "Cookie" です。
16921137
16931138=item $ua->redirect_ok( $prospective_request, $response )
16941139
16951140=begin original
16961141
16971142This method is called by request() before it tries to follow a
16981143redirection to the request in $response. This should return a TRUE
16991144value if this redirection is permissible. The $prospective_request
17001145will be the request to be sent if this method returns TRUE.
17011146
17021147=end original
17031148
17041149このメソッドは、$response のリクエストのリダイレクトに
17051150従おうとする前に、request() によって呼ばれます。
17061151このリダイレクトを許可する場合には真の値を返します。
17071152$prospective_request は、このメソッドが真を返した場合に
17081153送信されるリクエストです。
17091154
17101155=begin original
17111156
17121157The base implementation will return FALSE unless the method
17131158is in the object's C<requests_redirectable> list,
17141159FALSE if the proposed redirection is to a "file://..."
17151160URL, and TRUE otherwise.
17161161
17171162=end original
17181163
17191164基本実装では、メソッドがそのオブジェクトの C<requests_redirectable> リストに
17201165ない場合と、予定されているリダイレクトが "file://..." URL の場合に
17211166偽を返し、それ以外では真を返します。
17221167
17231168=item $ua->get_basic_credentials( $realm, $uri, $isproxy )
17241169
17251170=begin original
17261171
17271172This is called by request() to retrieve credentials for documents
17281173protected by Basic or Digest Authentication. The arguments passed in
17291174is the $realm provided by the server, the $uri requested and a boolean
17301175flag to indicate if this is authentication against a proxy server.
17311176
17321177=end original
17331178
17341179基本認証またはダイジェスト認証により保護されている文書のための
17351180証明物 (credentials) の取得のために request() によって呼ばれます。
17361181渡される引数は、$realm がサーバから提供されるレルム、
17371182$uri がリクエストされる URI、$isproxy がこれがプロキシサーバーに
17381183対する認証かどうかを示す真偽値フラグです。
17391184
17401185=begin original
17411186
17421187The method should return a username and password. It should return an
17431188empty list to abort the authentication resolution attempt. Subclasses
17441189can override this method to prompt the user for the information. An
17451190example of this can be found in C<lwp-request> program distributed
17461191with this library.
17471192
17481193=end original
17491194
17501195このメソッドはユーザ名とパスワードを返します。
17511196認証解決の試みを中断させるためには空リストを返します。
17521197サブクラスはユーザに情報を尋ねるためにこのモジュールを上書きできます。
17531198この例はこのライブラリと一緒に配布される
17541199C<lwp-request> プログラムにあります。
17551200
17561201=begin original
17571202
17581203The base implementation simply checks a set of pre-stored member
17591204variables, set up with the credentials() method.
17601205
17611206=end original
17621207
17631208基本実装は単にあらかじめ保管されているメンバ変数をチェックし、
17641209credentials() メソッドを設定します。
17651210
17661211=item $ua->progress( $status, $request_or_response )
17671212
17681213=begin original
17691214
17701215This is called frequently as the response is received regardless of
17711216how the content is processed. The method is called with $status
17721217"begin" at the start of processing the request and with $state "end"
17731218before the request method returns. In between these $status will be
17741219the fraction of the response currently received or the string "tick"
17751220if the fraction can't be calculated.
17761221
17771222=end original
17781223
17791224これは、内容がどのように処理されるかにかかわらず、レスポンスを
17801225受信する度に呼び出されます。
17811226このメソッドは、リクエストの処理開始時には
17821227$status に "begin" を設定して呼び出され、
17831228リクエストメソッドが返る前には $status に "end" を設定して呼び出されます。
17841229その間では、$status は現在受信したレスポンスの割合か、
17851230割合が計算できない場合は文字列 "tick" です。
17861231
17871232=begin original
17881233
17891234When $status is "begin" the second argument is the request object,
17901235otherwise it is the response object.
17911236
17921237=end original
17931238
179412392 番目の引数は、$status が "begin" の場合はリクエストオブジェクトで、
17951240そうでない場合はレスポンスオブジェクトです。
17961241
17971242=back
17981243
17991244=head1 SEE ALSO
18001245
18011246=begin original
18021247
18031248See L<LWP> for a complete overview of libwww-perl5. See L<lwpcook>
18041249and the scripts F<lwp-request> and F<lwp-download> for examples of
18051250usage.
18061251
18071252=end original
18081253
18091254libwww-perl5 の完全な概要は L<LWP> を参照してください。
18101255使い方の例については、L<lwpcook> および
18111256F<lwp-request> と F<lwp-mirror> のスクリプトを参照してください。
18121257
18131258=begin original
18141259
18151260See L<HTTP::Request> and L<HTTP::Response> for a description of the
18161261message objects dispatched and received. See L<HTTP::Request::Common>
18171262and L<HTML::Form> for other ways to build request objects.
18181263
18191264=end original
18201265
18211266発行したり受信したりするメッセージオブジェクトの記述については
18221267L<HTTP::Request> と L<HTTP::Response> を参照してください。
18231268リクエストオブジェクトを構築するその他の方法については
18241269L<HTTP::Request::Common> と L<HTML::Form> を参照してください。
18251270
18261271=begin original
18271272
18281273See L<WWW::Mechanize> and L<WWW::Search> for examples of more
18291274specialized user agents based on C<LWP::UserAgent>.
18301275
18311276=end original
18321277
18331278C<LWP::UserAgent> を基とした、より特殊化したユーザエージェントの例については
18341279L<WWW::Mechanize> と L<WWW::Search> を参照してください。
18351280
18361281=head1 COPYRIGHT
18371282
1838Copyright 1995-2009 Gisle Aas.
1283Copyright 1995-2008 Gisle Aas.
18391284
18401285This library is free software; you can redistribute it and/or
18411286modify it under the same terms as Perl itself.
18421287
1843
18441288=begin meta
18451289
1846Translate: Hippo2000 <GCD00051@nifty.ne.jp> (5.48)
1290Translated: Hippo2000 <GCD00051@nifty.ne.jp> (5.48)
1847Update: SHIRAKATA Kentaro <argrath@ub32.org> (5.813-)
1291Updated: Kentaro SHIRAKATA <argrath@ub32.org> (5.813)
1848Status: completed
18491292
18501293=end meta