HTTP: check url for scheme and report instead of failing with assert.

This commit is contained in:
Thomas Geymayer 2013-10-13 12:06:17 +02:00
parent 06a5f9188d
commit 8e75c6be50

View File

@ -30,6 +30,7 @@
#include <iostream> #include <iostream>
#include <errno.h> #include <errno.h>
#include <map> #include <map>
#include <stdexcept>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/algorithm/string/case_conv.hpp> #include <boost/algorithm/string/case_conv.hpp>
@ -666,6 +667,9 @@ void Client::update(int waitTimeout)
void Client::makeRequest(const Request_ptr& r) void Client::makeRequest(const Request_ptr& r)
{ {
if( r->url().find("://") == std::string::npos )
throw std::runtime_error("Unable to parse URL (missing scheme)");
string host = r->host(); string host = r->host();
int port = r->port(); int port = r->port();
if (!d->proxy.empty()) { if (!d->proxy.empty()) {