diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Handle.cc | 20 | ||||
-rw-r--r-- | lib/HttpServ.cc | 41 | ||||
-rw-r--r-- | lib/TaskMan.cc | 8 |
3 files changed, 34 insertions, 35 deletions
diff --git a/lib/Handle.cc b/lib/Handle.cc index 7b56df4..0221e71 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -7,19 +7,19 @@ #include "config.h" Handle::Handle(const Handle & nh) : h(nh.h >= 0 ? dup(nh.h) : nh.h), closed(false), nonblock(false), zfile(0), z(0) { - cerr << "Duplication of handle " << nh.h << " to " << h << endl; +// cerr << "Duplication of handle " << nh.h << " to " << h << endl; if ((h >= 0) && (nh.z)) { SetZ(nh.z); } } Handle::~Handle() { - cerr << "Destroying handle " << h << endl; +// cerr << "Destroying handle " << h << endl; close(); } Handle::Handle(int nh) : h(nh), closed(false), zfile(0), z(0) { - cerr << "Initialising handle " << h << endl; +// cerr << "Initialising handle " << h << endl; } int Handle::GetHandle() { @@ -139,9 +139,9 @@ void Handle::close() throw (GeneralException) { if (h >= 0) { if (z) { - cerr << "Performing gzclose on handle " << h << endl; +// cerr << "Performing gzclose on handle " << h << endl; int err = gzclose(zfile); - cerr << "gzclose returned " << err << endl; +// cerr << "gzclose returned " << err << endl; if (err) { if (err == Z_ERRNO) { throw GeneralException(String(_("Error during close: ")) + strerror(errno)); @@ -212,7 +212,7 @@ void Handle::SetZ(int az) throw (GeneralException) { } format[index++] = (char) (z + '0'); format[index] = 0; - cerr << "Performing gzdopen on handle " << h << " with mode \"" << format << "\"\n"; +// cerr << "Performing gzdopen on handle " << h << " with mode \"" << format << "\"\n"; if (!(zfile = gzdopen(h, format))) { throw GeneralException(_("Was not able to gzdopen.")); } @@ -221,9 +221,9 @@ void Handle::SetZ(int az) throw (GeneralException) { ssize_t Handle::uwrite(const void * buf, size_t count) throw (GeneralException) { if (z) { - cerr << "Performing gzwrite of " << count << " byte for handle " << h << endl; +// cerr << "Performing gzwrite of " << count << " byte for handle " << h << endl; int err = gzwrite(zfile, buf, count); - cerr << "gzwrite returned " << err << endl; +// cerr << "gzwrite returned " << err << endl; if (err == 0) { const char * m = gzerror(zfile, &err); if (err == Z_ERRNO) { @@ -240,9 +240,9 @@ ssize_t Handle::uwrite(const void * buf, size_t count) throw (GeneralException) ssize_t Handle::uread(void * buf, size_t count) { if (z) { - cerr << "Performing gzread of " << count << " byte for handle " << h << endl; +// cerr << "Performing gzread of " << count << " byte for handle " << h << endl; int err = gzread(zfile, buf, count); - cerr << "gzwrite returned " << err << endl; +// cerr << "gzwrite returned " << err << endl; if (err == -1) { gzerror(zfile, &err); if (err == Z_ERRNO) { diff --git a/lib/HttpServ.cc b/lib/HttpServ.cc index 3f2e735..c20862a 100644 --- a/lib/HttpServ.cc +++ b/lib/HttpServ.cc @@ -60,16 +60,16 @@ int ProcessRequest::Do() { bad = false; - cerr << "---- Got a request from handle " << s.GetHandle() << " \n"; +// cerr << "---- Got a request from handle " << s.GetHandle() << " \n"; post = ParseUri(file, domain, &b); len = -1; do { b >> t; - // cerr << "Read Request (n): " << t << endl; +// cerr << "Read Request (n): " << t << endl; if ((t.strstr("Content-Length: ") == 0) || (t.strstr("Content-length: ") == 0)) { - // cerr << "Saw 'Content-Lenght:', reading length from '" << t.extract(16) << "'\n"; +// cerr << "Saw 'Content-Lenght:', reading length from '" << t.extract(16) << "'\n"; len = t.extract(16).to_int(); } if (t.strstr("Host: ") == 0) { @@ -77,7 +77,7 @@ int ProcessRequest::Do() { } } while (t.strlen()); - // cerr << "---- Processing it.\n"; +// cerr << "---- Processing it.\n"; hasvars = false; @@ -85,11 +85,11 @@ int ProcessRequest::Do() { // On a pas eu de ligne 'Content-Length' mais on a eu une méthode POST. // Cela est une erreur. if (len == -1) { - cerr << "Error: method POST but no Content-Length\n"; +// cerr << "Error: method POST but no Content-Length\n"; bad = true; Vars = new Variables(); } else { - // cerr << "Got a POST request. Parsing variables. (len = " << len << ")\n"; +// cerr << "Got a POST request. Parsing variables. (len = " << len << ")\n"; // Les variables seront initialisées ici. hasvars = true; } @@ -112,7 +112,7 @@ int ProcessRequest::Do() { ParseVars(&b, len); } - cerr << " Domain = '" << domain << "' - File = '" << file << "'\n"; +// cerr << " Domain = '" << domain << "' - File = '" << file << "'\n"; if (!bad) { // Nous vérifions le domaine. @@ -123,7 +123,7 @@ int ProcessRequest::Do() { if (domain == "/bin") bad = false; if (domain == "/") bad = false; if (bad) { - cerr << "Error: bad domain.\n"; +// cerr << "Error: bad domain.\n"; } } else { // L'url sans domaine ni fichier est valide. (cela arrive sur certains navigateurs...) @@ -157,11 +157,11 @@ int ProcessRequest::Do() { SendHeads(&b, GetMime(file), String("Accept-Ranges: bytes") + endhl + "Content-Length: " + (unsigned long long int) i->GetSize() + endhl, i->GetModif()); i->SetNonBlock(); a = new CopyJob(i, &s); - cerr << "File found, dumping.\n"; +// cerr << "File found, dumping.\n"; } catch (IOGeneral e) { ShowError(&b); - cerr << "File not found, error showed.\n"; +// cerr << "File not found, error showed.\n"; } } } @@ -169,7 +169,7 @@ int ProcessRequest::Do() { if (a) a->Stop(); delete Vars; - // cerr << "---- Sending header buffer.\n"; +// cerr << "---- Sending header buffer.\n"; c = new CopyJob(&b, &s, -1, false); WaitFor(c); current = 3; @@ -179,7 +179,7 @@ int ProcessRequest::Do() { delete c; if (a) { - // cerr << "---- Sending contents.\n"; +// cerr << "---- Sending contents.\n"; a->Restart(); WaitFor(a); current = 4; @@ -188,8 +188,7 @@ int ProcessRequest::Do() { case 4: if (a) delete a; - - cerr << "---- End of Request.\n"; +// cerr << "---- End of Request.\n"; } return TASK_DONE; } @@ -205,7 +204,7 @@ void ProcessRequest::ParseVars(Handle * s, int len) { s->read(&l, 1); t += l; } - cerr << "Post variables line: '" << t << "'\n"; +// cerr << "Post variables line: '" << t << "'\n"; // Les variables sont sous la forme 'var1=val1&var2=val2&val3=var3'. Donc le nombre d'occurences @@ -261,7 +260,7 @@ bool ProcessRequest::ParseUri(String & file, String & domain, Handle * s) { ssize_t sppos; *s >> t; - cerr << "Read Request (1): " << t << endl; +// cerr << "Read Request (1): " << t << endl; bad = false; @@ -272,7 +271,7 @@ bool ProcessRequest::ParseUri(String & file, String & domain, Handle * s) { p = t.to_charp(5); post = true; } else { - cerr << "Error: unknow request.\n"; +// cerr << "Error: unknow request.\n"; bad = true; } break; @@ -280,12 +279,12 @@ bool ProcessRequest::ParseUri(String & file, String & domain, Handle * s) { if (t.extract(1, 3) == "ET ") { p = t.to_charp(4); } else { - cerr << "Error: unknow request.\n"; +// cerr << "Error: unknow request.\n"; bad = true; } break; default: - cerr << "Error: unknow request.\n"; +// cerr << "Error: unknow request.\n"; bad = true; } @@ -400,7 +399,7 @@ String ProcessRequest::GetMime(const String & f) { HttpServ::HttpServ(Action * ap, int port, const String & nname) throw (GeneralException) : p(ap), name(nname), localport(port) { bool r = true; - cerr << "Initialising Mini HTTP-Server on port " << localport << endl; +// cerr << "Initialising Mini HTTP-Server on port " << localport << endl; r = Listener.SetLocal("", port); if (!r) { @@ -416,7 +415,7 @@ HttpServ::HttpServ(Action * ap, int port, const String & nname) throw (GeneralEx Listener.SetNonBlock(); WaitFor(&Listener, W4_STICKY | W4_READING); - cerr << "Mini HTTP-Server '" << name << "' ready and listening for port " << port << endl; +// cerr << "Mini HTTP-Server '" << name << "' ready and listening for port " << port << endl; } HttpServ::~HttpServ(void) { diff --git a/lib/TaskMan.cc b/lib/TaskMan.cc index 3968f6b..9053d0b 100644 --- a/lib/TaskMan.cc +++ b/lib/TaskMan.cc @@ -147,7 +147,7 @@ void TaskMan::MainLoop() throw (GeneralException) { if (stopped) return; - cerr << "-=- TaskMan: begin main loop with " << number << " task to manage.\n"; +// cerr << "-=- TaskMan: begin main loop with " << number << " task to manage.\n"; no_burst = 0; while (!no_burst) { @@ -157,7 +157,7 @@ void TaskMan::MainLoop() throw (GeneralException) { Task * t = *p; if (t->GetState() == TASK_BURST) { - cerr << "-=- TaskMan: running burning task " << t->GetName() << endl; +// cerr << "-=- TaskMan: running burning task " << t->GetName() << endl; t->Run(); /* if the task added some new tasks, we have to rerun the loop */ no_burst = 0; @@ -274,7 +274,7 @@ void TaskMan::MainLoop() throw (GeneralException) { touched = false; if ((p->ha->GetHandle() == fd) && (!p->T->IsStopped()) && (p->T->GetState() != TASK_DONE) && (!p->dirthy)) { // We've got one, launch it. - cerr << "-=- TaskMan: launching task " << p->T->GetName() << " for handle " << p->ha->GetHandle() << endl; +// cerr << "-=- TaskMan: launching task " << p->T->GetName() << " for handle " << p->ha->GetHandle() << endl; w4ha_t w4 = *p; p->dirthy = true; @@ -320,7 +320,7 @@ void TaskMan::MainLoop() throw (GeneralException) { } if ((o = t->WaitedBy())) { - cerr << "-=- TaskMan: running task " << o->GetName() << " for task " << t->GetName() << endl; +// cerr << "-=- TaskMan: running task " << o->GetName() << " for task " << t->GetName() << endl; o->Run(); if (o->GetState() == TASK_DONE) { |