@atomicservice/ascf-toolkit 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/lib/ascf-base/index.js +1 -1
  2. package/lib/ascf-common/index.js +1 -1
  3. package/lib/ascf-compiler/appjson-loader.js +1 -1
  4. package/lib/ascf-compiler/common/appjson-validator.js +1 -1
  5. package/lib/ascf-compiler/common/ascf-define.js +1 -1
  6. package/lib/ascf-compiler/common/ascf-file-cache.js +1 -0
  7. package/lib/ascf-compiler/common/beforeLoaderProcess.js +1 -1
  8. package/lib/ascf-compiler/common/css-runtime-api.js +1 -1
  9. package/lib/ascf-compiler/common/eventHappenHjs.js +1 -1
  10. package/lib/ascf-compiler/common/exp-utils.js +1 -1
  11. package/lib/ascf-compiler/common/hash-sum.js +1 -1
  12. package/lib/ascf-compiler/common/hdc-executor.js +1 -1
  13. package/lib/ascf-compiler/common/hjs-utils.js +1 -1
  14. package/lib/ascf-compiler/common/hxml-validator.js +1 -1
  15. package/lib/ascf-compiler/common/logUndefined.js +1 -1
  16. package/lib/ascf-compiler/common/manifest-handler.js +1 -1
  17. package/lib/ascf-compiler/common/manifest-manager.js +1 -1
  18. package/lib/ascf-compiler/common/merge-tpl-cmps.js +1 -1
  19. package/lib/ascf-compiler/common/packoptions-utils.js +1 -1
  20. package/lib/ascf-compiler/common/quick-generate-subpackage.js +1 -1
  21. package/lib/ascf-compiler/common/utils.js +1 -1
  22. package/lib/ascf-compiler/css-process-loader.js +1 -1
  23. package/lib/ascf-compiler/extract-loader.js +1 -1
  24. package/lib/ascf-compiler/hcss-loader.js +1 -1
  25. package/lib/ascf-compiler/hjs-loader.js +1 -1
  26. package/lib/ascf-compiler/hxml-loader.js +1 -1
  27. package/lib/ascf-compiler/js-parser/parser-babel.js +1 -1
  28. package/lib/ascf-compiler/js-parser/parser-swc.js +1 -1
  29. package/lib/ascf-compiler/js-parser/parser.js +1 -1
  30. package/lib/ascf-compiler/loader-utils.js +1 -1
  31. package/lib/ascf-compiler/path-process-loader.js +1 -1
  32. package/lib/ascf-compiler/plugin/before-loader-plugin.js +1 -1
  33. package/lib/ascf-compiler/plugin/copy-bundle-plugin.js +1 -1
  34. package/lib/ascf-compiler/plugin/dynamic-entry-plugin.js +1 -1
  35. package/lib/ascf-compiler/plugin/extConfig-plugin.js +1 -1
  36. package/lib/ascf-compiler/plugin/html-generator-plugin.js +1 -1
  37. package/lib/ascf-compiler/plugin/i18n-transform-plugin.js +1 -1
  38. package/lib/ascf-compiler/plugin/manifest-generator-plugin.js +1 -1
  39. package/lib/ascf-compiler/plugin/quick-service-build-plugin.js +1 -1
  40. package/lib/ascf-compiler/plugin/replace-module-id-plugin.js +1 -1
  41. package/lib/ascf-compiler/plugin/resource-plugin.js +1 -1
  42. package/lib/ascf-compiler/plugin/webpack-target/index.js +1 -1
  43. package/lib/ascf-compiler/plugin/webpack-target/jsonpChunkLoadingRuntimeModule.js +1 -1
  44. package/lib/ascf-compiler/plugin/webpack-target/jsonpHelpers.js +1 -1
  45. package/lib/ascf-compiler/plugin/webpack-target/jsonpTemplatePlugin.js +1 -1
  46. package/lib/ascf-compiler/require-loader.js +1 -1
  47. package/lib/ascf-compiler/server/dev-server.js +1 -1
  48. package/lib/ascf-compiler/server/port-manager.js +1 -1
  49. package/lib/ascf-compiler/swc-loader.js +1 -1
  50. package/lib/ascf-compiler/template/attr-utils.js +1 -1
  51. package/lib/ascf-compiler/template/implicit-model-config.js +1 -1
  52. package/lib/ascf-compiler/template/node-name-utils.js +1 -1
  53. package/lib/ascf-compiler/template-compiler/index.js +1 -1
  54. package/lib/ascf-compiler/trustlist-hxml-verify-loader.js +1 -1
  55. package/lib/ascf-compiler/trustlist-js-verify-loader.js +1 -1
  56. package/lib/ascf-compiler/trustlist-verify/config.js +1 -1
  57. package/lib/ascf-compiler/trustlist-verify/utils.js +1 -1
  58. package/lib/ascf-compiler/trustlist-verify/verify-ignore-files.js +1 -1
  59. package/lib/ascf-compiler/vue-compiler/vue-compiler.js +1 -1
  60. package/lib/ascf-compiler/vue-compiler/vue.bundle.js +1 -1
  61. package/lib/ascf-compiler/web.webpack.config.js +1 -1
  62. package/lib/ascf-converter/common/commonConfig.js +1 -1
  63. package/lib/ascf-converter/common/commonUtils.js +1 -1
  64. package/lib/ascf-converter/common/path-validator.js +1 -1
  65. package/lib/ascf-converter/common/textDocument.js +1 -1
  66. package/lib/ascf-converter/compiler-utils/parse5.bundle.js +1 -1
  67. package/lib/ascf-converter/convertManager.js +1 -1
  68. package/lib/ascf-converter/features/converter.js +1 -1
  69. package/lib/ascf-converter/features/fileHandle.js +1 -1
  70. package/lib/ascf-converter/features/transformReport.js +1 -1
  71. package/lib/ascf-converter/lib/apiadapter4alipay.js +1 -1
  72. package/lib/ascf-converter/parse/babelParser.js +1 -1
  73. package/lib/ascf-converter/parse/importVisitor.js +1 -1
  74. package/lib/ascf-converter/parse/wxssParser.js +1 -1
  75. package/lib/ascf-converter/report/js/index.js +1 -1
  76. package/lib/ascf-sign-tools/cli.js +1 -1
  77. package/lib/ascf-sign-tools/index.js +1 -1
  78. package/lib/bin/ascf.js +1 -1
  79. package/lib/commands/ascfbuild/index.js +1 -1
  80. package/lib/commands/build-npm/index.js +1 -1
  81. package/lib/commands/compile.js +1 -1
  82. package/lib/commands/convert.js +1 -1
  83. package/lib/commands/debugger/index.js +1 -1
  84. package/lib/commands/quickservice/index.js +1 -1
  85. package/lib/common/config.js +1 -1
  86. package/lib/common/constants.js +1 -1
  87. package/lib/common/log4js.js +1 -1
  88. package/lib/common/logger-plugin.js +1 -1
  89. package/lib/common/remove-strict-mode-plugin.js +1 -1
  90. package/lib/common/string-utils.js +1 -1
  91. package/lib/common/utils.js +1 -1
  92. package/lib/common/version-check.js +1 -1
  93. package/lib/index.js +1 -1
  94. package/package.json +1 -1
  95. package/lib/tools/platform-tools-darwin/adb +0 -0
  96. package/lib/tools/platform-tools-windows/AdbWinApi.dll +0 -0
  97. package/lib/tools/platform-tools-windows/AdbWinUsbApi.dll +0 -0
  98. package/lib/tools/platform-tools-windows/adb.exe +0 -0
  99. package/lib/tools/release_64/SSL/ct_log_list.cnf +0 -9
  100. package/lib/tools/release_64/SSL/ct_log_list.cnf.dist +0 -9
  101. package/lib/tools/release_64/SSL/misc/CA.pl +0 -215
  102. package/lib/tools/release_64/SSL/misc/tsget.pl +0 -200
  103. package/lib/tools/release_64/SSL/openssl.cnf +0 -350
  104. package/lib/tools/release_64/SSL/openssl.cnf.dist +0 -350
  105. package/lib/tools/release_64/bin/c_rehash.pl +0 -251
  106. package/lib/tools/release_64/bin/libcrypto-1_1-x64.dll +0 -0
  107. package/lib/tools/release_64/bin/libssl-1_1-x64.dll +0 -0
  108. package/lib/tools/release_64/bin/openssl.exe +0 -0
