diff --git a/Net/include/Poco/Net/HTTPRequest.h b/Net/include/Poco/Net/HTTPRequest.h index 497ff26c6..1cf865507 100644 --- a/Net/include/Poco/Net/HTTPRequest.h +++ b/Net/include/Poco/Net/HTTPRequest.h @@ -136,6 +136,7 @@ public: static const std::string HTTP_DELETE; static const std::string HTTP_TRACE; static const std::string HTTP_CONNECT; + static const std::string HTTP_PATCH; static const std::string HOST; static const std::string COOKIE; diff --git a/Net/include/Poco/Net/SocketAddress.h b/Net/include/Poco/Net/SocketAddress.h index 164742d8b..d6ebd053a 100644 --- a/Net/include/Poco/Net/SocketAddress.h +++ b/Net/include/Poco/Net/SocketAddress.h @@ -91,6 +91,10 @@ public: /// 192.168.1.10:80 /// [::ffff:192.168.1.120]:2040 /// www.appinf.com:8080 + /// + /// On POSIX platforms supporting UNIX_LOCAL sockets, hostAndPort + /// can also be the absolute path of a local socket, starting with a + /// slash, e.g. "/tmp/local.socket". SocketAddress(Family family, const std::string& addr); /// Creates a SocketAddress of the given family from a diff --git a/Net/src/HTTPRequest.cpp b/Net/src/HTTPRequest.cpp index 74d3a5824..61d7c6651 100644 --- a/Net/src/HTTPRequest.cpp +++ b/Net/src/HTTPRequest.cpp @@ -37,6 +37,7 @@ const std::string HTTPRequest::HTTP_OPTIONS = "OPTIONS"; const std::string HTTPRequest::HTTP_DELETE = "DELETE"; const std::string HTTPRequest::HTTP_TRACE = "TRACE"; const std::string HTTPRequest::HTTP_CONNECT = "CONNECT"; +const std::string HTTPRequest::HTTP_PATCH = "PATCH"; const std::string HTTPRequest::HOST = "Host"; const std::string HTTPRequest::COOKIE = "Cookie"; const std::string HTTPRequest::AUTHORIZATION = "Authorization"; diff --git a/Net/src/SocketAddress.cpp b/Net/src/SocketAddress.cpp index 675edf319..1c2608394 100644 --- a/Net/src/SocketAddress.cpp +++ b/Net/src/SocketAddress.cpp @@ -285,6 +285,14 @@ void SocketAddress::init(const std::string& hostAndPort) std::string port; std::string::const_iterator it = hostAndPort.begin(); std::string::const_iterator end = hostAndPort.end(); + +#if defined(POCO_OS_FAMILY_UNIX) + if (*it == '/') + { + newLocal(hostAndPort); + return; + } +#endif if (*it == '[') { ++it; diff --git a/Net/testsuite/src/SocketAddressTest.cpp b/Net/testsuite/src/SocketAddressTest.cpp index e174c15f4..e54cedb21 100644 --- a/Net/testsuite/src/SocketAddressTest.cpp +++ b/Net/testsuite/src/SocketAddressTest.cpp @@ -170,6 +170,10 @@ void SocketAddressTest::testSocketAddressUnixLocal() SocketAddress sa3(SocketAddress::UNIX_LOCAL, "/tmp/sock1"); assert (sa1 == sa3); assert (!(sa1 < sa3)); + + SocketAddress sa4("/tmp/sock1"); + assert (sa1 == sa4); + assert (sa4.toString() == "/tmp/sock1"); #endif }