~ubuntu-branches/ubuntu/utopic/curl/utopic-updates

« back to all changes in this revision

Viewing changes to tests/serverhelp.pm

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-05-22 14:53:29 UTC
  • mfrom: (3.4.28 sid)
  • Revision ID: package-import@ubuntu.com-20120522145329-hbf1n3zr7qh08qab
Tags: 7.25.0-1ubuntu1
* Merge from Debian testing (LP: #1003049).  Remaining changes:
  - Drop dependencies not in main:
    + Build-Depends: Drop stunnel4 and libssh2-1-dev.
    + Drop libssh2-1-dev from libcurl4-openssl-dev's Depends.
  - Add new libcurl3-udeb package.
  - Add new curl-udeb package.
  - Also closes (LP: #855291)
* debian/patches/CVE-2012-0036.patch: Dropped. CVE resolved upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
#                            | (__| |_| |  _ <| |___
6
6
#                             \___|\___/|_| \_\_____|
7
7
#
8
 
# Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
 
8
# Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
9
9
#
10
10
# This software is licensed as described in the file COPYING, which
11
11
# you should have received as part of this distribution. The terms
63
63
 
64
64
 
65
65
#***************************************************************************
 
66
# Just for convenience, test harness uses 'https' and 'httptls' literals as
 
67
# values for 'proto' variable in order to differentiate different servers.
 
68
# 'https' literal is used for stunnel based https test servers, and 'httptls'
 
69
# is used for non-stunnel https test servers.
 
70
 
 
71
 
 
72
#***************************************************************************
66
73
# Return server characterization factors given a server id string.
67
74
#
68
75
sub serverfactors {
71
78
    my $ipvnum;
72
79
    my $idnum;
73
80
 
74
 
    if($server =~ /^((ftp|http|imap|pop3|smtp)s?)(\d*)(-ipv6|)$/) {
 
81
    if($server =~
 
82
        /^((ftp|http|imap|pop3|smtp)s?)(\d*)(-ipv6|)$/) {
75
83
        $proto  = $1;
76
84
        $idnum  = ($3 && ($3 > 1)) ? $3 : 1;
77
85
        $ipvnum = ($4 && ($4 =~ /6$/)) ? 6 : 4;
78
86
    }
79
 
    elsif($server =~ /^(tftp|sftp|socks|ssh|rtsp)(\d*)(-ipv6|)$/) {
 
87
    elsif($server =~
 
88
        /^(tftp|sftp|socks|ssh|rtsp|gopher|httptls)(\d*)(-ipv6|)$/) {
80
89
        $proto  = $1;
81
90
        $idnum  = ($2 && ($2 > 1)) ? $2 : 1;
82
91
        $ipvnum = ($3 && ($3 =~ /6$/)) ? 6 : 4;
83
92
    }
84
93
    else {
85
 
        die "invalid server id: $server"
 
94
        die "invalid server id: '$server'"
86
95
    }
87
96
    return($proto, $ipvnum, $idnum);
88
97
}
95
104
    my ($proto, $ipver, $idnum) = @_;
96
105
 
97
106
    $proto = uc($proto) if($proto);
98
 
    die "unsupported protocol: $proto" unless($proto &&
99
 
        ($proto =~ /^(((FTP|HTTP|IMAP|POP3|SMTP)S?)|(TFTP|SFTP|SOCKS|SSH|RTSP|GOPHER|HTTP\+TLS-SRP))$/));
 
107
    die "unsupported protocol: '$proto'" unless($proto &&
 
108
        ($proto =~ /^(((FTP|HTTP|IMAP|POP3|SMTP)S?)|(TFTP|SFTP|SOCKS|SSH|RTSP|GOPHER|HTTPTLS))$/));
100
109
 
101
110
    $ipver = (not $ipver) ? 'ipv4' : lc($ipver);
102
 
    die "unsupported IP version: $ipver" unless($ipver &&
 
111
    die "unsupported IP version: '$ipver'" unless($ipver &&
103
112
        ($ipver =~ /^(4|6|ipv4|ipv6|-ipv4|-ipv6)$/));
104
113
    $ipver = ($ipver =~ /6$/) ? '-IPv6' : '';
105
114
 
106
115
    $idnum = 1 if(not $idnum);
107
 
    die "unsupported ID number: $idnum" unless($idnum &&
 
116
    die "unsupported ID number: '$idnum'" unless($idnum &&
108
117
        ($idnum =~ /^(\d+)$/));
109
118
    $idnum = '' unless($idnum > 1);
110
119
 
188
197
#
189
198
sub mainsockf_pidfilename {
190
199
    my ($proto, $ipver, $idnum) = @_;
191
 
    die "unsupported protocol: $proto" unless($proto &&
 
200
    die "unsupported protocol: '$proto'" unless($proto &&
192
201
        (lc($proto) =~ /^(ftp|imap|pop3|smtp)s?$/));
193
202
    my $trailer = (lc($proto) =~ /^ftps?$/) ? '_sockctrl.pid':'_sockfilt.pid';
194
203
    return '.'. servername_canon($proto, $ipver, $idnum) ."$trailer";
200
209
#
201
210
sub mainsockf_logfilename {
202
211
    my ($logdir, $proto, $ipver, $idnum) = @_;
203
 
    die "unsupported protocol: $proto" unless($proto &&
 
212
    die "unsupported protocol: '$proto'" unless($proto &&
204
213
        (lc($proto) =~ /^(ftp|imap|pop3|smtp)s?$/));
205
214
    my $trailer = (lc($proto) =~ /^ftps?$/) ? '_sockctrl.log':'_sockfilt.log';
206
215
    return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
212
221
#
213
222
sub datasockf_pidfilename {
214
223
    my ($proto, $ipver, $idnum) = @_;
215
 
    die "unsupported protocol: $proto" unless($proto &&
 
224
    die "unsupported protocol: '$proto'" unless($proto &&
216
225
        (lc($proto) =~ /^ftps?$/));
217
226
    my $trailer = '_sockdata.pid';
218
227
    return '.'. servername_canon($proto, $ipver, $idnum) ."$trailer";
224
233
#
225
234
sub datasockf_logfilename {
226
235
    my ($logdir, $proto, $ipver, $idnum) = @_;
227
 
    die "unsupported protocol: $proto" unless($proto &&
 
236
    die "unsupported protocol: '$proto'" unless($proto &&
228
237
        (lc($proto) =~ /^ftps?$/));
229
238
    my $trailer = '_sockdata.log';
230
239
    return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";