From 596b5398b1d3b04ddfbebdba6d5e3919a2c921f7 Mon Sep 17 00:00:00 2001 From: Pixel Date: Mon, 3 Dec 2001 18:28:52 +0000 Subject: Get rid of debugging output. --- lib/HttpServ.cc | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'lib/HttpServ.cc') 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) { -- cgit v1.2.3