/
UserAgent.pod
1851 lines (1221 loc) · 54.5 KB
/
UserAgent.pod
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
=encoding euc-jp
=head1 NAME
=begin original
LWP::UserAgent - Web user agent class
=end original
LWP::UserAgent - Web ユーザエージェントクラス
=head1 SYNOPSIS
require LWP::UserAgent;
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
my $response = $ua->get('http://search.cpan.org/');
if ($response->is_success) {
print $response->decoded_content; # or whatever
}
else {
die $response->status_line;
}
=head1 DESCRIPTION
=begin original
The C<LWP::UserAgent> is a class implementing a web user agent.
C<LWP::UserAgent> objects can be used to dispatch web requests.
=end original
C<LWP::UserAgent> は web ユーザエージェントを実装するクラスです。
C<LWP::UserAgent> オブジェクトは web リクエストを発行(dispatch)するために
使えます。
=begin original
In normal use the application creates an C<LWP::UserAgent> object, and
then configures it with values for timeouts, proxies, name, etc. It
then creates an instance of C<HTTP::Request> for the request that
needs to be performed. This request is then passed to one of the
request method the UserAgent, which dispatches it using the relevant
protocol, and returns a C<HTTP::Response> object. There are
convenience methods for sending the most common request types: get(),
head(), post(), put() and delete(). When using these methods then the
creation of the request object is hidden as shown in the synopsis above.
=end original
通常の使用では、アプリケーションは C<LWP::UserAgent> クラスを作成し、
タイムアウト、プロキシ、名前などのための値でそれを設定します。
それから実行される必要があるリクエストのために C<HTTP::Request> の
インスタンスを作成します。
そしてこのリクエストは UserAgent のリクエストメソッドの一つに渡されます;
これは対応するプロトコルを使ってそれを発行し、
C<HTTP::Response> オブジェクトを返します。
もっとも一般的なリクエスト型のための便利メソッド get(), head(), post(),
put(), delete() があります。
これらのメソッドを使うときは、上述の用例の通り、
リクエストオブジェクトの作成は隠蔽されます。
=begin original
The basic approach of the library is to use HTTP style communication
for all protocol schemes. This means that you will construct
C<HTTP::Request> objects and receive C<HTTP::Response> objects even
for non-HTTP resources like I<gopher> and I<ftp>. In order to achieve
even more similarity to HTTP style communications, gopher menus and
file directories are converted to HTML documents.
=end original
このライブラリの基本的なアプローチは、HTTP 式通信をすべての
プロトコルスキームに使うことです。
つまり I<gopher> や I<ftp> のような非 HTTP リソースでも
C<HTTP::Request> オブジェクトを構築して
C<HTTP::Response> オブジェクトを受け取るということです。
より HTTP 式通信に似せるため、gopher メニューとファイルディレクトリは
HTML ドキュメントに変換されます。
=head1 CONSTRUCTOR METHODS
(コンストラクタメソッド)
=begin original
The following constructor methods are available:
=end original
以下のコンストラクタメソッドが利用可能です:
=over 4
=item $ua = LWP::UserAgent->new( %options )
=begin original
This method constructs a new C<LWP::UserAgent> object and returns it.
Key/value pair arguments may be provided to set up the initial state.
The following options correspond to attribute methods described below:
=end original
このメソッドは新しい C<LWP::UserAgent> オブジェクトを構成して、それを
返します。
初期状態を設定するためにキー-値のペアの引数を指定できます。
以下のオプションは後述する属性メソッドに対応します:
KEY DEFAULT
----------- --------------------
agent "libwww-perl/#.###"
from undef
conn_cache undef
cookie_jar undef
default_headers HTTP::Headers->new
local_address undef
ssl_opts { verify_hostname => 1 }
max_size undef
max_redirect 7
parse_head 1
protocols_allowed undef
protocols_forbidden undef
requests_redirectable ['GET', 'HEAD']
timeout 180
=begin original
The following additional options are also accepted: If the C<env_proxy> option
is passed in with a TRUE value, then proxy settings are read from environment
variables (see env_proxy() method below). If C<env_proxy> isn't provided the
C<PERL_LWP_ENV_PROXY> environment variable controls if env_proxy() is called
during initalization. If the C<keep_alive> option is passed in, then a
C<LWP::ConnCache> is set up (see conn_cache() method below). The C<keep_alive>
value is passed on as the C<total_capacity> for the connection cache.
=end original
以下の追加のオプションも指定できます:
C<env_proxy> オプションが真の値とともに渡されると、プロキシセッティングは
環境変数から読み込まれます(後述する env_proxy() メソッドを参照してください)。
C<env_proxy> が提供されない場合、C<PERL_LWP_ENV_PROXY> 環境変数は、
初期化中に env_proxy() が呼び出されるかを制御します。
C<keep_alive> オプションが渡されると、
C<LWP::ConnCache> が設定されます(後述する conn_cache() メソッドを
参照してください)。
C<keep_alive> の値は接続キャッシュのための C<total_capacity> として
渡されます。
=item $ua->clone
=begin original
Returns a copy of the LWP::UserAgent object.
=end original
LWP::UserAgent オブジェクトのコピーを返します。
=back
=head1 ATTRIBUTES
(属性)
=begin original
The settings of the configuration attributes modify the behaviour of the
C<LWP::UserAgent> when it dispatches requests. Most of these can also
be initialized by options passed to the constructor method.
=end original
設定属性は、C<LWP::UserAgent> がリクエストを発行するときの振る舞いを
変更します。
これらのほとんどはコンストラクタメソッドに渡されたオプションによっても
初期化できます。
=begin original
The following attribute methods are provided. The attribute value is
left unchanged if no argument is given. The return value from each
method is the old attribute value.
=end original
以下の属性メソッドが提供されています。
引数がない場合は属性値は変更されません。
それぞれのメソッドの返り値は古い属性値です。
=over
=item $ua->agent
=item $ua->agent( $product_id )
=begin original
Get/set the product token that is used to identify the user agent on
the network. The agent value is sent as the "User-Agent" header in
the requests. The default is the string returned by the _agent()
method (see below).
=end original
ネットワーク上でユーザエージェントを識別するために使われる
製品トークン(product token)を取得または設定します。
エージェントの値はリクエストの "User-Agent" ヘッダとして送信されます。
デフォルトは _agent() メソッド(後述)で返される文字列です。
=begin original
If the $product_id ends with space then the _agent() string is
appended to it.
=end original
$product_id が空白で終わっている場合は、その値に _agent() の文字列が
追加されます。
=begin original
The user agent string should be one or more simple product identifiers
with an optional version number separated by the "/" character.
Examples are:
=end original
ユーザエージェント文字列は、オプションで "/" 文字で
区切られたバージョン番号がついた、一つもしくはそれ以上の単純な
製品トークンです。
例を以下に示します:
$ua->agent('Checkbot/0.4 ' . $ua->_agent);
$ua->agent('Checkbot/0.4 '); # same as above
$ua->agent('Mozilla/5.0');
$ua->agent(""); # don't identify
=item $ua->_agent
=begin original
Returns the default agent identifier. This is a string of the form
"libwww-perl/#.###", where "#.###" is substituted with the version number
of this library.
=end original
デフォルトのエージェント識別子を返します。
これは "libwww-perl/#.###" 形式の文字列で、"#.###" はこのライブラリの
バージョン番号で置き換えられます。
=item $ua->from
=item $ua->from( $email_address )
=begin original
Get/set the e-mail address for the human user who controls
the requesting user agent. The address should be machine-usable, as
defined in RFC 822. The C<from> value is send as the "From" header in
the requests. Example:
=end original
リクエストしているユーザエージェントを制御している人間であるユーザの
e-mail アドレスを取得または設定します。
アドレスは RFC で定義されているように、機械で利用できなければなりません。
C<from> の値はリクエストでの "From" ヘッダとして送信されます。
例:
$ua->from('gaas@cpan.org');
=begin original
The default is to not send a "From" header. See the default_headers()
method for the more general interface that allow any header to be defaulted.
=end original
デフォルトでは、"From" ヘッダを送信しません。
任意のヘッダをデフォルトで指定できる、より一般的なインターフェースについては
default_headers() メソッドを参照してください。
=item $ua->cookie_jar
=item $ua->cookie_jar( $cookie_jar_obj )
=begin original
Get/set the cookie jar object to use. The only requirement is that
the cookie jar object must implement the extract_cookies($request) and
add_cookie_header($response) methods. These methods will then be
invoked by the user agent as requests are sent and responses are
received. Normally this will be a C<HTTP::Cookies> object or some
subclass.
=end original
使用するクッキー瓶(cookie jar)オブジェクトを取得または設定します。
唯一の必要条件は、クッキー瓶オブジェクトは
extract_cookies($request) メソッドと add_cookie_header($response) メソッドを
実装している必要があると言うことです。
これらのメソッドは、リクエストが送信されるときとレスポンスが受信されたときに
ユーザエージェントによって起動されます。
通常これは C<HTTP::Cookies> オブジェクトかそのサブクラスです。
=begin original
The default is to have no cookie_jar, i.e. never automatically add
"Cookie" headers to the requests.
=end original
デフォルトではクッキー瓶を使いません;
つまり自動的には "Cookie" ヘッダをリクエストに追加しません。
=begin original
Shortcut: If a reference to a plain hash is passed in as the
$cookie_jar_object, then it is replaced with an instance of
C<HTTP::Cookies> that is initialized based on the hash. This form also
automatically loads the C<HTTP::Cookies> module. It means that:
=end original
短縮形: もし単純なハッシュへのリファレンスが
$cookie_jar_object として渡されると、このハッシュを基にして初期化された
C<HTTP::Cookies> のインスタンスで置き換えられます。
この形式はまた、自動的に C<HTTP::Cookies> モジュールを読み込みます。
つまり、以下のようにすると:
$ua->cookie_jar({ file => "$ENV{HOME}/.cookies.txt" });
=begin original
is really just a shortcut for:
=end original
これは実際には以下の省略形です:
require HTTP::Cookies;
$ua->cookie_jar(HTTP::Cookies->new(file => "$ENV{HOME}/.cookies.txt"));
=item $ua->default_headers
=item $ua->default_headers( $headers_obj )
=begin original
Get/set the headers object that will provide default header values for
any requests sent. By default this will be an empty C<HTTP::Headers>
object.
=end original
任意のレスポンスが送信されるときのデフォルトのヘッダ値を提供する
ヘッダオブジェクトを取得または設定します。
デフォルトではこれは空の C<HTTP::Headers> オブジェクトです。
=item $ua->default_header( $field )
=item $ua->default_header( $field => $value )
=begin original
This is just a short-cut for $ua->default_headers->header( $field =>
$value ). Example:
=end original
これは単に $ua->default_headers->header( $field => $value ) の
短縮形です。
例:
$ua->default_header('Accept-Encoding' => scalar HTTP::Message::decodable());
$ua->default_header('Accept-Language' => "no, en");
=item $ua->conn_cache
=item $ua->conn_cache( $cache_obj )
=begin original
Get/set the C<LWP::ConnCache> object to use. See L<LWP::ConnCache>
for details.
=end original
使用する C<LWP::ConnCache> オブジェクトを取得または設定します。
詳しくは L<LWP::ConnCache> を参照してください。
=item $ua->credentials( $netloc, $realm )
=item $ua->credentials( $netloc, $realm, $uname, $pass )
=begin original
Get/set the user name and password to be used for a realm.
=end original
あるレルムのために使われるユーザ名、パスワードを取得/設定します。
=begin original
The $netloc is a string of the form "<host>:<port>". The username and
password will only be passed to this server. Example:
=end original
$netloc は "<host>:<port>" の形式の文字列です。
ユーザ名とパスワードはこのサーバにのみ渡されます。
例:
$ua->credentials("www.example.com:80", "Some Realm", "foo", "secret");
=item $ua->local_address
=item $ua->local_address( $address )
=begin original
Get/set the local interface to bind to for network connections. The interface
can be specified as a hostname or an IP address. This value is passed as the
C<LocalAddr> argument to L<IO::Socket::INET>.
=end original
ネットワーク接続のために bind するローカルインターフェースを取得/設定します。
インターフェースはホスト名または IP アドレスとして指定できます。
この値は L<IO::Socket::INET> に C<LocalAddr> 引数として渡されます。
=item $ua->max_size
=item $ua->max_size( $bytes )
=begin original
Get/set the size limit for response content. The default is C<undef>,
which means that there is no limit. If the returned response content
is only partial, because the size limit was exceeded, then a
"Client-Aborted" header will be added to the response. The content
might end up longer than C<max_size> as we abort once appending a
chunk of data makes the length exceed the limit. The "Content-Length"
header, if present, will indicate the length of the full content and
will normally not be the same as C<< length($res->content) >>.
=end original
レスポンスの内容(content)の大きさの制限を取得または設定します。
デフォルトは C<undef> で、これは制限なしを意味します。
長さの制限を越えているために、戻されたレスポンスの内容が
一部だけであれば、"Client-Aborted" ヘッダがレスポンスに追加されます。
内容の長さが制限を超えることになるデータの固まりに追加するのを
中断するので、内容の長さは結局 C<max_size> を
超えることになることがあります。
もし "Content-Length" ヘッダがあれば、内容全体の長さを示していて、
これは通常は C<< length($res->content) >> と同じではありません。
=item $ua->max_redirect
=item $ua->max_redirect( $n )
=begin original
This reads or sets the object's limit of how many times it will obey
redirection responses in a given request cycle.
=end original
これは、1 回のリクエストで従うリダイレクトレスポンスの
回数の制限を読み込みまたは設定します。
=begin original
By default, the value is 7. This means that if you call request()
method and the response is a redirect elsewhere which is in turn a
redirect, and so on seven times, then LWP gives up after that seventh
request.
=end original
デフォルトでは、この値は 7 です。
これは、request() を呼び出して、リダイレクトされた先でさらに
リダイレクトされて、というのを 7 回繰り返すと、LWP は 7 回目の
リクエストの後に諦めます。
=item $ua->parse_head
=item $ua->parse_head( $boolean )
=begin original
Get/set a value indicating whether we should initialize response
headers from the E<lt>head> section of HTML documents. The default is
TRUE. Do not turn this off, unless you know what you are doing.
=end original
HTML ドキュメントの E<lt>head> セクションからレスポンスヘッダを
初期化すべきかどうかを示す値を取得または設定します。
デフォルトは TRUE です。
何をしているのかわからなければ、これをオフにしないで下さい。
=item $ua->protocols_allowed
=item $ua->protocols_allowed( \@protocols )
=begin original
This reads (or sets) this user agent's list of protocols that the
request methods will exclusively allow. The protocol names are case
insensitive.
=end original
これはこのユーザエージェントが排他的に許可されているプロトコルのリストを
読み込み(または設定)します。
プロトコル名は大文字小文字を無視します。
=begin original
For example: C<$ua-E<gt>protocols_allowed( [ 'http', 'https'] );>
means that this user agent will I<allow only> those protocols,
and attempts to use this user agent to access URLs with any other
schemes (like "ftp://...") will result in a 500 error.
=end original
例: C<$ua-E<gt>protocols_allowed( [ 'http', 'https'] );> というのは、
このユーザエージェントはこれらのプロトコル I<のみ許可されている> ことを
意味していて、このユーザエージェントが ("ftp://..." のような) その他の
スキームの URL にアクセスしようとすると 500 エラーとなります。
=begin original
To delete the list, call: C<$ua-E<gt>protocols_allowed(undef)>
=end original
リストを削除するには、以下のように呼び出します: C<$ua-E<gt>protocols_allowed(undef)>
=begin original
By default, an object has neither a C<protocols_allowed> list, nor a
C<protocols_forbidden> list.
=end original
デフォルトでは、オブジェクトは C<protocols_allowed> リストと
C<protocols_forbidden> リストのどちらも持ちません。
=begin original
Note that having a C<protocols_allowed> list causes any
C<protocols_forbidden> list to be ignored.
=end original
C<protocols_allowed> リストがあると C<protocols_forbidden> リストは
無視されることに注意してください。
=item $ua->protocols_forbidden
=item $ua->protocols_forbidden( \@protocols )
=begin original
This reads (or sets) this user agent's list of protocols that the
request method will I<not> allow. The protocol names are case
insensitive.
=end original
これはこのユーザエージェントが I<許可されていない> プロトコルのリストを
読み込み(または設定)します。
プロトコル名は大文字小文字を無視します。
=begin original
For example: C<$ua-E<gt>protocols_forbidden( [ 'file', 'mailto'] );>
means that this user agent will I<not> allow those protocols, and
attempts to use this user agent to access URLs with those schemes
will result in a 500 error.
=end original
例: C<$ua-E<gt>protocols_forbidden( [ 'file', 'mailto'] );> は
このユーザエージェントはこれらのプロトコルを I<許可せず>、
このユーザエージェントを使ってこれらのスキーマで URL に
アクセスしようとすると 500 エラーになります。
=begin original
To delete the list, call: C<$ua-E<gt>protocols_forbidden(undef)>
=end original
リストを削除するには、このように呼び出します: C<$ua-E<gt>protocols_forbidden(undef)>
=item $ua->requests_redirectable
=item $ua->requests_redirectable( \@requests )
=begin original
This reads or sets the object's list of request names that
C<$ua-E<gt>redirect_ok(...)> will allow redirection for. By
default, this is C<['GET', 'HEAD']>, as per RFC 2616. To
change to include 'POST', consider:
=end original
これは C<$ua-E<gt>redirect_ok(...)> がリダイレクトを許可する
リクエスト名のリストを読み込みまたは設定します。
デフォルトでは、これは RFC 2616 に従って C<['GET', 'HEAD']> になっています。
'POST' を含むようにするには、以下のようにします:
push @{ $ua->requests_redirectable }, 'POST';
=item $ua->show_progress
=item $ua->show_progress( $boolean )
=begin original
Get/set a value indicating whether a progress bar should be displayed
on on the terminal as requests are processed. The default is FALSE.
=end original
リクエストの処理時に端末にプログレスバーを表示するかどうかを示す
値を取得/設定します。
デフォルトは偽です。
=item $ua->timeout
=item $ua->timeout( $secs )
=begin original
Get/set the timeout value in seconds. The default timeout() value is
180 seconds, i.e. 3 minutes.
=end original
秒単位のタイムアウト値を取得または設定します。
デフォルトの timeout() の値は 180 秒、つまり 3 分です。
=begin original
The requests is aborted if no activity on the connection to the server
is observed for C<timeout> seconds. This means that the time it takes
for the complete transaction and the request() method to actually
return might be longer.
=end original
サーバへの接続において C<timeout> 秒反応がないと、リクエストは中断します。
つまり、トランザクションが完了して request() メソッドが実際に返るまでの
時間を意味します。
=item $ua->ssl_opts
=item $ua->ssl_opts( $key )
=item $ua->ssl_opts( $key => $value )
=begin original
Get/set the options for SSL connections. Without argument return the list
of options keys currently set. With a single argument return the current
value for the given option. With 2 arguments set the option value and return
the old. Setting an option to the value C<undef> removes this option.
=end original
SSL 接続のオプションを取得/設定します。
引数なしの場合、現在設定されているオプションキーの一覧を返します。
1 引数の場合、与えられたオプションの現在の値を返します。
2 引数の場合、オプションの値を設定して、古いものを返します。
オプションとして C<undef> 値を設定すると、このオプションを削除します。
=begin original
The options that LWP relates to are:
=end original
LWP に関するオプションは:
=over
=item C<verify_hostname> => $bool
=begin original
When TRUE LWP will for secure protocol schemes ensure it connects to servers
that have a valid certificate matching the expected hostname. If FALSE no
checks are made and you can't be sure that you communicate with the expected peer.
The no checks behaviour was the default for libwww-perl-5.837 and earlier releases.
=end original
真の場合、LWP は、セキュアなプロトコルスキームで、
妥当な証明書が想定されるホスト名に一致しているサーバに
接続していることを確認します。
偽の場合、チェックは行われず、想定している接続先と通信しているかを
確認できません。
チェックしない振る舞いは、libwww-perl-5.837 以前のリリースのデフォルトでした。
=begin original
This option is initialized from the L<PERL_LWP_SSL_VERIFY_HOSTNAME> environment
variable. If this environment variable isn't set; then C<verify_hostname>
defaults to 1.
=end original
このオプションは L<PERL_LWP_SSL_VERIFY_HOSTNAME> 環境変数で初期化されます。
環境変数が設定されていない場合、C<verify_hostname> のデフォルトは 1 です。
=item C<SSL_ca_file> => $path
=begin original
The path to a file containing Certificate Authority certificates.
A default setting for this option is provided by checking the environment
variables C<PERL_LWP_SSL_CA_FILE> and C<HTTPS_CA_FILE> in order.
=end original
Certificate Authority 証明書があるファイルのパス。
このオプションのデフォルト設定は、環境変数 C<PERL_LWP_SSL_CA_FILE> と
C<HTTPS_CA_FILE> をこの順序でチェックすることで提供されます。
=item C<SSL_ca_path> => $path
=begin original
The path to a directory containing files containing Certificate Authority
certificates.
A default setting for this option is provided by checking the environment
variables C<PERL_LWP_SSL_CA_PATH> and C<HTTPS_CA_DIR> in order.
=end original
Certificate Authority 証明書があるファイルのあるディレクトリへのパス。
このオプションのデフォルト設定は、環境変数 C<PERL_LWP_SSL_CA_PATH> と
C<HTTPS_CA_DIR> をこの順序でチェックすることで提供されます。
=back
=begin original
Other options can be set and are processed directly by the SSL Socket implementation
in use. See L<IO::Socket::SSL> or L<Net::SSL> for details.
=end original
その他のオプションは、使っている SSL Socket 実装によって直接設定および
処理されます。
詳しくは L<IO::Socket::SSL> や L<Net::SSL> を参照してください。
=begin original
The libwww-perl core no longer bundles protocol plugins for SSL. You will need
to install L<LWP::Protocol::https> separately to enable support for processing
https-URLs.
=end original
libwww-perl コアはもはや SSL のためのプロトコルプラグインを同梱しません。
https-URL の処理の対応を有効にするために、個別に
L<LWP::Protocol::https> をインストールする必要があります。
=back
=head2 Proxy attributes
(プロキシ属性)
=begin original
The following methods set up when requests should be passed via a
proxy server.
=end original
以下のメソッドはプロキシサーバー経由で渡されるべきリクエストを設定します。
=over
=item $ua->proxy(\@schemes, $proxy_url)
=item $ua->proxy($scheme, $proxy_url)
=begin original
Set/retrieve proxy URL for a scheme:
=end original
あるスキームのためのプロキシ URL を設定または取得します:
$ua->proxy(['http', 'ftp'], 'http://proxy.sn.no:8001/');
$ua->proxy('gopher', 'http://proxy.sn.no:8001/');
=begin original
The first form specifies that the URL is to be used for proxying of
access methods listed in the list in the first method argument,
i.e. 'http' and 'ftp'.
=end original
最初の形式はその URL がメソッドの最初に引数のリストに入っている
アクセスメソッド、つまり 'http' と 'ftp' のプロキシのために
使われることを指定します。
=begin original
The second form shows a shorthand form for specifying
proxy URL for a single access scheme.
=end original
2 番目の形式は一つのアクセス機能のためのプロキシ URL を
指定するための短縮した形式を示しています。
=item $ua->no_proxy( $domain, ... )
=begin original
Do not proxy requests to the given domains. Calling no_proxy without
any domains clears the list of domains. Eg:
=end original
与えられたドメインへのリクエストをプロキシしません。
何もドメインを指定しないで no_proxy を呼ぶと、ドメインのリストを
クリアします。
例:
$ua->no_proxy('localhost', 'example.com');
=item $ua->env_proxy
=begin original
Load proxy settings from *_proxy environment variables. You might
specify proxies like this (sh-syntax):
=end original
*_proxy 環境変数からプロキシ設定をロードします。
以下のように指定できるでしょう(sh での書き方):
gopher_proxy=http://proxy.my.place/
wais_proxy=http://proxy.my.place/
no_proxy="localhost,example.com"
export gopher_proxy wais_proxy no_proxy
=begin original
csh or tcsh users should use the C<setenv> command to define these
environment variables.
=end original
csh または tcsh のユーザは、これらの環境変数を定義するために
C<setenv> コマンドを使わなければなりません。
=begin original
On systems with case insensitive environment variables there exists a
name clash between the CGI environment variables and the C<HTTP_PROXY>
environment variable normally picked up by env_proxy(). Because of
this C<HTTP_PROXY> is not honored for CGI scripts. The
C<CGI_HTTP_PROXY> environment variable can be used instead.
=end original
環境変数名に大文字小文字の区別がないシステムでは、
CGI 環境変数と、通常 env_proxy() によって読み込まれる C<HTTP_PROXY>
環境変数の間で名前の衝突があります。
この理由により、C<HTTP_PROXY> は CGI スクリプトのためのものではありません。
代わりに C<CGI_HTTP_PROXY> 環境変数を使えます。
=back
=head2 Handlers
(ハンドラ)
=begin original
Handlers are code that injected at various phases during the
processing of requests. The following methods are provided to manage
the active handlers:
=end original
ハンドラは、リクエストの処理中の様々なフェーズに注入されるコードです。
アクティブなハンドラを管理するために次のメソッドが提供されています:
=over
=item $ua->add_handler( $phase => \&cb, %matchspec )
=begin original
Add handler to be invoked in the given processing phase. For how to
specify %matchspec see L<HTTP::Config/"Matching">.
=end original
指定された処理フェーズで起動されるハンドラを追加します。
%matchspec の指定方法については L<HTTP::Config/"Matching"> を
参照してください。
=begin original
The possible values $phase and the corresponding callback signatures are:
=end original
取り得る $phase の値と、対応するコールバックのシグネチャは:
=over
=item request_preprepare => sub { my($request, $ua, $h) = @_; ... }
=begin original
The handler is called before the C<request_prepare> and other standard
initialization of of the request. This can be used to set up headers
and attributes that the C<request_prepare> handler depends on. Proxy
initialization should take place here; but in general don't register
handlers for this phase.
=end original
ハンドラは、C<request_prepare> とその他のリクエストの標準的な初期化の
前に呼び出されます。
これは C<request_prepare> ハンドラが依存するヘッダと属性を
設定するのに使えます。
プロキシ初期化はここに置く必要があります;
しかし一般的にはこのフェーズにハンドルを登録しないでください。
=item request_prepare => sub { my($request, $ua, $h) = @_; ... }
=begin original
The handler is called before the request is sent and can modify the
request any way it see fit. This can for instance be used to add
certain headers to specific requests.
=end original
ハンドラは、リクエストを送信する前に呼び出され、
適合するならどのような形でもリクエストを変更できます。
これは例えば特定のリクエストにある種のヘッダを追加するのに使えます。
=begin original
The method can assign a new request object to $_[0] to replace the
request that is sent fully.
=end original
メソッドは、送られるリクエストを完全に置き換えるために、
$_[0] に新しいリクエストオブジェクトを代入できます。
=begin original
The return value from the callback is ignored. If an exception is
raised it will abort the request and make the request method return a
"400 Bad request" response.
=end original
コールバックからの返り値は無視されます。
例外が発生すると、リクエストを中止して、
リクエストメソッドは "400 Bad request" レスポンスを返します。
=item request_send => sub { my($request, $ua, $h) = @_; ... }
=begin original