diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Exceptions.cc | 2 | ||||
-rw-r--r-- | lib/HttpServ.cc | 8 | ||||
-rw-r--r-- | lib/OutPipe.cc | 4 | ||||
-rw-r--r-- | lib/String.cc | 6 |
4 files changed, 12 insertions, 8 deletions
diff --git a/lib/Exceptions.cc b/lib/Exceptions.cc index 6e4ddbe..10b82a5 100644 --- a/lib/Exceptions.cc +++ b/lib/Exceptions.cc @@ -40,7 +40,7 @@ MemoryException::MemoryException(ssize_t s) { } IOException::IOException(String fn, op_t op, ssize_t s) { - sprintf(t, _("An error has occured while %s %ld bytes from %s: %s"), op == IO_WRITE ? _("writing") : _("reading"), + sprintf(t, _("An error has occured while %s %ld bytes on %s: %s"), op == IO_WRITE ? _("writing") : _("reading"), s, fn.to_charp(), strerror(errno)); msg = strdup(t); } diff --git a/lib/HttpServ.cc b/lib/HttpServ.cc index ccff319..14e48e1 100644 --- a/lib/HttpServ.cc +++ b/lib/HttpServ.cc @@ -419,13 +419,15 @@ HttpServ::HttpServ(Action * ap, int port, const String & nname) throw (GeneralEx cerr << "Mini HTTP-Server '" << name << "' ready and listening for port " << port << endl; } +HttpServ::~HttpServ(void) { + Listener.close(); +} + int HttpServ::Do() { try { - Task * r; - Socket s = Listener.Accept(); s.SetNonBlock(); - r = new ProcessRequest(p, s, name, localport); + new ProcessRequest(p, s, name, localport); } catch (GeneralException) { } diff --git a/lib/OutPipe.cc b/lib/OutPipe.cc index 456a5bd..9e60b15 100644 --- a/lib/OutPipe.cc +++ b/lib/OutPipe.cc @@ -19,11 +19,11 @@ void OutPipe::Hook() { } bool OutPipe::CanWrite() { - return false; + return true; } bool OutPipe::CanRead() { - return true; + return false; } String OutPipe::GetName() { diff --git a/lib/String.cc b/lib/String.cc index 83adad7..60ca6df 100644 --- a/lib/String.cc +++ b/lib/String.cc @@ -181,12 +181,14 @@ ostream & operator<<(ostream & os, const String & s) { } istream & operator>>(istream & is, String & s) { - char c; + char c = 0; s.set(""); while (!is.eof()) { - is >> c; + c = is.get(); + if (c == '\n') return is; + if (c == '\r') continue; s += c; } |