60 |
'Name of index file to serve when a directory is requested from the static file web server', |
'Name of index file to serve when a directory is requested from the static file web server', |
61 |
DirectoryIndex => 'index.html', |
DirectoryIndex => 'index.html', |
62 |
|
|
|
'Header to be served with static documents. ~server~ and ~status~ will be replaced by the appropriate values', |
|
|
DocumentHeaderTemplate => 'HTTP/1.1 ~status~\r\nServer: ~server~\r\nContent-Type: text/html; charset=utf-8\r\n\r\n', |
|
|
|
|
63 |
'Header template, ~server~, ~servertime~ and ~status~ will be replaced by the appropriate values. **NOTE**: It is possible to define more than one HeaderTemplate by appending a number at the end, for example *HeaderTemplate42*. Clients can request a specific header to be used by adding the parameter template=<number> to their GET request. If *HeaderTemplate<number>* is not found, the system will use the default HeaderTemplate (no number)', |
'Header template, ~server~, ~servertime~ and ~status~ will be replaced by the appropriate values. **NOTE**: It is possible to define more than one HeaderTemplate by appending a number at the end, for example *HeaderTemplate42*. Clients can request a specific header to be used by adding the parameter template=<number> to their GET request. If *HeaderTemplate<number>* is not found, the system will use the default HeaderTemplate (no number)', |
64 |
HeaderTemplate => 'HTTP/1.1 ~status~\r\nServer: ~server~\r\nContent-Type: text/html; charset=utf-8\r\nPragma: no-cache\r\nCache-Control: no-cache, no-store, must-revalidate\r\nExpires: Thu, 1 Jan 1970 00:00:00 GMT\r\n\r\n<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r\n<meta http-equiv="Cache-Control" content="no-store">\r\n<meta http-equiv="Cache-Control" content="no-cache">\r\n<meta http-equiv="Pragma" content="no-cache">\r\n<meta http-equiv="Expires" content="Thu, 1 Jan 1970 00:00:00 GMT">\r\n<script type="text/javascript">\r\nwindow.onError = null;\r\nvar domainparts = document.domain.split(".");\r\ndocument.domain = domainparts[domainparts.length-2]+"."+domainparts[domainparts.length-1];\r\nparent.Meteor.register(this);\r\n</script>\r\n</head>\r\n<body onload="try { parent.Meteor.reset(this) } catch (e) {}">\r\n', |
HeaderTemplate => 'HTTP/1.1 ~status~\r\nServer: ~server~\r\nContent-Type: text/html; charset=utf-8\r\nPragma: no-cache\r\nCache-Control: no-cache, no-store, must-revalidate\r\nExpires: Thu, 1 Jan 1970 00:00:00 GMT\r\n\r\n<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r\n<meta http-equiv="Cache-Control" content="no-store">\r\n<meta http-equiv="Cache-Control" content="no-cache">\r\n<meta http-equiv="Pragma" content="no-cache">\r\n<meta http-equiv="Expires" content="Thu, 1 Jan 1970 00:00:00 GMT">\r\n<script type="text/javascript">\r\nwindow.onError = null;\r\nvar domainparts = document.domain.split(".");\r\ndocument.domain = domainparts[domainparts.length-2]+"."+domainparts[domainparts.length-1];\r\nparent.Meteor.register(this);\r\n</script>\r\n</head>\r\n<body onload="try { parent.Meteor.reset(this) } catch (e) {}">\r\n', |
65 |
|
|
66 |
|
'Template for each line in channelinfo', |
67 |
|
|
68 |
|
ChannelInfoTemplate => '~name~ ~messageCount~ ~lastMsgID~\r\n', |
69 |
|
|
70 |
'Print out this help message', |
'Print out this help message', |
71 |
Help => '', |
Help => '', |
72 |
|
|
88 |
'Interval at which PingMessage is sent to all persistent and identified subscriber connections (ie those including id=someuniqueidentifier in their request, and not specifying persist=0). Must be at least 3 if set higher than zero. Set to zero to disable.', |
'Interval at which PingMessage is sent to all persistent and identified subscriber connections (ie those including id=someuniqueidentifier in their request, and not specifying persist=0). Must be at least 3 if set higher than zero. Set to zero to disable.', |
89 |
PingInterval => 5, |
PingInterval => 5, |
90 |
|
|
91 |
|
'Persistence of a connection. Note: some modes have this hardcoded!', |
92 |
|
|
93 |
|
Persist => 0, |
94 |
|
|
95 |
'Message to be sent to all persistent and identified subscriber connections (see above) every PingInterval seconds', |
'Message to be sent to all persistent and identified subscriber connections (see above) every PingInterval seconds', |
96 |
PingMessage => '<script>p(-1,"");</script>\r\n', |
PingMessage => '<script>p(-1,"");</script>\r\n', |
97 |
|
|
112 |
|
|
113 |
'The syslog facility to use', |
'The syslog facility to use', |
114 |
SyslogFacility => 'daemon', |
SyslogFacility => 'daemon', |
115 |
|
|
116 |
|
'IP address for udp server (leave empty for all local addresses)', |
117 |
|
UDPIP => '', |
118 |
|
|
119 |
|
'Port number for udp connections, set to 0 to disable', |
120 |
|
UDPPort => 0, |
121 |
|
|
122 |
); |
); |
123 |
|
|
124 |
our %ConfigFileData=(); |
our %ConfigFileData=(); |
125 |
our %CommandLine=(); |
our %CommandLine=(); |
126 |
our %Defaults=(); |
our %Defaults=(); |
127 |
our %ExtraKeys=(); |
our %Modes=(); |
128 |
|
|
129 |
for(my $i=0;$i<scalar(@DEFAULTS);$i+=3) |
for(my $i=0;$i<scalar(@DEFAULTS);$i+=3) |
130 |
{ |
{ |
150 |
next if($DEFAULTS[$i+1] eq 'Help'); |
next if($DEFAULTS[$i+1] eq 'Help'); |
151 |
push(@keys,$DEFAULTS[$i+1]); |
push(@keys,$DEFAULTS[$i+1]); |
152 |
} |
} |
|
push(@keys,keys %ExtraKeys); |
|
153 |
|
|
154 |
foreach my $key (@keys) |
foreach my $mode ('',keys %Modes) |
155 |
{ |
{ |
156 |
if(exists($CommandLine{$key})) |
foreach my $baseKey (@keys) |
|
{ |
|
|
print STDERR "CmdLine" if($debug); |
|
|
$::CONF{$key}=$CommandLine{$key}; |
|
|
} |
|
|
elsif(exists($ConfigFileData{$key})) |
|
|
{ |
|
|
print STDERR "CnfFile" if($debug); |
|
|
$::CONF{$key}=$ConfigFileData{$key}; |
|
|
} |
|
|
elsif(exists($Defaults{$key})) |
|
157 |
{ |
{ |
158 |
print STDERR "Default" if($debug); |
my $foundValue=0; |
159 |
$::CONF{$key}=$Defaults{$key}; |
my $key=$baseKey.$mode; |
160 |
} |
|
161 |
|
if(exists($CommandLine{$key})) |
|
print STDERR "\t$key\t$::CONF{$key}\n" if($debug); |
|
|
|
|
|
# Take care of escapes |
|
|
$::CONF{$key}=~s/\\(.)/ |
|
|
if($1 eq 'r') |
|
|
{ |
|
|
"\r"; |
|
|
} |
|
|
elsif($1 eq 'n') |
|
|
{ |
|
|
"\n"; |
|
|
} |
|
|
elsif($1 eq 's') |
|
162 |
{ |
{ |
163 |
' '; |
print STDERR "CmdLine" if($debug); |
164 |
|
$::CONF{$key}=$CommandLine{$key}; |
165 |
|
$foundValue=1; |
166 |
} |
} |
167 |
elsif($1 eq 't') |
elsif(exists($ConfigFileData{$key})) |
168 |
{ |
{ |
169 |
"\t"; |
print STDERR "CnfFile" if($debug); |
170 |
|
$::CONF{$key}=$ConfigFileData{$key}; |
171 |
|
$foundValue=1; |
172 |
} |
} |
173 |
else |
elsif(exists($Defaults{$key})) |
174 |
{ |
{ |
175 |
$1; |
print STDERR "Default" if($debug); |
176 |
|
$::CONF{$key}=$Defaults{$key}; |
177 |
|
$foundValue=1; |
178 |
} |
} |
179 |
/gex; |
|
180 |
|
next unless($foundValue); |
181 |
|
|
182 |
|
print STDERR "\t$key\t$::CONF{$key}\n" if($debug); |
183 |
|
|
184 |
|
# Take care of escapes |
185 |
|
$::CONF{$key}=~s/\\(.)/ |
186 |
|
if($1 eq 'r') |
187 |
|
{ |
188 |
|
"\r"; |
189 |
|
} |
190 |
|
elsif($1 eq 'n') |
191 |
|
{ |
192 |
|
"\n"; |
193 |
|
} |
194 |
|
elsif($1 eq 's') |
195 |
|
{ |
196 |
|
' '; |
197 |
|
} |
198 |
|
elsif($1 eq 't') |
199 |
|
{ |
200 |
|
"\t"; |
201 |
|
} |
202 |
|
else |
203 |
|
{ |
204 |
|
$1; |
205 |
|
} |
206 |
|
/gex; |
207 |
|
} |
208 |
} |
} |
|
|
|
209 |
print STDERR '-'x79 ."\n" if($debug); |
print STDERR '-'x79 ."\n" if($debug); |
210 |
} |
} |
211 |
|
|
222 |
sub setCommandLineParameters { |
sub setCommandLineParameters { |
223 |
my $class=shift; |
my $class=shift; |
224 |
|
|
225 |
|
# |
226 |
|
# Quick check if we should show the version, if so ignore everything else |
227 |
|
# Accept -v, -version, and everything in between |
228 |
|
# |
229 |
|
foreach my $p (@_) |
230 |
|
{ |
231 |
|
if(index($p,'-v')==0 && index('-version',$p)==0) |
232 |
|
{ |
233 |
|
print "$::PGM $::VERSION\n"; |
234 |
|
exit(0); |
235 |
|
} |
236 |
|
} |
237 |
|
|
238 |
while(my $cnt=scalar(@_)) |
while(my $cnt=scalar(@_)) |
239 |
{ |
{ |
240 |
my $k=shift(@_); |
my $k=shift(@_); |
242 |
|
|
243 |
$k='Debug' if($k eq 'd'); |
$k='Debug' if($k eq 'd'); |
244 |
|
|
245 |
|
my $mode=''; |
246 |
|
|
247 |
|
if($k=~s/(\..+)$//) |
248 |
|
{ |
249 |
|
$mode=$1; |
250 |
|
$Modes{$mode}=1; |
251 |
|
} |
252 |
|
|
253 |
my $key=undef; |
my $key=undef; |
254 |
my $kl=length($k); |
my $kl=length($k); |
255 |
my $kOrig=$k; |
my $kOrig=$k; |
281 |
$key=$p; |
$key=$p; |
282 |
} |
} |
283 |
} |
} |
|
|
|
|
if($k=~/^HeaderTemplate(\d+)$/i) |
|
|
{ |
|
|
$key="HeaderTemplate$1"; |
|
|
$ExtraKeys{$key}=1; |
|
|
} |
|
284 |
|
|
285 |
&usage("Unknown parameter name '$kOrig'") unless(defined($key)); |
&usage("Unknown parameter name '$kOrig'") unless(defined($key)); |
286 |
|
|
288 |
|
|
289 |
#print "$kOrig: $key\n"; |
#print "$kOrig: $key\n"; |
290 |
|
|
291 |
$CommandLine{$key}=1; |
$CommandLine{"$key$mode"}=1; |
292 |
|
|
293 |
if($cnt>1 && $_[0]!~/^\-(?!\-)/) |
if($cnt>1 && $_[0]!~/^\-(?!\-)/) |
294 |
{ |
{ |
295 |
my $param=shift; |
my $param=shift; |
296 |
$param=~s/^\-\-/\-/; |
$param=~s/^\-\-/\-/; |
297 |
$CommandLine{$key}=$param; |
$CommandLine{"$key$mode"}=$param; |
298 |
} |
} |
299 |
} |
} |
300 |
|
|
311 |
my $path=$class->valueForKey('ConfigFileLocation'); |
my $path=$class->valueForKey('ConfigFileLocation'); |
312 |
return unless(defined($path) && -f $path); |
return unless(defined($path) && -f $path); |
313 |
|
|
314 |
|
my $mode=''; |
315 |
|
|
316 |
open(CONFIG,"$path") or &usage("Config file '$path' for read: $!\n"); |
open(CONFIG,"$path") or &usage("Config file '$path' for read: $!\n"); |
317 |
while(<CONFIG>) |
while(<CONFIG>) |
318 |
{ |
{ |
321 |
|
|
322 |
s/[\r\n]*$//; |
s/[\r\n]*$//; |
323 |
|
|
324 |
|
if(/^\s*\[\s*([^\]\s]+)\s*\]\s*$/) |
325 |
|
{ |
326 |
|
$Modes{".$1"}=1; |
327 |
|
next; |
328 |
|
} |
329 |
|
|
330 |
unless(/^(\S+)\s*(.*)/) |
unless(/^(\S+)\s*(.*)/) |
331 |
{ |
{ |
332 |
&usage("Invalid configuration file parameter line '$_'"); |
&usage("Invalid configuration file parameter line '$_'"); |
336 |
my $val=$2; |
my $val=$2; |
337 |
$val='' unless(defined($val)); |
$val='' unless(defined($val)); |
338 |
|
|
339 |
if($key=~/^HeaderTemplate\d+$/) |
unless(exists($Defaults{$key})) |
340 |
{ |
{ |
341 |
$ExtraKeys{$key}=1; |
&usage("Unknown configuration file parameter name '$key$mode'"); |
342 |
} |
} |
343 |
else |
if($key eq 'ConfigFileLocation') |
344 |
{ |
{ |
345 |
unless(exists($Defaults{$key})) |
&usage("'ConfigFileLocation' parameter not allowed in configuration file!"); |
|
{ |
|
|
&usage("Unknown configuration file parameter name '$key'"); |
|
|
} |
|
|
if($key eq 'ConfigFileLocation') |
|
|
{ |
|
|
&usage("'ConfigFileLocation' parameter not allowed in configuration file!"); |
|
|
} |
|
346 |
} |
} |
347 |
|
|
348 |
$val=~s/^--/-/; |
$val=~s/^--/-/; |
349 |
|
|
350 |
$ConfigFileData{$key}=$val; |
$ConfigFileData{"$key$mode"}=$val; |
351 |
} |
} |
352 |
close(CONFIG); |
close(CONFIG); |
353 |
} |
} |
367 |
|
|
368 |
print STDERR <<"EOT"; |
print STDERR <<"EOT"; |
369 |
|
|
370 |
Meteor server v1.0 (release date: 1 Dec 2006) |
Meteor server v$::VERSION (release date: $::RELEASE_DATE) |
371 |
Licensed under the terms of the GNU General Public Licence (2.0) |
Licensed under the terms of the GNU General Public Licence (2.0) |
372 |
|
|
373 |
Usage: |
Usage: |