Fix for XcURL and cURL behavior differences. (#733)

* Add Linux build files and configure files to support LibHttpClient Linux

* resolving comments

Removed extern structs in .h file and moved them up where they were in pch_common to ensure they are defined properly

* added templates

* Update x509_cert_utilities.hpp

* Update x509_cert_utilities.hpp

change check to something defined by us

* Update x509_cert_utilities.hpp

fix error in pipeline where there are errors of an unused function.

* Update x509_cert_utilities.hpp

use elif and corrected to use else

* Update CurlEasyRequest.cpp

Fix to handle behavioral differences with cURL and XcURL

* Update CurlEasyRequest.cpp

have this be a fix/workaround for xCurl

---------

Co-authored-by: SebastianPD-XB <sebastianp@microsoft.com>
This commit is contained in:
Sebastian Perez-Delgado 2023-03-16 12:56:53 -07:00 коммит произвёл GitHub
Родитель 0c1ac487ea
Коммит 44aa6f5d47
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 19 добавлений и 6 удалений

Просмотреть файл

@ -41,14 +41,27 @@ Result<HC_UNIQUE_PTR<CurlEasyRequest>> CurlEasyRequest::Initialize(HCCallHandle
// we set both POSTFIELDSIZE and INFILESIZE because curl uses one or the
// other depending on method
// We are allowing Setops to happen with a bodySize of zero to handle certain clients
// We are allowing Setops to happen with a bodySize of zero in linux to handle certain clients
// not being able to handle handshakes without a fixed body size.
RETURN_IF_FAILED(easyRequest->SetOpt<long>(CURLOPT_POSTFIELDSIZE, static_cast<long>(bodySize)));
RETURN_IF_FAILED(easyRequest->SetOpt<long>(CURLOPT_INFILESIZE, static_cast<long>(bodySize)));
// The reason for an if def statement is to handle the behavioral differences in libCurl vs xCurl.
#if HC_PLATFORM == HC_PLATFORM_GDK
if (bodySize > 0) {
RETURN_IF_FAILED(easyRequest->SetOpt<long>(CURLOPT_POSTFIELDSIZE, static_cast<long>(bodySize)));
RETURN_IF_FAILED(easyRequest->SetOpt<long>(CURLOPT_INFILESIZE, static_cast<long>(bodySize)));
// read callback
RETURN_IF_FAILED(easyRequest->SetOpt<curl_read_callback>(CURLOPT_READFUNCTION, &ReadCallback));
RETURN_IF_FAILED(easyRequest->SetOpt<void*>(CURLOPT_READDATA, easyRequest.get()));
// read callback
RETURN_IF_FAILED(easyRequest->SetOpt<curl_read_callback>(CURLOPT_READFUNCTION, &ReadCallback));
RETURN_IF_FAILED(easyRequest->SetOpt<void*>(CURLOPT_READDATA, easyRequest.get()));
}
#else
RETURN_IF_FAILED(easyRequest->SetOpt<long>(CURLOPT_POSTFIELDSIZE, static_cast<long>(bodySize)));
RETURN_IF_FAILED(easyRequest->SetOpt<long>(CURLOPT_INFILESIZE, static_cast<long>(bodySize)));
// read callback
RETURN_IF_FAILED(easyRequest->SetOpt<curl_read_callback>(CURLOPT_READFUNCTION, &ReadCallback));
RETURN_IF_FAILED(easyRequest->SetOpt<void*>(CURLOPT_READDATA, easyRequest.get()));
#endif
// url & method
char const* url = nullptr;