-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[poco] fix PocoNetSSL and PocoNetSSLWin simultaneous usage under Windows #4205
Merged
conan-center-bot
merged 18 commits into
conan-io:master
from
mathbunnyru:asalikhov/fix_poco_win
Feb 15, 2021
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
810ba3b
[poco] fix PocoNetSSL and PocoNetSSLWin simultaneous usage under Windows
39bff0d
Fix
2a70916
Try to fix netssl
23fd4c9
Try to fix netssl
6218f13
Add more complex example for netssl
416c039
Fix windows build
6e02c3f
Try to disable util
da9c964
Revert "Try to disable util"
7c7f82f
Merge branch 'master' into asalikhov/fix_poco_win
1a2e053
Use validate() method
473bc66
Try to disable net_2
fa7c6dc
Revert "Try to disable net_2"
c53e6a7
Try to disable both net and net_2
c95381b
Revert "Try to disable both net and net_2"
4f268fa
Trying to remove test_package changes
4a47315
Revert "Trying to remove test_package changes"
danimtb c26c891
fix conditional in default options
danimtb cb0a9e8
comment cpp test_pacakge lines
danimtb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,47 @@ | ||
#include "Poco/Net/Context.h" | ||
#include "Poco/Net/HTTPSClientSession.h" | ||
#include "Poco/Net/SSLManager.h" | ||
#include "Poco/StreamCopier.h" | ||
#include "Poco/URI.h" | ||
#include "Poco/Exception.h" | ||
#include "Poco/SharedPtr.h" | ||
#include "Poco/Net/SSLManager.h" | ||
#include "Poco/Net/KeyConsoleHandler.h" | ||
#include "Poco/Net/AcceptCertificateHandler.h" | ||
#include "Poco/Net/HTTPSClientSession.h" | ||
#include "Poco/Net/HTTPRequest.h" | ||
#include "Poco/Net/HTTPResponse.h" | ||
#include <memory> | ||
#include <iostream> | ||
|
||
using namespace Poco; | ||
using namespace Poco::Net; | ||
using Poco::Net::Context; | ||
using Poco::Net::HTTPSClientSession; | ||
using Poco::URI; | ||
|
||
int main() | ||
{ | ||
try { | ||
URI uri("https://pocoproject.org/"); | ||
const Context::Ptr context = SSLManager::instance().defaultClientContext(); | ||
HTTPSClientSession session(uri.getHost(), uri.getPort(), context); | ||
} catch (...) { } | ||
class SSLInitializer { | ||
public: | ||
SSLInitializer() { Poco::Net::initializeSSL(); } | ||
|
||
~SSLInitializer() { Poco::Net::uninitializeSSL(); } | ||
}; | ||
|
||
int main(int argc, char** argv) { | ||
SSLInitializer sslInitializer; | ||
|
||
SharedPtr<InvalidCertificateHandler> ptrCert = new AcceptCertificateHandler(false); | ||
Context::Ptr ptrContext = new Context(Context::CLIENT_USE, "", Context::VERIFY_NONE); | ||
SSLManager::instance().initializeClient(0, ptrCert, ptrContext); | ||
|
||
try { | ||
URI uri("https://httpbin.org/user-agent"); | ||
HTTPSClientSession s(uri.getHost(), uri.getPort()); | ||
HTTPRequest request(HTTPRequest::HTTP_GET, uri.getPath()); | ||
request.set("user-agent", "Poco HTTPSClientSession"); | ||
// FIXME: CCI Jenkins blocks the request making the build fail | ||
//s.sendRequest(request); | ||
//HTTPResponse response; | ||
//std::istream& rs = s.receiveResponse(response); | ||
//StreamCopier::copyStream(rs, std::cout); | ||
} catch (const Exception& ex) { | ||
std::cout << ex.displayText() << std::endl; | ||
return 1; | ||
} | ||
|
||
return 0; | ||
return 0; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice