| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package IO::EPP::Taeping; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf8 |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
IO::EPP::Taeping |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use IO::EPP::Taeping; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Parameters for LWP |
|
14
|
|
|
|
|
|
|
my %sock_params = ( |
|
15
|
|
|
|
|
|
|
PeerHost => 'epp.nic.net.ru', |
|
16
|
|
|
|
|
|
|
PeerPort => 7080, |
|
17
|
|
|
|
|
|
|
SSL_key_file => 'key_file.pem', |
|
18
|
|
|
|
|
|
|
SSL_cert_file => 'cert_file.pem', |
|
19
|
|
|
|
|
|
|
LocalAddr => '1.2.3.4', |
|
20
|
|
|
|
|
|
|
Timeout => 30, |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Create object, get greeting and call login() |
|
24
|
|
|
|
|
|
|
my $conn = IO::EPP::Taeping->new( { |
|
25
|
|
|
|
|
|
|
user => 'XXX-3LVL', |
|
26
|
|
|
|
|
|
|
pass => 'XXXXXXXX', |
|
27
|
|
|
|
|
|
|
sock_params => \%sock_params, |
|
28
|
|
|
|
|
|
|
test_mode => 0, # real connect |
|
29
|
|
|
|
|
|
|
} ); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Check domain |
|
32
|
|
|
|
|
|
|
my ( $answ, $code, $msg ) = $conn->check_domains( { domains => [ 'my.pp.ru', 'my.org.ru' ] } ); |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# Call logout() and destroy object |
|
35
|
|
|
|
|
|
|
undef $conn; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Module overwrites IO::EPP::RIPN where there are differences |
|
41
|
|
|
|
|
|
|
and work with tcinet epp using http api |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Previously 3lvl.ru domains were serviced by TCI, but then were transferred to a separate registry, which has small differences |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
For details see: |
|
46
|
|
|
|
|
|
|
L |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
All documents -- L |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
IO::EPP::Taeping works with .net.ru, .org.ru & .pp.ru only |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Domain transfer in these zones works as in the .su tld |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
|
55
|
|
|
|
|
|
|
|
|
56
|
1
|
|
|
1
|
|
2016
|
use IO::Socket::SSL; |
|
|
1
|
|
|
|
|
70532
|
|
|
|
1
|
|
|
|
|
9
|
|
|
57
|
1
|
|
|
1
|
|
751
|
use LWP::UserAgent; |
|
|
1
|
|
|
|
|
41310
|
|
|
|
1
|
|
|
|
|
38
|
|
|
58
|
1
|
|
|
1
|
|
10
|
use HTTP::Request; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
24
|
|
|
59
|
1
|
|
|
1
|
|
585
|
use HTTP::Cookies; |
|
|
1
|
|
|
|
|
6003
|
|
|
|
1
|
|
|
|
|
34
|
|
|
60
|
1
|
|
|
1
|
|
431
|
use Time::HiRes qw( time ); |
|
|
1
|
|
|
|
|
1231
|
|
|
|
1
|
|
|
|
|
8
|
|
|
61
|
|
|
|
|
|
|
|
|
62
|
1
|
|
|
1
|
|
883
|
use IO::EPP::Base; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
49
|
|
|
63
|
1
|
|
|
1
|
|
634
|
use IO::EPP::RIPN; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
43
|
|
|
64
|
1
|
|
|
1
|
|
8
|
use parent qw( IO::EPP::RIPN ); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
5
|
|
|
65
|
|
|
|
|
|
|
|
|
66
|
1
|
|
|
1
|
|
54
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
20
|
|
|
67
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
684
|
|
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub make_request { |
|
71
|
0
|
|
|
0
|
1
|
|
my ( $action, $params ) = @_; |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
#$params = IO::EPP::Base::recursive_utf8_unflaged( $params ); |
|
74
|
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
my ( $code, $msg, $answ, $self ); |
|
76
|
|
|
|
|
|
|
|
|
77
|
0
|
0
|
|
|
|
|
unless ( $params->{conn} ) { |
|
78
|
|
|
|
|
|
|
# Default: |
|
79
|
0
|
|
0
|
|
|
|
$params->{sock_params}{PeerHost} ||= 'epp.nic.net.ru'; |
|
80
|
0
|
|
0
|
|
|
|
$params->{sock_params}{PeerPort} ||= 7080; |
|
81
|
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
( $self, $code, $msg ) = __PACKAGE__->new( $params ); |
|
83
|
|
|
|
|
|
|
|
|
84
|
0
|
0
|
0
|
|
|
|
unless ( $code and $code == 1000 ) { |
|
85
|
0
|
|
|
|
|
|
goto END_MR; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
else { |
|
89
|
0
|
|
|
|
|
|
$self = $params->{conn}; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
$self->{critical_error} = ''; |
|
93
|
|
|
|
|
|
|
|
|
94
|
0
|
0
|
|
|
|
|
if ( $self->can( $action ) ) { |
|
95
|
0
|
|
|
|
|
|
( $answ, $code, $msg ) = $self->$action( $params ); |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
else { |
|
98
|
0
|
|
|
|
|
|
$msg = "undefined command <$action>, request cancelled"; |
|
99
|
0
|
|
|
|
|
|
$code = 0; |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
END_MR: |
|
103
|
|
|
|
|
|
|
|
|
104
|
0
|
0
|
|
|
|
|
$msg .= ', ' . $self->{critical_error} if $self->{critical_error}; |
|
105
|
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
my $full_answ = "code: $code\nmsg: $msg"; |
|
107
|
|
|
|
|
|
|
|
|
108
|
0
|
0
|
0
|
|
|
|
$answ = {} unless $answ && ref $answ; |
|
109
|
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
$answ->{code} = $code; |
|
111
|
0
|
|
|
|
|
|
$answ->{msg} = $msg; |
|
112
|
|
|
|
|
|
|
|
|
113
|
0
|
0
|
|
|
|
|
return wantarray ? ( $answ, $full_answ, $self ) : $answ; |
|
114
|
|
|
|
|
|
|
} |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 METHODS |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
All methods except the ones listed below are completely the same as L |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 new |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Method is rewritten because of verify mode/hostname |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=cut |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub new { |
|
128
|
0
|
|
|
0
|
1
|
|
my ( $package, $params ) = @_; |
|
129
|
|
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
|
my ( $self, $code, $msg ); |
|
131
|
|
|
|
|
|
|
|
|
132
|
0
|
|
|
|
|
|
my $sock_params = delete $params->{sock_params}; |
|
133
|
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
$sock_params->{SSL_verify_mode} = SSL_VERIFY_NONE; # there are no words |
|
135
|
0
|
|
|
|
|
|
$sock_params->{verify_hostname} = 0; |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
# Further all as in the RIPN |
|
138
|
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
my $host = $sock_params->{PeerHost}; |
|
140
|
0
|
|
|
|
|
|
my $port = $sock_params->{PeerPort}; |
|
141
|
0
|
|
|
|
|
|
my $url = "https://$host:$port"; |
|
142
|
0
|
|
|
|
|
|
my $local_address = $sock_params->{LocalAddr}; |
|
143
|
0
|
|
0
|
|
|
|
my $timeout = $sock_params->{Timeout} || 5; |
|
144
|
|
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
|
my %ua_params = ( ssl_opts => $sock_params ); |
|
146
|
0
|
0
|
|
|
|
|
$ua_params{local_address} = $local_address if $local_address; |
|
147
|
|
|
|
|
|
|
|
|
148
|
0
|
0
|
|
|
|
|
if ( $timeout ) { |
|
149
|
|
|
|
|
|
|
# LWP feature: first param for LWP, second - for IO::Socket |
|
150
|
0
|
|
|
|
|
|
$ua_params{timeout} = $timeout; |
|
151
|
0
|
|
|
|
|
|
$ua_params{Timeout} = $timeout; |
|
152
|
|
|
|
|
|
|
} |
|
153
|
|
|
|
|
|
|
|
|
154
|
0
|
|
|
|
|
|
my $cookie; |
|
155
|
0
|
0
|
|
|
|
|
if ( $params->{alien_conn} ) { |
|
156
|
0
|
|
|
|
|
|
$cookie = HTTP::Cookies->new( autosave => 0 ); |
|
157
|
|
|
|
|
|
|
|
|
158
|
0
|
0
|
|
|
|
|
unless ( $cookie->load( $params->{load_cook_from} ) ) { |
|
159
|
0
|
|
|
|
|
|
$msg = "load cooker is fail"; |
|
160
|
0
|
|
|
|
|
|
$code = 0; |
|
161
|
|
|
|
|
|
|
|
|
162
|
0
|
|
|
|
|
|
goto ERR; |
|
163
|
|
|
|
|
|
|
} |
|
164
|
|
|
|
|
|
|
} |
|
165
|
|
|
|
|
|
|
else { |
|
166
|
0
|
|
|
|
|
|
$cookie = HTTP::Cookies->new; |
|
167
|
|
|
|
|
|
|
} |
|
168
|
|
|
|
|
|
|
|
|
169
|
0
|
|
|
|
|
|
my $ua = LWP::UserAgent->new( |
|
170
|
|
|
|
|
|
|
agent => 'EppBot/7.02 (Perl; Linux i686; ru, en_US)', |
|
171
|
|
|
|
|
|
|
parse_head => 0, |
|
172
|
|
|
|
|
|
|
keep_alive => 30, |
|
173
|
|
|
|
|
|
|
cookie_jar => $cookie, |
|
174
|
|
|
|
|
|
|
%ua_params, |
|
175
|
|
|
|
|
|
|
); |
|
176
|
|
|
|
|
|
|
|
|
177
|
0
|
0
|
|
|
|
|
unless ( $ua ) { |
|
178
|
0
|
|
|
|
|
|
$msg = "can not connect"; |
|
179
|
0
|
|
|
|
|
|
$code = 0; |
|
180
|
|
|
|
|
|
|
|
|
181
|
0
|
|
|
|
|
|
goto ERR; |
|
182
|
|
|
|
|
|
|
} |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
$self = bless { |
|
185
|
|
|
|
|
|
|
sock => $ua, |
|
186
|
|
|
|
|
|
|
user => $params->{user}, |
|
187
|
|
|
|
|
|
|
url => $url, |
|
188
|
|
|
|
|
|
|
cookies => $cookie, |
|
189
|
|
|
|
|
|
|
no_logs => delete $params->{no_logs}, |
|
190
|
0
|
0
|
|
|
|
|
alien => $params->{alien_conn} ? 1 : 0, |
|
191
|
|
|
|
|
|
|
}; |
|
192
|
|
|
|
|
|
|
|
|
193
|
0
|
|
|
|
|
|
$self->set_urn(); |
|
194
|
|
|
|
|
|
|
|
|
195
|
0
|
|
|
|
|
|
$self->set_log_vars( $params ); |
|
196
|
|
|
|
|
|
|
|
|
197
|
0
|
0
|
|
|
|
|
if ( $self->{alien} ) { |
|
198
|
0
|
0
|
|
|
|
|
return wantarray ? ( $self, 1000, 'ok' ) : $self; |
|
199
|
|
|
|
|
|
|
} |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
# Get HEADER only |
|
202
|
0
|
|
|
|
|
|
$self->epp_log( "HEAD connect to $url from $local_address" ); |
|
203
|
|
|
|
|
|
|
|
|
204
|
0
|
|
|
|
|
|
my $request = HTTP::Request->new( HEAD => $url ); # не POST |
|
205
|
0
|
|
|
|
|
|
my $response = $ua->request( $request ); |
|
206
|
|
|
|
|
|
|
|
|
207
|
0
|
|
|
|
|
|
my $rcode = $response->code; |
|
208
|
0
|
|
|
|
|
|
$self->epp_log( "header answ code: $rcode" ); |
|
209
|
|
|
|
|
|
|
|
|
210
|
0
|
0
|
|
|
|
|
unless ( $rcode == 200 ) { |
|
211
|
0
|
|
|
|
|
|
$code = 0; |
|
212
|
0
|
|
|
|
|
|
$msg = "Can't open socket"; |
|
213
|
|
|
|
|
|
|
|
|
214
|
0
|
|
|
|
|
|
goto ERR; |
|
215
|
|
|
|
|
|
|
} |
|
216
|
|
|
|
|
|
|
|
|
217
|
0
|
|
|
|
|
|
my $headers = $response->headers; |
|
218
|
|
|
|
|
|
|
|
|
219
|
0
|
|
|
|
|
|
my $length = $headers->content_length; |
|
220
|
0
|
|
|
|
|
|
$self->epp_log( "header content-length == $length" ); |
|
221
|
|
|
|
|
|
|
|
|
222
|
0
|
0
|
|
|
|
|
if ( $length == 0 ) { |
|
223
|
0
|
|
|
|
|
|
$code = 0; |
|
224
|
0
|
|
|
|
|
|
$msg = "Can't open socket"; |
|
225
|
|
|
|
|
|
|
|
|
226
|
0
|
|
|
|
|
|
goto ERR; |
|
227
|
|
|
|
|
|
|
} |
|
228
|
|
|
|
|
|
|
|
|
229
|
0
|
|
|
|
|
|
my ( undef, $c0, $m0 ) = $self->hello(); |
|
230
|
|
|
|
|
|
|
|
|
231
|
0
|
0
|
0
|
|
|
|
unless ( $c0 && $c0 == 1000 ) { |
|
232
|
0
|
|
|
|
|
|
$code = 0; |
|
233
|
0
|
|
|
|
|
|
$msg = "Can't get greeting"; |
|
234
|
0
|
0
|
|
|
|
|
$msg .= '; ' . $self->{critical_error} if $self->{critical_error}; |
|
235
|
|
|
|
|
|
|
|
|
236
|
0
|
|
|
|
|
|
goto ERR; |
|
237
|
|
|
|
|
|
|
} |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
|
|
240
|
0
|
|
|
|
|
|
my ( undef, $c1, $m1 ) = $self->login( delete $params->{pass} ); # no password in object |
|
241
|
|
|
|
|
|
|
|
|
242
|
0
|
0
|
0
|
|
|
|
if ( $c1 && $c1 == 1000 ) { |
|
243
|
0
|
0
|
|
|
|
|
return wantarray ? ( $self, $c1, $m1 ) : $self; |
|
244
|
|
|
|
|
|
|
} |
|
245
|
|
|
|
|
|
|
|
|
246
|
0
|
|
0
|
|
|
|
$msg = ( $m1 || '' ) . $self->{critical_error}; |
|
247
|
0
|
|
0
|
|
|
|
$code = $c1 || 0; |
|
248
|
|
|
|
|
|
|
|
|
249
|
0
|
0
|
|
|
|
|
ERR: |
|
250
|
|
|
|
|
|
|
return wantarray ? ( 0, $code, $msg ) : 0; |
|
251
|
|
|
|
|
|
|
} |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=head2 get_billing_info, get_limits_info, get_stat_info |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
Not support |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=cut |
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
sub get_billing_info { |
|
260
|
0
|
0
|
|
0
|
1
|
|
return wantarray ? ( 0, 0, 'not work' ) : 0; |
|
261
|
|
|
|
|
|
|
} |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
sub get_limits_info { |
|
265
|
0
|
0
|
|
0
|
1
|
|
return wantarray ? ( 0, 0, 'not work' ) : 0; |
|
266
|
|
|
|
|
|
|
} |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
sub get_stat_info { |
|
270
|
0
|
0
|
|
0
|
1
|
|
return wantarray ? ( 0, 0, 'not work' ) : 0; |
|
271
|
|
|
|
|
|
|
} |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
1; |
|
275
|
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
__END__ |