-
Notifications
You must be signed in to change notification settings - Fork 13
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
Problem with the client provider on windows #2
Comments
Hello @remioukrat , Please share your endpoint code and the full error message. |
It’s just the sample for the redirection: ENDPOINT_ASYNC("GET", "/api/get", TestApiGet)
{
ENDPOINT_ASYNC_INIT(TestApiGet)
Action act() override {
return controller->myClient->apiGetAsync().callbackTo(&TestApiGet::onResponse);
}
Action onResponse(const std::shared_ptr<IncomingResponse>&response) {
return response->readBodyToStringAsync().callbackTo(&TestApiGet::returnResult);
}
Action returnResult(const oatpp::String & body) {
return _return(controller->createResponse(Status::CODE_200, body));
}
}; and the error returned $ curl -X GET "https://localhost:8443/api/get" --insecure
server=oatpp/1.2.0
code=500
description=Internal Server Error
message=[oatpp::network::tcp::client::ConnectionProvider::getConnectionAsync()]: Error. Can't connect. |
Hey @remioukrat , From your code and from the error message - it's clear that the ApiClient is not able to connect to remote service. Check that the client connection provider is set up correctly. |
Hi @lganzzzo For the connection provider I have used the code available in the example : OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ClientConnectionProvider>, sslClientConnectionProvider) ("clientConnectionProvider", [] {
auto config = oatpp::libressl::Config::createShared();
tls_config_insecure_noverifycert(config->getTLSConfig());
tls_config_insecure_noverifyname(config->getTLSConfig());
return oatpp::libressl::client::ConnectionProvider::createShared(config, {"httpbin.org", 443});
}());
OATPP_CREATE_COMPONENT(std::shared_ptr<MyApiClient>, myApiClient)([] {
OATPP_COMPONENT(std::shared_ptr<oatpp::network::ClientConnectionProvider>, connectionProvider, "clientConnectionProvider");
OATPP_COMPONENT(std::shared_ptr<oatpp::data::mapping::ObjectMapper>, objectMapper);
auto requestExecutor = oatpp::web::client::HttpRequestExecutor::createShared(connectionProvider);
return MyApiClient::createShared(requestExecutor, objectMapper);
}()); And for the client it’s the same: #ifndef MyApiClient_hpp
#define MyApiClient_hpp
#include "oatpp/web/client/ApiClient.hpp"
#include "oatpp/core/data/mapping/type/Object.hpp"
#include "oatpp/core/macro/codegen.hpp"
#include OATPP_CODEGEN_BEGIN(ApiClient)
class MyApiClient : public oatpp::web::client::ApiClient {
API_CLIENT_INIT(MyApiClient)
API_CALL("GET", "/get", apiGet)
API_CALL_ASYNC("GET", "/get", apiGetAsync)
};
#include OATPP_CODEGEN_END(ApiClient)
#endif /* MyApiClient_hpp */ |
Ok, I see. It might be some kind of LibreSSL config that is missing on Windows.
Apart from that, I would recommend (it's not related to the issue):
|
No, I have just tryed to hit httpbin.org. This example works in a linux docker but not on Windows. |
That's sounds interesting. I can't check on windows at the moment. I would suggest making sure that tls_config_insecure_noverifycert(config->getTLSConfig());
tls_config_insecure_noverifyname(config->getTLSConfig()); |
When we run the service on windows.
If we try to do :
curl -X GET "https://localhost:8443/api/get" --insecure
we have always an internal server error 500.
It happens only on the endpoint where there is a redirection.
The text was updated successfully, but these errors were encountered: