diff options
Diffstat (limited to 'lib/HttpServ.cc')
-rw-r--r-- | lib/HttpServ.cc | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/HttpServ.cc b/lib/HttpServ.cc index dfead28..97152a9 100644 --- a/lib/HttpServ.cc +++ b/lib/HttpServ.cc @@ -37,8 +37,8 @@ void HttpServ::ProcessRequest(Action * p) { s >> t; cerr << t << endl; if ((t.strstr("Content-Length: ") == 0) || (t.strstr("Content-length: ") == 0)) { - cerr << "Saw 'Content-Lenght:', reading length from '" << t.to_charp(16) << "'\n"; - len = String(t.to_charp(16)).to_int(); + cerr << "Saw 'Content-Lenght:', reading length from '" << t.extract(16) << "'\n"; + len = t.extract(16).to_int(); } } while (t.strlen()); @@ -173,7 +173,7 @@ void HttpServ::ParseVars(Socket & s, int len) { bool HttpServ::ParseUri(String & file, String & domain, Socket & s) { String t, Uri; bool post = false; - char * p; + char * p = NULL; ssize_t sppos; s >> t; @@ -184,15 +184,13 @@ bool HttpServ::ParseUri(String & file, String & domain, Socket & s) { // p nous indiquera la position de la chaîne URL. switch (t[0]) { case 'P': /* POST? */ - p = t.to_charp(1, 4); - if (!strcmp(p, "OST ")) { + if (t.extract(1, 4) == "OST ") { p = t.to_charp(5); post = true; break; } case 'G': /* GET? */ - p = t.to_charp(1, 3); - if (!strcmp(p, "ET ")) { + if (t.extract(1, 3) == "ET ") { p = t.to_charp(4); break; } @@ -284,7 +282,7 @@ String HttpServ::GetMime(const String & f) { ppos = f.strrchr('.'); if (ppos >= 0) { - ext = f.to_charp(ppos + 1); + ext = f.extract(ppos + 1); if (ext == "jpg") return "image/jpeg"; if (ext == "jpeg") return "image/jpeg"; if (ext == "htm") return "text/html"; |