@@ -1,215 +0,0 @@
1
- #!/usr/bin/env perl
2
- # Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
3
- #
4
- # Licensed under the OpenSSL license (the "License"). You may not use
5
- # this file except in compliance with the License. You can obtain a copy
6
- # in the file LICENSE in the source distribution or at
7
- # https://www.openssl.org/source/license.html
8
-
9
- #
10
- # Wrapper around the ca to make it easier to use
11
- #
12
- # WARNING: do not edit!
13
- # Generated by makefile from apps\CA.pl.in
14
-
15
- use strict;
16
- use warnings;
17
-
18
- my $openssl = "openssl";
19
- if(defined $ENV{'OPENSSL'}) {
20
- $openssl = $ENV{'OPENSSL'};
21
- } else {
22
- $ENV{'OPENSSL'} = $openssl;
23
- }
24
-
25
- my $verbose = 1;
26
-
27
- my $OPENSSL_CONFIG = $ENV{"OPENSSL_CONFIG"} || "";
28
- my $DAYS = "-days 365";
29
- my $CADAYS = "-days 1095"; # 3 years
30
- my $REQ = "$openssl req $OPENSSL_CONFIG";
31
- my $CA = "$openssl ca $OPENSSL_CONFIG";
32
- my $VERIFY = "$openssl verify";
33
- my $X509 = "$openssl x509";
34
- my $PKCS12 = "$openssl pkcs12";
35
-
36
- # default openssl.cnf file has setup as per the following
37
- my $CATOP = "./demoCA";
38
- my $CAKEY = "cakey.pem";
39
- my $CAREQ = "careq.pem";
40
- my $CACERT = "cacert.pem";
41
- my $CACRL = "crl.pem";
42
- my $DIRMODE = 0777;
43
-
44
- my $NEWKEY = "newkey.pem";
45
- my $NEWREQ = "newreq.pem";
46
- my $NEWCERT = "newcert.pem";
47
- my $NEWP12 = "newcert.p12";
48
- my $RET = 0;
49
- my $WHAT = shift @ARGV || "";
50
- my @OPENSSL_CMDS = ("req", "ca", "pkcs12", "x509", "verify");
51
- my %EXTRA = extra_args(\@ARGV, "-extra-");
52
- my $FILE;
53
-
54
- sub extra_args {
55
- my ($args_ref, $arg_prefix) = @_;
56
- my %eargs = map {
57
- if ($_ < $#$args_ref) {
58
- my ($arg, $value) = splice(@$args_ref, $_, 2);
59
- $arg =~ s/$arg_prefix//;
60
- ($arg, $value);
61
- } else {
62
- ();
63
- }
64
- } reverse grep($$args_ref[$_] =~ /$arg_prefix/, 0..$#$args_ref);
65
- my %empty = map { ($_, "") } @OPENSSL_CMDS;
66
- return (%empty, %eargs);
67
- }
68
-
69
- # See if reason for a CRL entry is valid; exit if not.
70
- sub crl_reason_ok
71
- {
72
- my $r = shift;
73
-
74
- if ($r eq 'unspecified' || $r eq 'keyCompromise'
75
- || $r eq 'CACompromise' || $r eq 'affiliationChanged'
76
- || $r eq 'superseded' || $r eq 'cessationOfOperation'
77
- || $r eq 'certificateHold' || $r eq 'removeFromCRL') {
78
- return 1;
79
- }
80
- print STDERR "Invalid CRL reason; must be one of:\n";
81
- print STDERR " unspecified, keyCompromise, CACompromise,\n";
82
- print STDERR " affiliationChanged, superseded, cessationOfOperation\n";
83
- print STDERR " certificateHold, removeFromCRL";
84
- exit 1;
85
- }
86
-
87
- # Copy a PEM-format file; return like exit status (zero means ok)
88
- sub copy_pemfile
89
- {
90
- my ($infile, $outfile, $bound) = @_;
91
- my $found = 0;
92
-
93
- open IN, $infile || die "Cannot open $infile, $!";
94
- open OUT, ">$outfile" || die "Cannot write to $outfile, $!";
95
- while (<IN>) {
96
- $found = 1 if /^-----BEGIN.*$bound/;
97
- print OUT $_ if $found;
98
- $found = 2, last if /^-----END.*$bound/;
99
- }
100
- close IN;
101
- close OUT;
102
- return $found == 2 ? 0 : 1;
103
- }
104
-
105
- # Wrapper around system; useful for debugging. Returns just the exit status
106
- sub run
107
- {
108
- my $cmd = shift;
109
- print "====\n$cmd\n" if $verbose;
110
- my $status = system($cmd);
111
- print "==> $status\n====\n" if $verbose;
112
- return $status >> 8;
113
- }
114
-
115
-
116
- if ( $WHAT =~ /^(-\?|-h|-help)$/ ) {
117
- print STDERR "usage: CA.pl -newcert | -newreq | -newreq-nodes | -xsign | -sign | -signCA | -signcert | -crl | -newca [-extra-cmd extra-params]\n";
118
- print STDERR " CA.pl -pkcs12 [-extra-pkcs12 extra-params] [certname]\n";
119
- print STDERR " CA.pl -verify [-extra-verify extra-params] certfile ...\n";
120
- print STDERR " CA.pl -revoke [-extra-ca extra-params] certfile [reason]\n";
121
- exit 0;
122
- }
123
- if ($WHAT eq '-newcert' ) {
124
- # create a certificate
125
- $RET = run("$REQ -new -x509 -keyout $NEWKEY -out $NEWCERT $DAYS $EXTRA{req}");
126
- print "Cert is in $NEWCERT, private key is in $NEWKEY\n" if $RET == 0;
127
- } elsif ($WHAT eq '-precert' ) {
128
- # create a pre-certificate
129
- $RET = run("$REQ -x509 -precert -keyout $NEWKEY -out $NEWCERT $DAYS");
130
- print "Pre-cert is in $NEWCERT, private key is in $NEWKEY\n" if $RET == 0;
131
- } elsif ($WHAT =~ /^\-newreq(\-nodes)?$/ ) {
132
- # create a certificate request
133
- $RET = run("$REQ -new $1 -keyout $NEWKEY -out $NEWREQ $DAYS $EXTRA{req}");
134
- print "Request is in $NEWREQ, private key is in $NEWKEY\n" if $RET == 0;
135
- } elsif ($WHAT eq '-newca' ) {
136
- # create the directory hierarchy
137
- mkdir ${CATOP}, $DIRMODE;
138
- mkdir "${CATOP}/certs", $DIRMODE;
139
- mkdir "${CATOP}/crl", $DIRMODE ;
140
- mkdir "${CATOP}/newcerts", $DIRMODE;
141
- mkdir "${CATOP}/private", $DIRMODE;
142
- open OUT, ">${CATOP}/index.txt";
143
- close OUT;
144
- open OUT, ">${CATOP}/crlnumber";
145
- print OUT "01\n";
146
- close OUT;
147
- # ask user for existing CA certificate
148
- print "CA certificate filename (or enter to create)\n";
149
- $FILE = "" unless defined($FILE = <STDIN>);
150
- $FILE =~ s{\R$}{};
151
- if ($FILE ne "") {
152
- copy_pemfile($FILE,"${CATOP}/private/$CAKEY", "PRIVATE");
153
- copy_pemfile($FILE,"${CATOP}/$CACERT", "CERTIFICATE");
154
- } else {
155
- print "Making CA certificate ...\n";
156
- $RET = run("$REQ -new -keyout"
157
- . " ${CATOP}/private/$CAKEY"
158
- . " -out ${CATOP}/$CAREQ $EXTRA{req}");
159
- $RET = run("$CA -create_serial"
160
- . " -out ${CATOP}/$CACERT $CADAYS -batch"
161
- . " -keyfile ${CATOP}/private/$CAKEY -selfsign"
162
- . " -extensions v3_ca $EXTRA{ca}"
163
- . " -infiles ${CATOP}/$CAREQ") if $RET == 0;
164
- print "CA certificate is in ${CATOP}/$CACERT\n" if $RET == 0;
165
- }
166
- } elsif ($WHAT eq '-pkcs12' ) {
167
- my $cname = $ARGV[0];
168
- $cname = "My Certificate" unless defined $cname;
169
- $RET = run("$PKCS12 -in $NEWCERT -inkey $NEWKEY"
170
- . " -certfile ${CATOP}/$CACERT"
171
- . " -out $NEWP12"
172
- . " -export -name \"$cname\" $EXTRA{pkcs12}");
173
- print "PKCS #12 file is in $NEWP12\n" if $RET == 0;
174
- } elsif ($WHAT eq '-xsign' ) {
175
- $RET = run("$CA -policy policy_anything $EXTRA{ca} -infiles $NEWREQ");
176
- } elsif ($WHAT eq '-sign' ) {
177
- $RET = run("$CA -policy policy_anything -out $NEWCERT $EXTRA{ca} -infiles $NEWREQ");
178
- print "Signed certificate is in $NEWCERT\n" if $RET == 0;
179
- } elsif ($WHAT eq '-signCA' ) {
180
- $RET = run("$CA -policy policy_anything -out $NEWCERT"
181
- . " -extensions v3_ca $EXTRA{ca} -infiles $NEWREQ");
182
- print "Signed CA certificate is in $NEWCERT\n" if $RET == 0;
183
- } elsif ($WHAT eq '-signcert' ) {
184
- $RET = run("$X509 -x509toreq -in $NEWREQ -signkey $NEWREQ"
185
- . " -out tmp.pem $EXTRA{x509}");
186
- $RET = run("$CA -policy policy_anything -out $NEWCERT"
187
- . "$EXTRA{ca} -infiles tmp.pem") if $RET == 0;
188
- print "Signed certificate is in $NEWCERT\n" if $RET == 0;
189
- } elsif ($WHAT eq '-verify' ) {
190
- my @files = @ARGV ? @ARGV : ( $NEWCERT );
191
- my $file;
192
- foreach $file (@files) {
193
- my $status = run("$VERIFY \"-CAfile\" ${CATOP}/$CACERT $file $EXTRA{verify}");
194
- $RET = $status if $status != 0;
195
- }
196
- } elsif ($WHAT eq '-crl' ) {
197
- $RET = run("$CA -gencrl -out ${CATOP}/crl/$CACRL $EXTRA{ca}");
198
- print "Generated CRL is in ${CATOP}/crl/$CACRL\n" if $RET == 0;
199
- } elsif ($WHAT eq '-revoke' ) {
200
- my $cname = $ARGV[0];
201
- if (!defined $cname) {
202
- print "Certificate filename is required; reason optional.\n";
203
- exit 1;
204
- }
205
- my $reason = $ARGV[1];
206
- $reason = " -crl_reason $reason"
207
- if defined $reason && crl_reason_ok($reason);
208
- $RET = run("$CA -revoke \"$cname\"" . $reason . $EXTRA{ca});
209
- } else {
210
- print STDERR "Unknown arg \"$WHAT\"\n";
211
- print STDERR "Use -help for help.\n";
212
- exit 1;
213
- }
214
-
215
- exit $RET;
@@ -1,200 +0,0 @@
1
- #!/usr/bin/env perl
2
- # Copyright 2002-2018 The OpenSSL Project Authors. All Rights Reserved.
3
- # Copyright (c) 2002 The OpenTSA Project. All rights reserved.
4
- #
5
- # Licensed under the OpenSSL license (the "License"). You may not use
6
- # this file except in compliance with the License. You can obtain a copy
7
- # in the file LICENSE in the source distribution or at
8
- # https://www.openssl.org/source/license.html
9
-
10
- use strict;
11
- use IO::Handle;
12
- use Getopt::Std;
13
- use File::Basename;
14
- use WWW::Curl::Easy;
15
-
16
- use vars qw(%options);
17
-
18
- # Callback for reading the body.
19
- sub read_body {
20
- my ($maxlength, $state) = @_;
21
- my $return_data = "";
22
- my $data_len = length ${$state->{data}};
23
- if ($state->{bytes} < $data_len) {
24
- $data_len = $data_len - $state->{bytes};
25
- $data_len = $maxlength if $data_len > $maxlength;
26
- $return_data = substr ${$state->{data}}, $state->{bytes}, $data_len;
27
- $state->{bytes} += $data_len;
28
- }
29
- return $return_data;
30
- }
31
-
32
- # Callback for writing the body into a variable.
33
- sub write_body {
34
- my ($data, $pointer) = @_;
35
- ${$pointer} .= $data;
36
- return length($data);
37
- }
38
-
39
- # Initialise a new Curl object.
40
- sub create_curl {
41
- my $url = shift;
42
-
43
- # Create Curl object.
44
- my $curl = WWW::Curl::Easy::new();
45
-
46
- # Error-handling related options.
47
- $curl->setopt(CURLOPT_VERBOSE, 1) if $options{d};
48
- $curl->setopt(CURLOPT_FAILONERROR, 1);
49
- $curl->setopt(CURLOPT_USERAGENT,
50
- "OpenTSA tsget.pl/openssl-1.1.1q");
51
-
52
- # Options for POST method.
53
- $curl->setopt(CURLOPT_UPLOAD, 1);
54
- $curl->setopt(CURLOPT_CUSTOMREQUEST, "POST");
55
- $curl->setopt(CURLOPT_HTTPHEADER,
56
- ["Content-Type: application/timestamp-query",
57
- "Accept: application/timestamp-reply,application/timestamp-response"]);
58
- $curl->setopt(CURLOPT_READFUNCTION, \&read_body);
59
- $curl->setopt(CURLOPT_HEADERFUNCTION, sub { return length($_[0]); });
60
-
61
- # Options for getting the result.
62
- $curl->setopt(CURLOPT_WRITEFUNCTION, \&write_body);
63
-
64
- # SSL related options.
65
- $curl->setopt(CURLOPT_SSLKEYTYPE, "PEM");
66
- $curl->setopt(CURLOPT_SSL_VERIFYPEER, 1); # Verify server's certificate.
67
- $curl->setopt(CURLOPT_SSL_VERIFYHOST, 2); # Check server's CN.
68
- $curl->setopt(CURLOPT_SSLKEY, $options{k}) if defined($options{k});
69
- $curl->setopt(CURLOPT_SSLKEYPASSWD, $options{p}) if defined($options{p});
70
- $curl->setopt(CURLOPT_SSLCERT, $options{c}) if defined($options{c});
71
- $curl->setopt(CURLOPT_CAINFO, $options{C}) if defined($options{C});
72
- $curl->setopt(CURLOPT_CAPATH, $options{P}) if defined($options{P});
73
- $curl->setopt(CURLOPT_RANDOM_FILE, $options{r}) if defined($options{r});
74
- $curl->setopt(CURLOPT_EGDSOCKET, $options{g}) if defined($options{g});
75
-
76
- # Setting destination.
77
- $curl->setopt(CURLOPT_URL, $url);
78
-
79
- return $curl;
80
- }
81
-
82
- # Send a request and returns the body back.
83
- sub get_timestamp {
84
- my $curl = shift;
85
- my $body = shift;
86
- my $ts_body;
87
- local $::error_buf;
88
-
89
- # Error-handling related options.
90
- $curl->setopt(CURLOPT_ERRORBUFFER, "::error_buf");
91
-
92
- # Options for POST method.
93
- $curl->setopt(CURLOPT_INFILE, {data => $body, bytes => 0});
94
- $curl->setopt(CURLOPT_INFILESIZE, length(${$body}));
95
-
96
- # Options for getting the result.
97
- $curl->setopt(CURLOPT_FILE, \$ts_body);
98
-
99
- # Send the request...
100
- my $error_code = $curl->perform();
101
- my $error_string;
102
- if ($error_code != 0) {
103
- my $http_code = $curl->getinfo(CURLINFO_HTTP_CODE);
104
- $error_string = "could not get timestamp";
105
- $error_string .= ", http code: $http_code" unless $http_code == 0;
106
- $error_string .= ", curl code: $error_code";
107
- $error_string .= " ($::error_buf)" if defined($::error_buf);
108
- } else {
109
- my $ct = $curl->getinfo(CURLINFO_CONTENT_TYPE);
110
- if (lc($ct) ne "application/timestamp-reply"
111
- && lc($ct) ne "application/timestamp-response") {
112
- $error_string = "unexpected content type returned: $ct";
113
- }
114
- }
115
- return ($ts_body, $error_string);
116
-
117
- }
118
-
119
- # Print usage information and exists.
120
- sub usage {
121
-
122
- print STDERR "usage: $0 -h <server_url> [-e <extension>] [-o <output>] ";
123
- print STDERR "[-v] [-d] [-k <private_key.pem>] [-p <key_password>] ";
124
- print STDERR "[-c <client_cert.pem>] [-C <CA_certs.pem>] [-P <CA_path>] ";
125
- print STDERR "[-r <file:file...>] [-g <EGD_socket>] [<request>]...\n";
126
- exit 1;
127
- }
128
-
129
- # ----------------------------------------------------------------------
130
- # Main program
131
- # ----------------------------------------------------------------------
132
-
133
- # Getting command-line options (default comes from TSGET environment variable).
134
- my $getopt_arg = "h:e:o:vdk:p:c:C:P:r:g:";
135
- if (exists $ENV{TSGET}) {
136
- my @old_argv = @ARGV;
137
- @ARGV = split /\s+/, $ENV{TSGET};
138
- getopts($getopt_arg, \%options) or usage;
139
- @ARGV = @old_argv;
140
- }
141
- getopts($getopt_arg, \%options) or usage;
142
-
143
- # Checking argument consistency.
144
- if (!exists($options{h}) || (@ARGV == 0 && !exists($options{o}))
145
- || (@ARGV > 1 && exists($options{o}))) {
146
- print STDERR "Inconsistent command line options.\n";
147
- usage;
148
- }
149
- # Setting defaults.
150
- @ARGV = ("-") unless @ARGV != 0;
151
- $options{e} = ".tsr" unless defined($options{e});
152
-
153
- # Processing requests.
154
- my $curl = create_curl $options{h};
155
- undef $/; # For reading whole files.
156
- REQUEST: foreach (@ARGV) {
157
- my $input = $_;
158
- my ($base, $path) = fileparse($input, '\.[^.]*');
159
- my $output_base = $base . $options{e};
160
- my $output = defined($options{o}) ? $options{o} : $path . $output_base;
161
-
162
- STDERR->printflush("$input: ") if $options{v};
163
- # Read request.
164
- my $body;
165
- if ($input eq "-") {
166
- # Read the request from STDIN;
167
- $body = <STDIN>;
168
- } else {
169
- # Read the request from file.
170
- open INPUT, "<" . $input
171
- or warn("$input: could not open input file: $!\n"), next REQUEST;
172
- $body = <INPUT>;
173
- close INPUT
174
- or warn("$input: could not close input file: $!\n"), next REQUEST;
175
- }
176
-
177
- # Send request.
178
- STDERR->printflush("sending request") if $options{v};
179
-
180
- my ($ts_body, $error) = get_timestamp $curl, \$body;
181
- if (defined($error)) {
182
- die "$input: fatal error: $error\n";
183
- }
184
- STDERR->printflush(", reply received") if $options{v};
185
-
186
- # Write response.
187
- if ($output eq "-") {
188
- # Write to STDOUT.
189
- print $ts_body;
190
- } else {
191
- # Write to file.
192
- open OUTPUT, ">", $output
193
- or warn("$output: could not open output file: $!\n"), next REQUEST;
194
- print OUTPUT $ts_body;
195
- close OUTPUT
196
- or warn("$output: could not close output file: $!\n"), next REQUEST;
197
- }
198
- STDERR->printflush(", $output written.\n") if $options{v};
199
- }
200
- $curl->cleanup();