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\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', |
|
|
|
|
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 %ExtraKeys=(); |
128 |
|
our %Modes=(); |
129 |
|
|
130 |
for(my $i=0;$i<scalar(@DEFAULTS);$i+=3) |
for(my $i=0;$i<scalar(@DEFAULTS);$i+=3) |
131 |
{ |
{ |
153 |
} |
} |
154 |
push(@keys,keys %ExtraKeys); |
push(@keys,keys %ExtraKeys); |
155 |
|
|
156 |
foreach my $key (@keys) |
|
157 |
{ |
foreach my $mode ('',keys %Modes) |
158 |
if(exists($CommandLine{$key})) |
{ |
159 |
{ |
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})) |
|
160 |
{ |
{ |
161 |
print STDERR "Default" if($debug); |
my $foundValue=0; |
162 |
$::CONF{$key}=$Defaults{$key}; |
my $key=$baseKey.$mode; |
163 |
} |
|
164 |
|
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') |
|
165 |
{ |
{ |
166 |
' '; |
print STDERR "CmdLine" if($debug); |
167 |
|
$::CONF{$key}=$CommandLine{$key}; |
168 |
|
$foundValue=1; |
169 |
} |
} |
170 |
elsif($1 eq 't') |
elsif(exists($ConfigFileData{$key})) |
171 |
{ |
{ |
172 |
"\t"; |
print STDERR "CnfFile" if($debug); |
173 |
|
$::CONF{$key}=$ConfigFileData{$key}; |
174 |
|
$foundValue=1; |
175 |
} |
} |
176 |
else |
elsif(exists($Defaults{$key})) |
177 |
{ |
{ |
178 |
$1; |
print STDERR "Default" if($debug); |
179 |
|
$::CONF{$key}=$Defaults{$key}; |
180 |
|
$foundValue=1; |
181 |
} |
} |
182 |
/gex; |
|
183 |
|
next unless($foundValue); |
184 |
|
|
185 |
|
print STDERR "\t$key\t$::CONF{$key}\n" if($debug); |
186 |
|
|
187 |
|
# Take care of escapes |
188 |
|
$::CONF{$key}=~s/\\(.)/ |
189 |
|
if($1 eq 'r') |
190 |
|
{ |
191 |
|
"\r"; |
192 |
|
} |
193 |
|
elsif($1 eq 'n') |
194 |
|
{ |
195 |
|
"\n"; |
196 |
|
} |
197 |
|
elsif($1 eq 's') |
198 |
|
{ |
199 |
|
' '; |
200 |
|
} |
201 |
|
elsif($1 eq 't') |
202 |
|
{ |
203 |
|
"\t"; |
204 |
|
} |
205 |
|
else |
206 |
|
{ |
207 |
|
$1; |
208 |
|
} |
209 |
|
/gex; |
210 |
|
} |
211 |
} |
} |
|
|
|
212 |
print STDERR '-'x79 ."\n" if($debug); |
print STDERR '-'x79 ."\n" if($debug); |
213 |
} |
} |
214 |
|
|
225 |
sub setCommandLineParameters { |
sub setCommandLineParameters { |
226 |
my $class=shift; |
my $class=shift; |
227 |
|
|
228 |
|
# |
229 |
|
# Quick check if we should show the version, if so ignore everything else |
230 |
|
# Accept -v, -version, and everything in between |
231 |
|
# |
232 |
|
foreach my $p (@_) |
233 |
|
{ |
234 |
|
if(index($p,'-v')==0 && index('-version',$p)==0) |
235 |
|
{ |
236 |
|
print "$::PGM $::VERSION\n"; |
237 |
|
exit(0); |
238 |
|
} |
239 |
|
} |
240 |
|
|
241 |
while(my $cnt=scalar(@_)) |
while(my $cnt=scalar(@_)) |
242 |
{ |
{ |
243 |
my $k=shift(@_); |
my $k=shift(@_); |
245 |
|
|
246 |
$k='Debug' if($k eq 'd'); |
$k='Debug' if($k eq 'd'); |
247 |
|
|
248 |
|
my $mode=''; |
249 |
|
|
250 |
|
if($k=~s/(\..+)$//) |
251 |
|
{ |
252 |
|
$mode=$1; |
253 |
|
$Modes{$mode}=1; |
254 |
|
} |
255 |
|
|
256 |
my $key=undef; |
my $key=undef; |
257 |
my $kl=length($k); |
my $kl=length($k); |
258 |
my $kOrig=$k; |
my $kOrig=$k; |
297 |
|
|
298 |
#print "$kOrig: $key\n"; |
#print "$kOrig: $key\n"; |
299 |
|
|
300 |
$CommandLine{$key}=1; |
$CommandLine{"$key$mode"}=1; |
301 |
|
|
302 |
if($cnt>1 && $_[0]!~/^\-(?!\-)/) |
if($cnt>1 && $_[0]!~/^\-(?!\-)/) |
303 |
{ |
{ |
304 |
my $param=shift; |
my $param=shift; |
305 |
$param=~s/^\-\-/\-/; |
$param=~s/^\-\-/\-/; |
306 |
$CommandLine{$key}=$param; |
$CommandLine{"$key$mode"}=$param; |
307 |
} |
} |
308 |
} |
} |
309 |
|
|
320 |
my $path=$class->valueForKey('ConfigFileLocation'); |
my $path=$class->valueForKey('ConfigFileLocation'); |
321 |
return unless(defined($path) && -f $path); |
return unless(defined($path) && -f $path); |
322 |
|
|
323 |
|
my $mode=''; |
324 |
|
|
325 |
open(CONFIG,"$path") or &usage("Config file '$path' for read: $!\n"); |
open(CONFIG,"$path") or &usage("Config file '$path' for read: $!\n"); |
326 |
while(<CONFIG>) |
while(<CONFIG>) |
327 |
{ |
{ |
330 |
|
|
331 |
s/[\r\n]*$//; |
s/[\r\n]*$//; |
332 |
|
|
333 |
|
if(/^\s*\[\s*([^\]\s]+)\s*\]\s*$/) |
334 |
|
{ |
335 |
|
$Modes{".$1"}=1; |
336 |
|
next; |
337 |
|
} |
338 |
|
|
339 |
unless(/^(\S+)\s*(.*)/) |
unless(/^(\S+)\s*(.*)/) |
340 |
{ |
{ |
341 |
&usage("Invalid configuration file parameter line '$_'"); |
&usage("Invalid configuration file parameter line '$_'"); |
353 |
{ |
{ |
354 |
unless(exists($Defaults{$key})) |
unless(exists($Defaults{$key})) |
355 |
{ |
{ |
356 |
&usage("Unknown configuration file parameter name '$key'"); |
&usage("Unknown configuration file parameter name '$key$mode'"); |
357 |
} |
} |
358 |
if($key eq 'ConfigFileLocation') |
if($key eq 'ConfigFileLocation') |
359 |
{ |
{ |
363 |
|
|
364 |
$val=~s/^--/-/; |
$val=~s/^--/-/; |
365 |
|
|
366 |
$ConfigFileData{$key}=$val; |
$ConfigFileData{"$key$mode"}=$val; |
367 |
} |
} |
368 |
close(CONFIG); |
close(CONFIG); |
369 |
} |
} |
383 |
|
|
384 |
print STDERR <<"EOT"; |
print STDERR <<"EOT"; |
385 |
|
|
386 |
Meteor server v1.0 (release date: 1 Dec 2006) |
Meteor server v$::VERSION (release date: $::RELEASE_DATE) |
387 |
Licensed under the terms of the GNU General Public Licence (2.0) |
Licensed under the terms of the GNU General Public Licence (2.0) |
388 |
|
|
389 |
Usage: |
Usage: |