//
#include "plaqui/server/httpheaders.h"
+#include "plaqui/server/httperror.h"
#include "plaqui/server/string.h"
//#include <cstdlib>
#ifdef DEBUG
#endif // DEBUG
}
-istream& operator>>(istream& is, HTTPHeaders& h) {
+istream& operator>>(istream& is, HTTPHeaders& h) throw(HTTPError) {
#ifdef DEBUG
cerr << __FILE__ << ": operator>>()" << endl;
#endif // DEBUG
string::size_type pos = sbuf.find(":");
if (pos == string::npos) {
// FIXME poner mejores excepciones.
- throw string("Wrong header: ") + sbuf;
+ throw HTTPError(400, sbuf + ": No es una cabecera válida.");
}
h[sbuf.substr(0, pos)] = String(sbuf.substr(pos + 1)).trim();
#ifdef DEBUG
#endif // DEBUG
for (HTTPHeaders::const_iterator i = h.begin();
i != h.end(); ++i) {
- os << i->first << ": " << i->second << "\n\r";
+ os << i->first << ": " << i->second << "\r\n";
}
return os;
}