+#include "response.h"
#include <msp/strings/format.h>
#include <msp/strings/utils.h>
-#include "response.h"
using namespace std;
{
Response result;
- unsigned lf = str.find('\n');
- vector<string> parts = split(str.substr(0, lf), ' ', 2);
+ string::size_type lf = str.find('\n');
+ if(lf==0)
+ throw invalid_argument("Response::parse");
+ vector<string> parts = split(str.substr(0, lf-(str[lf-1]=='\r')), ' ', 2);
if(parts.size()<2)
throw invalid_argument("Response::parse");