X-Git-Url: http://git.tdb.fi/?p=libs%2Fnet.git;a=blobdiff_plain;f=source%2Fhttp%2Fserver.cpp;fp=source%2Fhttp%2Fserver.cpp;h=04bae0b4d8c24f7f9e72177c923c19fc2234083c;hp=9c9a876a411bd28616922edef1f535f5df4cb525;hb=0cd8309240cd48fdc16d9cc433297e33a0a2cdd0;hpb=9d41b029e940bacf17a3c8d7cc06162f0a41b70a diff --git a/source/http/server.cpp b/source/http/server.cpp index 9c9a876..04bae0b 100644 --- a/source/http/server.cpp +++ b/source/http/server.cpp @@ -146,7 +146,7 @@ void Server::client_data_available(Client &cl) cl.request = make_unique(Request::parse(cl.in_buf)); string addr_str = cl.sock->get_peer_address().str(); - string::size_type colon = addr_str.find(':'); + string::size_type colon = addr_str.find(':', (addr_str[0]=='[' ? addr_str.find(']')+1 : 0)); cl.request->set_header("-Client-Host", addr_str.substr(0, colon)); if(cl.request->get_method()!="GET" && cl.request->get_method()!="POST")