オープンソース・ソフトウェアの開発とダウンロード

CVS リポジトリの参照

Contents of /perldocjp/docs/modules/Net-SSLeay-1.20/SSLeay/Handle.pod

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download)
Tue Feb 28 17:54:19 2023 UTC (14 months, 3 weeks ago) by argrath
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +143 -12 lines
add original

1
2 =encoding euc-jp
3
4 =head1 NAME
5
6 =begin original
7
8 Net::SSLeay::Handle - Perl module that lets SSL (HTTPS) sockets be
9 handled as standard file handles.
10
11 =end original
12
13 Net::SSLeay::Handle - SSL (HTTPS)ソケットを標準のファイルハンドルとして
14 扱わせるPerlモジュール
15
16 =head1 SYNOPSIS
17
18 use Net::SSLeay::Handle qw/shutdown/;
19 my ($host, $port) = ("localhost", 443);
20
21 tie(*SSL, "Net::SSLeay::Handle", $host, $port);
22
23 print SSL "GET / HTTP/1.0\r\n";
24 shutdown(\*SSL, 1);
25 print while (<SSL>);
26 close SSL;
27
28
29 =head1 DESCRIPTION
30
31 =begin original
32
33 Net::SSLeay::Handle allows you to request and receive HTTPS web pages
34 using "old-fashion" file handles as in:
35
36 =end original
37
38 Net::SSLeay::HandleはHTTPS webページを"昔ながらの"ファイルハンドルを
39 使って以下のように、リクエストしたり、受け取ることを可能にします:
40
41 print SSL "GET / HTTP/1.0\r\n";
42
43 =begin original
44
45 and
46
47 =end original
48
49 そして
50
51 print while (<SSL>);
52
53 =begin original
54
55 If you export the shutdown routine, then the only extra code that
56 you need to add to your program is the tie function as in:
57
58 =end original
59
60 shutdownルーチンをエクスポートすると、あなたのプログラムに追加する
61 必要がある特別なコードは、以下のようなtie関数だけになります:
62
63 my $socket;
64 if ($scheme eq "https") {
65 tie(*S2, "Net::SSLeay::Handle", host, $port);
66 $socket = \*S2;
67 else {
68 $socket = Net::SSLeay::Handle->make_socket(host, $port);
69 }
70 print $socket $request_headers;
71 ...
72
73 =head2 USING EXISTING SOCKETS
74
75 (既存のソケットを利用する)
76
77 =begin original
78
79 One of the motivations for writing this module was to avoid
80 duplicating socket creation code (which is mostly error handling).
81 The calls to tie() above where it is passed a $host and $port is
82 provided for convenience testing. If you already have a socket
83 connected to the right host and port, S1, then you can do something
84 like:
85
86 =end original
87
88 このモジュールを作った動機の一つは、ソケットを作るコードが重複する
89 ことを避けることでした(そのほとんどはエラーの取り扱いになります)。
90 上記の$hostと$portが渡されるところでtie()を呼び出すことは、
91 便宜上、テストのために提供されています。正しいホストとポートに
92 接続されたソケットS1を既に持っているのであれば、以下のように
93 することができます:
94
95 my $socket \*S1;
96 if ($scheme eq "https") {
97 tie(*S2, "Net::SSLeay::Handle", $socket);
98 $socket = \*S2;
99 }
100 my $last_sel = select($socket); $| = 1; select($last_sel);
101 print $socket $request_headers;
102 ...
103
104 =begin original
105
106 Note: As far as I know you must be careful with the globs in the tie()
107 function. The first parameter must be a glob (*SOMETHING) and the
108 last parameter must be a reference to a glob (\*SOMETHING_ELSE) or a
109 scaler that was assigned to a reference to a glob (as in the example
110 above)
111
112 =end original
113
114 注意: 私が知る限り、tie()関数ではグロブの取り扱いには注意しなければ
115 なりません。最初のパラメータはグロブ(*SOMETHING)でなければなりません。
116 そして最後のパラメータはグロブへのリファレンス(\*SOMETHING_ELSE)あるいは
117 (上記の例のように)グロブへのリファレンスが代入されたスカラーでなければ
118 なりません。
119
120 =begin original
121
122 Also, the two globs must be different. When I tried to use the same
123 glob, I got a core dump.
124
125 =end original
126
127 また2つのグロブは違うものでなければなりません。私が同じグロブを使おうと
128 したときには、コアダンプになりました。
129
130 =head2 EXPORT
131
132 =begin original
133
134 None by default.
135
136 =end original
137
138 デフォルトでは何もありません。
139
140 =begin original
141
142 You can export the shutdown() function.
143
144 =end original
145
146 shutodown()関数をエクスポートすることができます。
147
148 =begin original
149
150 It is suggested that you do export shutdown() or use the fully
151 qualified Net::SSLeay::Handle::shutdown() function to shutdown SSL
152 sockets. It should be smart enough to distinguish between SSL and
153 non-SSL sockets and do the right thing.
154
155 =end original
156
157 SSLソケットをシャットダウンするためには、shutdown()をエスクポートするか、
158 完全に修飾されたNet::SSLeay::Handle::shutdown()関数を使うことを提案します。
159 SSLと非SSLソケットを区別し、正しいことを行うのに十分スマートです。
160
161 =head1 EXAMPLES
162
163 use Net::SSLeay::Handle qw/shutdown/;
164 my ($host, $port) = ("localhost", 443);
165
166 tie(*SSL, "Net::SSLeay::Handle", $host, $port);
167
168 print SSL "GET / HTTP/1.0\r\n";
169 shutdown(\*SSL, 1);
170 print while (<SSL>);
171 close SSL;
172
173 =head1 TODO
174
175 =begin original
176
177 Better error handling. Callback routine?
178
179 =end original
180
181 よりよいエラーの取り扱い、コールバックルーチン?
182
183 =head1 CAVEATS
184
185 =begin original
186
187 Tying to a file handle is a little tricky (for me at least).
188
189 =end original
190
191 ファイルハンドルを使おうとすることは少しトリッキーです(少なくとも私にとっては)。
192
193 =begin original
194
195 The first parameter to tie() must be a glob (*SOMETHING) and the last
196 parameter must be a reference to a glob (\*SOMETHING_ELSE) or a scaler
197 that was assigned to a reference to a glob ($s = \*SOMETHING_ELSE).
198 Also, the two globs must be different. When I tried to use the same
199 glob, I got a core dump.
200
201 =end original
202
203 tie()への最初のパラメータはグロブ(*SOMETHING)で、最後のパラメータは
204 グロブへのリファレンス(\*SOMETHING_ELSE)か、グロブへのリファレンスが
205 代入されたスカラー($s = \*SOMETHING_ELSE)でなければなりません。
206 また2つのグロブは違うものでなければなりません。私が同じグロブを使おうと
207 したときには、コアダンプになりました。
208
209 =begin original
210
211 I was able to associate attributes to globs created by this module
212 (like *SSL above) by making a hash of hashes keyed by the file head1.
213
214 =end original
215
216 ファイルヘッド1によりキーが付けられたハッシュのハッシュを作ることにより、
217 このモジュールにより作成されたグロブに属性を関連付けることができました
218 (上記の*SSLのように)。
219
220 =begin original
221
222 Support for old perls may not be 100%. If in trouble try 5.6.0 or
223 newer.
224
225 =end original
226
227 古いperlのサポートは100%ではないかもしれません。障害時には5.6.0以上を
228 お試しください。
229
230 =head1 CHANGES
231
232 =begin original
233
234 Please see Net-SSLeay-Handle-0.50/Changes file.
235
236 =end original
237
238 Net-SSLeay-Handle-0.50/Changesファイルをご覧ください。
239
240 =head1 KNOWN BUGS
241
242 =begin original
243
244 If you let this module construct sockets for you with Perl versions
245 below v.5.6 then there is a slight memory leak. Other upgrade your
246 Perl, or create the sockets yourself. The leak was created to let
247 these older versions of Perl access more than one Handle at a time.
248
249 =end original
250
251 Perlバージョンv5.6以前で、このモジュールにあなた用のソケットを作る
252 よう命令すると、少しメモリリークを起こします。Perlをアップグレードするか、
253 あなた自身でソケットを作成してください。そのリークは、これらの古い
254 バージョンのPerlに同時に1つ以上のハンドルにアクセスさせるために
255 作られます。
256
257 =head1 AUTHOR
258
259 Jim Bowlin jbowlin@linklint.org
260
261 =head1 SEE ALSO
262
263 Net::SSLeay, perl(1), http://openssl.org/
264
265 =cut
266

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26