forked from tastytea/libravatarserv
Added algorithm include, fixed off-by-one error in http::get_parameter()
This commit is contained in:
parent
75841d87a4
commit
9ff1cc0acf
|
@ -15,12 +15,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <algorithm>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include "libravatarserv.hpp"
|
#include "libravatarserv.hpp"
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::cerr;
|
using std::cerr;
|
||||||
using global::avatar_dir;
|
|
||||||
using namespace http;
|
using namespace http;
|
||||||
|
|
||||||
const Request http::parse_request(const string &request)
|
const Request http::parse_request(const string &request)
|
||||||
|
@ -74,7 +74,7 @@ const string http::get_parameter(const string &request, const string ¶meter)
|
||||||
std::size_t pos = request.find(parameter + "=");
|
std::size_t pos = request.find(parameter + "=");
|
||||||
if (pos != std::string::npos)
|
if (pos != std::string::npos)
|
||||||
{
|
{
|
||||||
pos += parameter.length();
|
pos += (1 + parameter.length());
|
||||||
return request.substr(pos, request.find('&', pos));
|
return request.substr(pos, request.find('&', pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <basedir.h>
|
#include <basedir.h>
|
||||||
#include "version.hpp"
|
#include "version.hpp"
|
||||||
|
|
Loading…
Reference in New Issue