- protocol = protocol.trim();
- if (protocol.to_upper() == "HTTP/1.0") {
- version = "1.0";
- } else if (protocol.to_upper() == "HTTP/1.1") {
- version = "1.1";
+ protocol = protocol.trim().to_upper();
+ if (protocol.substr(0, 5) != "HTTP/") {
+ throw HTTPError(HTTPMessage::BAD_REQUEST,
+ protocol + ": Protocolo desconocido");
+ }
+ if (protocol.substr(5) == "1.0") {
+ req.version = "1.0";
+ } else if (protocol.substr(5) == "1.1") {
+ req.version = "1.1";