X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/df4733677cb16642b53628d22e4d927aadad8b27..f5a1e732bf3907cabd004932aba3256b31d9d282:/Server/src/httpheaders.cpp diff --git a/Server/src/httpheaders.cpp b/Server/src/httpheaders.cpp index 65d5adc..04bd6c8 100644 --- a/Server/src/httpheaders.cpp +++ b/Server/src/httpheaders.cpp @@ -26,6 +26,7 @@ // #include "plaqui/server/httpheaders.h" +#include "plaqui/server/httperror.h" #include "plaqui/server/string.h" //#include #ifdef DEBUG @@ -44,7 +45,7 @@ HTTPHeaders::~HTTPHeaders(void) { #endif // DEBUG } -istream& operator>>(istream& is, HTTPHeaders& h) { +istream& operator>>(istream& is, HTTPHeaders& h) throw(HTTPError) { #ifdef DEBUG cerr << __FILE__ << ": operator>>()" << endl; #endif // DEBUG @@ -54,7 +55,7 @@ istream& operator>>(istream& is, HTTPHeaders& h) { 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 @@ -70,7 +71,7 @@ ostream& operator<<(ostream& os, const HTTPHeaders& h) { #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; }