diff options
-rw-r--r-- | include/Exceptions.h | 2 | ||||
-rw-r--r-- | include/HttpServ.h | 2 | ||||
-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 |
6 files changed, 14 insertions, 10 deletions
diff --git a/include/Exceptions.h b/include/Exceptions.h index e72a8a2..71e2bac 100644 --- a/include/Exceptions.h +++ b/include/Exceptions.h @@ -74,7 +74,7 @@ class Base { xfree((void *) p); } static int pipe(int * p, int flag = 0) { - return xpipe(p); + return xpipe(p, flag); } }; diff --git a/include/HttpServ.h b/include/HttpServ.h index 564e24d..2518c55 100644 --- a/include/HttpServ.h +++ b/include/HttpServ.h @@ -20,7 +20,7 @@ class HttpServ : public Task { public: HttpServ(Action *, int = 1500, const String & = String("GruiK Server v0.1")) throw (GeneralException); - ~HttpServ() {} + ~HttpServ(); void SetMenu(Action *); virtual String GetName(); 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; } |