Make sure the gopher server reads the config file and skips surge
protection if $SurgeProtection is set to 0. The tests do this. If we
don't do this, tests start failing after a while.
Instead of calling DoSurgeProtection as part of process_request and
faking username and overwriting ReportError, I've moved the essential
code to allow_deny_hook which seems to be the place dedicated to this
sort of code. Sadly, push(@{$self->{server}->{deny}}, $peeraddr) seems
to have no effect. When the next request comes around, the deny list
is empty again. I guess we would have to persist this somehow. For
now, we're simply using allow_deny_hook and that seems to be just as
well.
We want to avoid turning & into & when printing a menu, so we don't
want to call NormalToFree because it callse QuoteHtml. Replaced all
calls with normal_to_free which only translates underscores to spaces.
Removing IP number ("host") from page files and keep files. The IP
numbers remain in the RC file. GetAuthor and GetAuthorLink now take
username as a first argument and host as an optional second argument.
Sorry for the incompatible change.
As discussed in issue #38 of VF-1 and on the #gopherproject channel,
newer software does not double leading periods and does send final
periods, so this commit simplifies the code and no longer does that,
either. https://github.com/solderpunk/VF-1/issues/38
Also other improvements, hopefully. There are still problems regarding
feedback. When uploading a file twice in succession, for example, the
second call produces no output until a few seconds have passed.
echo -e "Alex/image/png/write/file\t"`wc -c < test.png` \
| cat - test.png | nc localhost 7070
echo -e "Alex/image/png/write/file\t"`wc -c < test.png` \
| cat - test.png | nc localhost 7070
I really have no idea why this is. The log output is correct but
printing to the stream just doesn't work anymore. Has it been closed
in the mean time?
When uploading big files, they get sent in chunks we therefore have to
detect the end of the file being sent. A final period on a line by
itself ("\n.\n") will have to do -- even for binary uploads.
We're now printing (useless) host and port data on info lines as well,
just because these lines might otherwise not get parsed correctly by
clients. It's a useless waste of bandwidth, though.