my $ok = 0;
return $s->response(501) unless $id =~ /($article_re)/;
- return $s->response(430) if $s->fetch_stat($id);
+ return $s->response(435) if $s->fetch_stat($id);
return $s->response(436) unless $s->permit_posting;
$s->response(335);
'OVER MSGID' => '',
'LIST ACTIVE NEWSGROUPS OVERVIEW.FMT ACTIVE.TIMES HEADERS' => '',
STREAMING => '',
+ IMPLEMENTATION => 'if.org newsd',
);
our %hdrs = (
# TODO use a config parameter optionally here
my $dsn = $ENV{'DBI_DSN'};
- $dsn = 'dbi:Pg:dbname=news' unless defined $dsn;
+ $dsn = qq{dbi:Pg:dbname=news} unless defined $dsn;
$s->log(4, "connecting to $dsn");
- $s->{db} = DBI->connect($dsn,'','',{AutoCommit => 0,RaiseError=>1});
+ eval {
+ $s->{db} = DBI->connect($dsn,'','',{AutoCommit => 0,RaiseError=>1});
+ $s->log(4, "Can't connect to DB: $DBI::errstr") unless $s->{db};
+ };
+ if ($@) {
+ $s->log(4, "Can't connect to DB: $DBI::errstr");
+ die $@;
+ }
+ $s->log(4, "connected to $dsn");
+
+ # TODO abort if can't connect
$s->{db}->{PrintError} = 0;
$s->{db}->do("set CLIENT_ENCODING to 'SQL_ASCII'");