DRI/Protocol/EPP/Extensions/HTTP.pm

filter: Statementstmt 60.9% 25 / 41 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 8 / 12 Podpod 0.0% 0 / 4 totaltotal 50.0% 33 / 66 CC 5 SCAR 18.7
CC
5
Cov
52%
init
20.0
read_data
6.0
greeting
2.0
CRAP 6.5
« DRI/Protocol/EPP/Extensions/DNSBE/Message.pm ↑ Summary DRI/Protocol/RRP/Core/Status.pm »
1 ## Domain Registry Interface, EPP over HTTP/HTTPS Connection handling
2 ##
3 ## Copyright (c) 2008-2010,2013 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
4 ##
5 ## This file is part of Net::DRI
6 ##
7 ## Net::DRI is free software; you can redistribute it and/or modify
8 ## it under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation; either version 2 of the License, or
10 ## (at your option) any later version.
11 ##
12 ## See the LICENSE file that comes with this distribution for more details.
13 ####################################################################################################
14  
15 package Net::DRI::Protocol::EPP::Extensions::HTTP;
16  
17 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 ▶use base qw/Net::DRI::Protocol::EPP::Connection/;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 1 ▶use HTTP::Request ();
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 ▶use Net::DRI::Data::Raw;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 1 ▶use Net::DRI::Protocol::ResultStatus;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 =pod
30  
31 =head1 NAME
32  
33 Net::DRI::Protocol::EPP::Extensions::HTTP - EPP over HTTP/HTTPS connection handling for Net::DRI
34  
35 =head1 DESCRIPTION
36  
37 Please see the README file for details.
38  
39 =head1 SUPPORT
40  
41 For now, support questions should be sent to:
42  
43 E<lt>netdri@dotandco.comE<gt>
44  
45 Please also see the SUPPORT file in the distribution.
46  
47 =head1 SEE ALSO
48  
49 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
50  
51 =head1 AUTHOR
52  
53 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
54  
55 =head1 COPYRIGHT
56  
57 Copyright (c) 2008-2010,2013 Patrick Mevzek <netdri@dotandco.com>.
58 All rights reserved.
59  
60 This program is free software; you can redistribute it and/or modify
61 it under the terms of the GNU General Public License as published by
62 the Free Software Foundation; either version 2 of the License, or
63 (at your option) any later version.
64  
65 See the LICENSE file that comes with this distribution for more details.
66  
67 =cut
68  
69 ####################################################################################################
70  
71 sub init
72 {
73 0 ▶ my ($class,$to)=@_;
Subroutine init: not called CC=4 SCAR=30.0
Pod undocumented
74 0 my $t=$to->transport_data();
75  
76 0 foreach my $p (qw/client_login client_password remote_url/)
77 {
78 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters($p.' must be defined') unless (exists($t->{$p}) && $t->{$p});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $t->{$p} and $t->{$p} 0 0 0
Condition0%0/3
exists $t->{$p} and $t->{$p}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $t->{$p} and $t->{$p}
exists $t->{$p} $t->{$p}
Truth table0%0/3
A and B
A= exists $t->{$p}B= $t->{$p}
ABresult
0X0
100
111
79 }
80 0 return;
81 }
82  
83 sub greeting
84 {
85 0 ▶ my ($class,$cm)=@_;
Subroutine greeting: not called CC=1 SCAR=6.9
Pod undocumented
86 0 return $class->keepalive($cm); ## will send an <hello/> message, which is in fact a greeting !
87 }
88  
89 ####################################################################################################
90  
91 sub read_data
92 {
93 0 ▶ my ($class,$to,$res)=@_;
Subroutine read_data: not called CC=2 SCAR=17.9
Pod undocumented
94 0 ▶ die(Net::DRI::Protocol::ResultStatus->new_error('COMMAND_FAILED_CLOSING',sprintf('Got unsuccessfull HTTP response: %d %s',$res->code(),$res->message()),'en')) unless $res->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $res->is_success 0 0 0
95 0 return Net::DRI::Data::Raw->new_from_xmlstring($res->decoded_content());
96 }
97  
98 sub write_message
99 {
100 0 ▶ my ($class,$to,$msg)=@_;
Subroutine write_message: not called CC=1 SCAR=6.9
Pod undocumented
101 0 my $t=$to->transport_data();
102 0 my $req=HTTP::Request->new('POST',$t->{remote_url});
103 0 $req->header('Content-Type','text/xml');
104 0 $req->content(Net::DRI::Util::encode_utf8($msg));
105 ## Content-Length will be automatically computed during Transport by LWP::UserAgent
106 0 return $req;
107 }
108  
109 ####################################################################################################
110 1 1;
« DRI/Protocol/EPP/Extensions/DNSBE/Message.pm ↑ Summary DRI/Protocol/RRP/Core/Status.pm »