From 323f74c43aecf9d2c5d82c9cff6376f277ce3854 Mon Sep 17 00:00:00 2001 From: hagen Date: Fri, 1 Jul 2016 00:00:00 +0000 Subject: [PATCH 1/4] * HTTP.cpp : fuck the "special cases", use nginx rewriting frontend or some --- HTTP.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/HTTP.cpp b/HTTP.cpp index 71d277de..76ab54ac 100644 --- a/HTTP.cpp +++ b/HTTP.cpp @@ -72,10 +72,6 @@ namespace http { bool URL::parse(const std::string& url) { std::size_t pos_p = 0; /* < current parse position */ std::size_t pos_c = 0; /* < work position */ - if (url.at(0) == '/' && url.find("/http://") == 0) { - /* special case for i2p.rocks inproxy */ - pos_p ++; - } if(url.at(0) != '/' || pos_p > 0) { /* schema */ pos_c = url.find("://"); From 02ac638bd4fd1230e4aec5edb183cdc8537abcbe Mon Sep 17 00:00:00 2001 From: hagen Date: Fri, 1 Jul 2016 00:00:00 +0000 Subject: [PATCH 2/4] * HTTP.cpp : add comments, update test case --- HTTP.cpp | 9 +++++---- tests/test-http-url.cpp | 12 ++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/HTTP.cpp b/HTTP.cpp index 76ab54ac..27421241 100644 --- a/HTTP.cpp +++ b/HTTP.cpp @@ -73,6 +73,7 @@ namespace http { std::size_t pos_p = 0; /* < current parse position */ std::size_t pos_c = 0; /* < work position */ if(url.at(0) != '/' || pos_p > 0) { + std::size_t pos_s = 0; /* schema */ pos_c = url.find("://"); if (pos_c != std::string::npos) { @@ -80,9 +81,9 @@ namespace http { pos_p = pos_c + 3; } /* user[:pass] */ - pos_c = url.find('@', pos_p); - std::size_t pos_slash = url.find('/', pos_p); - if (pos_c != std::string::npos && (pos_slash == std::string::npos || pos_slash > pos_c)) { + pos_s = url.find('/', pos_p); /* find first slash */ + pos_c = url.find('@', pos_p); /* find end of 'user' or 'user:pass' part */ + if (pos_c != std::string::npos && (pos_s == std::string::npos || pos_s > pos_c)) { std::size_t delim = url.find(':', pos_p); if (delim != std::string::npos && delim < pos_c) { user = url.substr(pos_p, delim - pos_p); @@ -91,7 +92,7 @@ namespace http { } else { user = url.substr(pos_p, pos_c - pos_p); } - pos_p = pos_c + 1; + pos_p = pos_c + 1; } /* hostname[:port][/path] */ pos_c = url.find_first_of(":/", pos_p); diff --git a/tests/test-http-url.cpp b/tests/test-http-url.cpp index d574f1e2..37e9c45e 100644 --- a/tests/test-http-url.cpp +++ b/tests/test-http-url.cpp @@ -104,6 +104,18 @@ int main() { assert(url->query == ""); delete url; + url = new URL; + assert(url->parse("http://user:password@site.com:84/asdasd/@17#frag") == true); + assert(url->schema == "http"); + assert(url->user == "user"); + assert(url->pass == "password"); + assert(url->host == "site.com"); + assert(url->port == 84); + assert(url->path == "/asdasd/@17"); + assert(url->query == ""); + assert(url->frag == "frag"); + delete url; + return 0; } From 4d108489840b7cca1dc713fc15a311f944755c18 Mon Sep 17 00:00:00 2001 From: MXPLRS | Kirill Date: Fri, 1 Jul 2016 13:07:24 +0300 Subject: [PATCH 3/4] Update i2pd_qt.pro --- qt/i2pd_qt/i2pd_qt.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qt/i2pd_qt/i2pd_qt.pro b/qt/i2pd_qt/i2pd_qt.pro index db3f21c8..567f3d66 100644 --- a/qt/i2pd_qt/i2pd_qt.pro +++ b/qt/i2pd_qt/i2pd_qt.pro @@ -50,7 +50,7 @@ HEADERS += DaemonQT.h mainwindow.h \ ../../Streaming.h ../../Timestamp.h ../../TransitTunnel.h ../../Transports.h \ ../../TransportSession.h ../../Tunnel.h ../../TunnelBase.h ../../TunnelConfig.h \ ../../TunnelEndpoint.h ../../TunnelGateway.h ../../TunnelPool.h ../../UPnP.h \ - ../../util.h ../../version.h ..//../Gzip.h ../../Tag.h + ../../util.h ../../version.h ../../Gzip.h ../../Tag.h FORMS += mainwindow.ui From a9a33c61793000f39f1ae293f3640bffc293aefa Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 1 Jul 2016 08:31:27 -0400 Subject: [PATCH 4/4] fixed build error --- util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util.cpp b/util.cpp index 909040c8..89bcda6c 100644 --- a/util.cpp +++ b/util.cpp @@ -419,7 +419,7 @@ namespace net { #ifdef WIN32 LogPrint(eLogError, "NetIface: cannot get address by interface name, not implemented on WIN32"); - return boost::asio::ip::from_string("127.0.0.1"); + return boost::asio::ip::address::from_string("127.0.0.1"); #else int af = (ipv6 ? AF_INET6 : AF_INET); ifaddrs * addrs = nullptr;