diff --git a/Net/src/HTTPStreamFactory.cpp b/Net/src/HTTPStreamFactory.cpp index c00c4d2ed..c2044e8d3 100644 --- a/Net/src/HTTPStreamFactory.cpp +++ b/Net/src/HTTPStreamFactory.cpp @@ -26,6 +26,8 @@ #include "Poco/UnbufferedStreamBuf.h" #include "Poco/NullStream.h" #include "Poco/StreamCopier.h" +#include "Poco/Format.h" +#include "Poco/Version.h" using Poco::URIStreamFactory; @@ -115,6 +117,12 @@ std::istream* HTTPStreamFactory::open(const URI& uri) cred.authenticate(req, res); } + req.set("User-Agent", Poco::format("poco/%d.%d.%d", + (POCO_VERSION >> 24) & 0xFF, + (POCO_VERSION >> 16) & 0xFF, + (POCO_VERSION >> 8) & 0xFF)); + req.set("Accept", "*/*"); + pSession->sendRequest(req); std::istream& rs = pSession->receiveResponse(res); bool moved = (res.getStatus() == HTTPResponse::HTTP_MOVED_PERMANENTLY || diff --git a/NetSSL_OpenSSL/src/HTTPSStreamFactory.cpp b/NetSSL_OpenSSL/src/HTTPSStreamFactory.cpp index 67296cd6d..d0438486d 100644 --- a/NetSSL_OpenSSL/src/HTTPSStreamFactory.cpp +++ b/NetSSL_OpenSSL/src/HTTPSStreamFactory.cpp @@ -26,6 +26,8 @@ #include "Poco/UnbufferedStreamBuf.h" #include "Poco/NullStream.h" #include "Poco/StreamCopier.h" +#include "Poco/Format.h" +#include "Poco/Version.h" using Poco::URIStreamFactory; @@ -118,6 +120,12 @@ std::istream* HTTPSStreamFactory::open(const URI& uri) cred.authenticate(req, res); } + req.set("User-Agent", Poco::format("poco/%d.%d.%d", + (POCO_VERSION >> 24) & 0xFF, + (POCO_VERSION >> 16) & 0xFF, + (POCO_VERSION >> 8) & 0xFF)); + req.set("Accept", "*/*"); + pSession->sendRequest(req); std::istream& rs = pSession->receiveResponse(res); bool moved = (res.getStatus() == HTTPResponse::HTTP_MOVED_PERMANENTLY ||