diff --git a/src/AppInstallerCommonCore/AppInstallerCommonCore.vcxproj b/src/AppInstallerCommonCore/AppInstallerCommonCore.vcxproj
index 9fbf032a13..fd6bb4d718 100644
--- a/src/AppInstallerCommonCore/AppInstallerCommonCore.vcxproj
+++ b/src/AppInstallerCommonCore/AppInstallerCommonCore.vcxproj
@@ -9,7 +9,7 @@
{5890d6ed-7c3b-40f3-b436-b54f640d9e65}
Win32Proj
AppInstallerLoggingCore
- 10.0.22621.0
+ 10.0.26100.0
10.0.17763.0
true
@@ -500,4 +500,4 @@
-
\ No newline at end of file
+
diff --git a/src/PowerShell/Microsoft.WinGet.Client.Engine/Helpers/AppxModuleHelper.cs b/src/PowerShell/Microsoft.WinGet.Client.Engine/Helpers/AppxModuleHelper.cs
index 79f14f86bb..e8b8d1ad09 100644
--- a/src/PowerShell/Microsoft.WinGet.Client.Engine/Helpers/AppxModuleHelper.cs
+++ b/src/PowerShell/Microsoft.WinGet.Client.Engine/Helpers/AppxModuleHelper.cs
@@ -357,6 +357,7 @@ private HashSet InitFrameworkArchitectures()
{
HashSet architectures = new HashSet();
+ // Read the override from the environment variable if it exists.
string? environmentVariable = Environment.GetEnvironmentVariable(DependencyArchitectureEnvironmentVariable);
if (environmentVariable != null)
{
@@ -377,6 +378,7 @@ private HashSet InitFrameworkArchitectures()
return architectures;
}
+ // If there are any framework packages already installed, use the same architecture as them.
var result = this.ExecuteAppxCmdlet(
GetAppxPackage,
new Dictionary
@@ -406,6 +408,31 @@ private HashSet InitFrameworkArchitectures()
}
}
+ // Fall back to guessing from the current OS architecture.
+ // This may have issues on ARM64 because RuntimeInformation.OSArchitecture seems to just lie sometimes.
+ // See https://github.com/microsoft/winget-cli/issues/5020
+ if (architectures.Count == 0)
+ {
+ var arch = RuntimeInformation.OSArchitecture;
+ this.pwshCmdlet.Write(StreamType.Verbose, $"OS architecture: {arch.ToString()}");
+
+ if (arch == Architecture.X64)
+ {
+ architectures.Add(Architecture.X64);
+ }
+ else if (arch == Architecture.X86)
+ {
+ architectures.Add(Architecture.X86);
+ }
+ else if (arch == Architecture.Arm64)
+ {
+ // Let deployment figure it out
+ architectures.Add(Architecture.Arm64);
+ architectures.Add(Architecture.X64);
+ architectures.Add(Architecture.X86);
+ }
+ }
+
return architectures;
}
diff --git a/src/VcpkgPortOverlay/CreatePortOverlay.ps1 b/src/VcpkgPortOverlay/CreatePortOverlay.ps1
index ec9fab4954..6cda2cedff 100644
--- a/src/VcpkgPortOverlay/CreatePortOverlay.ps1
+++ b/src/VcpkgPortOverlay/CreatePortOverlay.ps1
@@ -4,54 +4,111 @@ $OverlayRoot = $PSScriptRoot
$ErrorActionPreference = "Stop"
-# Hacky way of getting a single directory from the vcpkg repo:
-# - Download the vcpkg repo as a zip to a memory stream
-# - Parse the zip archive
-# - Extract the files we want
-function Get-VcpkgRepoAsZipArchive
+
+# Gets the versions of a port available from the official registry.
+# This is read from the versions JSON in the main branch.
+# A version looks like this:
+# {
+# "git-tree": "9f5e160191038cbbd2470e534c43f051c80e7d44",
+# "version": "2.10.19",
+# "port-version": 3
+# }
+function Get-PortVersions
{
- $vcpkgZipUri = "https://github.com/microsoft/vcpkg/archive/refs/heads/master.zip"
- $response = Invoke-WebRequest -Uri $vcpkgZipUri
+ param(
+ [Parameter(Mandatory)]
+ [string]$Port
+ )
+
+ $initial = $Port[0]
+ $jsonUri = "https://raw.githubusercontent.com/microsoft/vcpkg/heads/master/versions/$initial-/$Port.json"
+ $versions = (Invoke-WebRequest -Uri $jsonUri).Content | ConvertFrom-Json -Depth 5
+ return $versions.versions
+}
+
+# Gets the git-tree associated with a specific version of a port.
+# The git-tree is a git object hash that represents the port directory
+# from the appropriate version of the registry.
+function Get-PortVersionGitTree
+{
+ param(
+ [Parameter(Mandatory)]
+ [string]$Port,
+ [Parameter(Mandatory)]
+ [string]$Version,
+ [Parameter(Mandatory)]
+ [string]$PortVersion
+ )
+
+ $versions = Get-PortVersions $Port
+ $versionData = $versions | Where-Object { ($_.version -eq $Version) -and ($_."port-version" -eq $portVersion) }
+ return $versionData."git-tree"
+}
+
+# Fetches and parses a git-tree as a ZIP file
+function Get-GitTreeAsArchive
+{
+ param(
+ [Parameter(Mandatory)]
+ [string]$GitTree
+ )
+
+ $archiveUri = "https://github.com/microsoft/vcpkg/archive/$gitTree.zip"
+ $response = Invoke-WebRequest -Uri $archiveUri
$zipStream = [System.IO.MemoryStream]::new($response.Content)
$zipArchive = [System.IO.Compression.ZipArchive]::new($zipStream)
return $zipArchive
}
-$VcpkgAsArchive = Get-VcpkgRepoAsZipArchive
-
-# Copies an port from the official registry to this overlay
-function New-PortOverlay
+# Expands an in-memory archive and writes it to disk
+function Expand-ArchiveFromMemory
{
param(
[Parameter(Mandatory)]
- [string]$Port
+ [System.IO.Compression.ZipArchive]$Archive,
+ [Parameter(Mandatory)]
+ [string]$Destination
)
- $portDir = Join-Path $OverlayRoot $Port
-
- # Delete existing port if needed
- if (Test-Path $portDir)
+ # Delete existing directory
+ if (Test-Path $Destination)
{
- Remove-Item -Force -Recurse $portDir
+ Remove-Item -Force -Recurse $Destination
}
# Remove length=0 to ignore the directory itself
- $portZipEntries = $VcpkgAsArchive.Entries |
- Where-Object { ($_.Length -ne 0) -and $_.FullName.StartsWith("vcpkg-master/ports/$Port/") }
-
- if (-not $portZipEntries)
+ $entries = $archive.Entries | Where-Object { $_.Length -ne 0 }
+ if (-not $entries)
{
- throw "Port $port not found"
+ throw "Archive is empty"
}
- New-Item -Type Directory $portDir | Out-Null
- foreach ($zipEntry in $portZipEntries)
+ New-Item -Type Directory $Destination | Out-Null
+ foreach ($entry in $entries)
{
- $targetPath = Join-Path $portDir $zipEntry.Name
- [System.IO.Compression.ZipFileExtensions]::ExtractToFile($zipEntry, $targetPath)
+ $targetPath = Join-Path $Destination $entry.Name
+ [System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $targetPath)
}
}
+# Creates a copy of a port version from the official registry in this overlay
+function New-PortOverlay
+{
+ param(
+ [Parameter(Mandatory)]
+ [string]$Port,
+ [Parameter(Mandatory)]
+ [string]$Version,
+ [Parameter(Mandatory)]
+ [string]$PortVersion
+ )
+
+ $gitTree = Get-PortVersionGitTree $Port $Version $PortVersion
+ $archive = Get-GitTreeAsArchive $gitTree
+ $portDir = Join-Path $OverlayRoot $Port
+ Expand-ArchiveFromMemory $archive $portDir
+}
+
# Gets a git patch from a GitHub commit
function Get-GitHubPatch
{
@@ -223,13 +280,28 @@ function Update-PortSource
$portDir = Join-Path $OverlayRoot $Port
- Set-ParameterInPortFile $Port -ParameterName 'REF' -CurrentValuePattern '[0-9a-f]{40}' -NewValue $Commit
+ # For the REF, we also delete any comments after it that may say the wrong version
+ Set-ParameterInPortFile $Port -ParameterName 'REF' -CurrentValuePattern '[0-9a-f]{40}( #.*)?$' -NewValue "$Commit # Unreleased"
Set-ParameterInPortFile $Port -ParameterName 'SHA512' -CurrentValuePattern '[0-9a-f]{128}' -NewValue $SourceHash
}
+# Updates the port version by one.
+function Update-PortVersion
+{
+ param(
+ [Parameter(Mandatory)]
+ [string]$Port
+ )
+
+ $portJsonPath = Join-Path $OverlayRoot $Port "vcpkg.json"
+ $portDefinition = Get-Content $portJsonPath | ConvertFrom-Json
+ $portDefinition."port-version" += 1
+ $portDefinition | ConvertTo-Json -Depth 5 | Out-File $portJsonPath
+}
-New-PortOverlay cpprestsdk
+New-PortOverlay cpprestsdk -Version 2.10.18 -PortVersion 4
Add-PatchToPort cpprestsdk -PatchRepo 'microsoft/winget-cli' -PatchCommit '888b4ed8f4f7d25cb05a47210e083fe29348163b' -PatchName 'add-server-certificate-validation.patch' -PatchRoot 'src/cpprestsdk/cpprestsdk'
-New-PortOverlay libyaml
-Update-PortSource libyaml -Commit '840b65c40675e2d06bf40405ad3f12dec7f35923' -SourceHash 'de85560312d53a007a2ddf1fe403676bbd34620480b1ba446b8c16bb366524ba7a6ed08f6316dd783bf980d9e26603a9efc82f134eb0235917b3be1d3eb4b302'
\ No newline at end of file
+New-PortOverlay libyaml -Version 0.2.5 -PortVersion 5
+Update-PortSource libyaml -Commit '840b65c40675e2d06bf40405ad3f12dec7f35923' -SourceHash 'de85560312d53a007a2ddf1fe403676bbd34620480b1ba446b8c16bb366524ba7a6ed08f6316dd783bf980d9e26603a9efc82f134eb0235917b3be1d3eb4b302'
+Update-PortVersion libyaml
diff --git a/src/VcpkgPortOverlay/README.md b/src/VcpkgPortOverlay/README.md
index 45687a6f7b..e8063e8081 100644
--- a/src/VcpkgPortOverlay/README.md
+++ b/src/VcpkgPortOverlay/README.md
@@ -8,6 +8,7 @@ The whole directory can be re-created with `.\CreatePortOverlay.ps1`
## cpprestsdk
We add support for certificate pinning.
+Note that we use v2.10.18, which is not the latest.
Changes:
* Add patch file: `add-server-certificate-validation.patch`
@@ -18,4 +19,5 @@ Changes:
We use an unreleased version that fixes a vulnerability.
Changes:
-* New source commit: https://github.com/yaml/libyaml/commit/840b65c40675e2d06bf40405ad3f12dec7f35923
\ No newline at end of file
+* New source commit: https://github.com/yaml/libyaml/commit/840b65c40675e2d06bf40405ad3f12dec7f35923
+* Increase the port version so that Component Governance doesn't see it as the vulnerable version anymore
\ No newline at end of file
diff --git a/src/VcpkgPortOverlay/cpprestsdk/fix-asio-error.patch b/src/VcpkgPortOverlay/cpprestsdk/fix-asio-error.patch
deleted file mode 100644
index dcc5052ef0..0000000000
--- a/src/VcpkgPortOverlay/cpprestsdk/fix-asio-error.patch
+++ /dev/null
@@ -1,367 +0,0 @@
-diff --git a/Release/include/pplx/threadpool.h b/Release/include/pplx/threadpool.h
-index b297ff6..56ea475 100644
---- a/Release/include/pplx/threadpool.h
-+++ b/Release/include/pplx/threadpool.h
-@@ -69,15 +69,15 @@ public:
- CASABLANCA_DEPRECATED("Use `.service().post(task)` directly.")
- void schedule(T task)
- {
-- service().post(task);
-+ boost::asio::post(service(), task);
- }
-
-- boost::asio::io_service& service() { return m_service; }
-+ boost::asio::io_context& service() { return m_service; }
-
- protected:
- threadpool(size_t num_threads) : m_service(static_cast(num_threads)) {}
-
-- boost::asio::io_service m_service;
-+ boost::asio::io_context m_service;
- };
-
- } // namespace crossplat
-diff --git a/Release/src/http/client/http_client_asio.cpp b/Release/src/http/client/http_client_asio.cpp
-index 07bb488..f9c7c51 100644
---- a/Release/src/http/client/http_client_asio.cpp
-+++ b/Release/src/http/client/http_client_asio.cpp
-@@ -146,9 +146,9 @@ class asio_connection
- friend class asio_client;
-
- public:
-- asio_connection(boost::asio::io_service& io_service)
-+ asio_connection(boost::asio::io_context& io_context)
- : m_socket_lock()
-- , m_socket(io_service)
-+ , m_socket(io_context)
- , m_ssl_stream()
- , m_cn_hostname()
- , m_is_reused(false)
-@@ -429,7 +429,7 @@ private:
- auto& self = *pool;
- std::weak_ptr weak_pool = pool;
-
-- self.m_pool_epoch_timer.expires_from_now(boost::posix_time::seconds(30));
-+ self.m_pool_epoch_timer.expires_after(std::chrono::seconds(30));
- self.m_pool_epoch_timer.async_wait([weak_pool](const boost::system::error_code& ec) {
- if (ec)
- {
-@@ -467,7 +467,7 @@ private:
- std::mutex m_lock;
- std::map> m_connections;
- bool m_is_timer_running;
-- boost::asio::deadline_timer m_pool_epoch_timer;
-+ boost::asio::system_timer m_pool_epoch_timer;
- };
-
- class asio_client final : public _http_client_communicator
-@@ -581,18 +581,16 @@ public:
-
- m_context->m_timer.start();
-
-- tcp::resolver::query query(utility::conversions::to_utf8string(proxy_host), to_string(proxy_port));
--
- auto client = std::static_pointer_cast(m_context->m_http_client);
-- m_context->m_resolver.async_resolve(query,
-- boost::bind(&ssl_proxy_tunnel::handle_resolve,
-- shared_from_this(),
-- boost::asio::placeholders::error,
-- boost::asio::placeholders::iterator));
-+ m_context->m_resolver.async_resolve(utility::conversions::to_utf8string(proxy_host), to_string(proxy_port),
-+ [self = shared_from_this()](const boost::system::error_code& error, tcp::resolver::results_type results){
-+ self->handle_resolve(error, results.begin());
-+ }
-+ );
- }
-
- private:
-- void handle_resolve(const boost::system::error_code& ec, tcp::resolver::iterator endpoints)
-+ void handle_resolve(const boost::system::error_code& ec, tcp::resolver::results_type::iterator endpoints)
- {
- if (ec)
- {
-@@ -610,7 +608,7 @@ public:
- }
- }
-
-- void handle_tcp_connect(const boost::system::error_code& ec, tcp::resolver::iterator endpoints)
-+ void handle_tcp_connect(const boost::system::error_code& ec, tcp::resolver::results_type::iterator endpoints)
- {
- if (!ec)
- {
-@@ -621,7 +619,7 @@ public:
- shared_from_this(),
- boost::asio::placeholders::error));
- }
-- else if (endpoints == tcp::resolver::iterator())
-+ else if (endpoints == tcp::resolver::results_type::iterator())
- {
- m_context->report_error(
- "Failed to connect to any resolved proxy endpoint", ec, httpclient_errorcode_context::connect);
-@@ -885,12 +883,11 @@ public:
- auto tcp_host = proxy_type == http_proxy_type::http ? proxy_host : host;
- auto tcp_port = proxy_type == http_proxy_type::http ? proxy_port : port;
-
-- tcp::resolver::query query(tcp_host, to_string(tcp_port));
-- ctx->m_resolver.async_resolve(query,
-- boost::bind(&asio_context::handle_resolve,
-- ctx,
-- boost::asio::placeholders::error,
-- boost::asio::placeholders::iterator));
-+ ctx->m_resolver.async_resolve(tcp_host, to_string(tcp_port),
-+ [ctx](const boost::system::error_code& error, tcp::resolver::results_type results){
-+ ctx->handle_resolve(error, results.begin());
-+ }
-+ );
- }
-
- // Register for notification on cancellation to abort this request.
-@@ -1006,7 +1003,7 @@ private:
- request_context::report_error(errorcodeValue, message);
- }
-
-- void handle_connect(const boost::system::error_code& ec, tcp::resolver::iterator endpoints)
-+ void handle_connect(const boost::system::error_code& ec, tcp::resolver::results_type::iterator endpoints)
- {
- m_timer.reset();
- if (!ec)
-@@ -1019,7 +1016,7 @@ private:
- {
- report_error("Request canceled by user.", ec, httpclient_errorcode_context::connect);
- }
-- else if (endpoints == tcp::resolver::iterator())
-+ else if (endpoints == tcp::resolver::results_type::iterator())
- {
- report_error("Failed to connect to any resolved endpoint", ec, httpclient_errorcode_context::connect);
- }
-@@ -1045,13 +1042,13 @@ private:
- }
- }
-
-- void handle_resolve(const boost::system::error_code& ec, tcp::resolver::iterator endpoints)
-+ void handle_resolve(const boost::system::error_code& ec, tcp::resolver::results_type::iterator endpoints)
- {
- if (ec)
- {
- report_error("Error resolving address", ec, httpclient_errorcode_context::connect);
- }
-- else if (endpoints == tcp::resolver::iterator())
-+ else if (endpoints == tcp::resolver::results_type::iterator())
- {
- report_error("Failed to resolve address", ec, httpclient_errorcode_context::connect);
- }
-@@ -1134,7 +1131,7 @@ private:
- }
- #endif // CPPREST_PLATFORM_ASIO_CERT_VERIFICATION_AVAILABLE
-
-- boost::asio::ssl::rfc2818_verification rfc2818(m_connection->cn_hostname());
-+ boost::asio::ssl::host_name_verification rfc2818(m_connection->cn_hostname());
- return rfc2818(preverified, verifyCtx);
- }
-
-@@ -1182,8 +1179,8 @@ private:
-
- const auto& chunkSize = m_http_client->client_config().chunksize();
- auto readbuf = _get_readbuffer();
-- uint8_t* buf = boost::asio::buffer_cast(
-- m_body_buf.prepare(chunkSize + http::details::chunked_encoding::additional_encoding_space));
-+ uint8_t* buf = static_cast(
-+ m_body_buf.prepare(chunkSize + http::details::chunked_encoding::additional_encoding_space).data());
- const auto this_request = shared_from_this();
- readbuf.getn(buf + http::details::chunked_encoding::data_offset, chunkSize)
- .then([this_request, buf, chunkSize AND_CAPTURE_MEMBER_FUNCTION_POINTERS](pplx::task op) {
-@@ -1247,7 +1244,7 @@ private:
- const auto readSize = static_cast((std::min)(
- static_cast(m_http_client->client_config().chunksize()), m_content_length - m_uploaded));
- auto readbuf = _get_readbuffer();
-- readbuf.getn(boost::asio::buffer_cast(m_body_buf.prepare(readSize)), readSize)
-+ readbuf.getn(static_cast(m_body_buf.prepare(readSize).data()), readSize)
- .then([this_request AND_CAPTURE_MEMBER_FUNCTION_POINTERS](pplx::task op) {
- try
- {
-@@ -1639,7 +1636,7 @@ private:
- std::vector decompressed;
-
- bool boo =
-- decompress(boost::asio::buffer_cast(m_body_buf.data()), to_read, decompressed);
-+ decompress(static_cast(m_body_buf.data().data()), to_read, decompressed);
- if (!boo)
- {
- report_exception(std::runtime_error("Failed to decompress the response body"));
-@@ -1687,7 +1684,7 @@ private:
- }
- else
- {
-- writeBuffer.putn_nocopy(boost::asio::buffer_cast(m_body_buf.data()), to_read)
-+ writeBuffer.putn_nocopy(static_cast(m_body_buf.data().data()), to_read)
- .then([this_request, to_read AND_CAPTURE_MEMBER_FUNCTION_POINTERS](pplx::task op) {
- try
- {
-@@ -1759,7 +1756,7 @@ private:
- std::vector decompressed;
-
- bool boo =
-- decompress(boost::asio::buffer_cast(m_body_buf.data()), read_size, decompressed);
-+ decompress(static_cast(m_body_buf.data().data()), read_size, decompressed);
- if (!boo)
- {
- this_request->report_exception(std::runtime_error("Failed to decompress the response body"));
-@@ -1821,7 +1818,7 @@ private:
- }
- else
- {
-- writeBuffer.putn_nocopy(boost::asio::buffer_cast(m_body_buf.data()), read_size)
-+ writeBuffer.putn_nocopy(static_cast(m_body_buf.data().data()), read_size)
- .then([this_request AND_CAPTURE_MEMBER_FUNCTION_POINTERS](pplx::task op) {
- size_t writtenSize = 0;
- try
-@@ -1870,7 +1867,7 @@ private:
- assert(!m_ctx.expired());
- m_state = started;
-
-- m_timer.expires_from_now(m_duration);
-+ m_timer.expires_after(m_duration);
- auto ctx = m_ctx;
- m_timer.async_wait([ctx AND_CAPTURE_MEMBER_FUNCTION_POINTERS](const boost::system::error_code& ec) {
- handle_timeout(ec, ctx);
-@@ -1881,7 +1878,7 @@ private:
- {
- assert(m_state == started || m_state == timedout);
- assert(!m_ctx.expired());
-- if (m_timer.expires_from_now(m_duration) > 0)
-+ if (m_timer.expires_after(m_duration) > 0)
- {
- // The existing handler was canceled so schedule a new one.
- assert(m_state == started);
-diff --git a/Release/src/http/client/x509_cert_utilities.cpp b/Release/src/http/client/x509_cert_utilities.cpp
-index 67fc5ac..7239f97 100644
---- a/Release/src/http/client/x509_cert_utilities.cpp
-+++ b/Release/src/http/client/x509_cert_utilities.cpp
-@@ -95,7 +95,7 @@ bool verify_cert_chain_platform_specific(boost::asio::ssl::verify_context& verif
- #if defined(_WIN32)
- if (verify_result)
- {
-- boost::asio::ssl::rfc2818_verification rfc2818(hostName);
-+ boost::asio::ssl::host_name_verification rfc2818(hostName);
- verify_result = rfc2818(verify_result, verifyCtx);
- }
- #endif
-diff --git a/Release/src/http/listener/http_server_asio.cpp b/Release/src/http/listener/http_server_asio.cpp
-index e83b9ff..14aadfb 100644
---- a/Release/src/http/listener/http_server_asio.cpp
-+++ b/Release/src/http/listener/http_server_asio.cpp
-@@ -520,17 +520,14 @@ void hostport_listener::start()
- auto& service = crossplat::threadpool::shared_instance().service();
- tcp::resolver resolver(service);
- // #446: boost resolver does not recognize "+" as a host wildchar
-- tcp::resolver::query query =
-- ("+" == m_host) ? tcp::resolver::query(m_port, boost::asio::ip::resolver_query_base::flags())
-- : tcp::resolver::query(m_host, m_port, boost::asio::ip::resolver_query_base::flags());
--
-- tcp::endpoint endpoint = *resolver.resolve(query);
--
-+ auto host = ("+" == m_host) ? "" : m_host;
-+ auto results = resolver.resolve(host, m_port, boost::asio::ip::resolver_query_base::flags());
-+ tcp::endpoint endpoint = *results.begin();
- m_acceptor.reset(new tcp::acceptor(service));
- m_acceptor->open(endpoint.protocol());
- m_acceptor->set_option(socket_base::reuse_address(true));
- m_acceptor->bind(endpoint);
-- m_acceptor->listen(0 != m_backlog ? m_backlog : socket_base::max_connections);
-+ m_acceptor->listen(0 != m_backlog ? m_backlog : socket_base::max_listen_connections);
-
- auto socket = new ip::tcp::socket(service);
- std::unique_ptr usocket(socket);
-@@ -881,7 +878,7 @@ will_deref_t asio_server_connection::handle_chunked_body(const boost::system::er
- else
- {
- auto writebuf = requestImpl->outstream().streambuf();
-- writebuf.putn_nocopy(buffer_cast(m_request_buf.data()), toWrite)
-+ writebuf.putn_nocopy(static_cast(m_request_buf.data().data()), toWrite)
- .then([=](pplx::task writeChunkTask) -> will_deref_t {
- try
- {
-@@ -913,7 +910,7 @@ will_deref_t asio_server_connection::handle_body(const boost::system::error_code
- {
- auto writebuf = requestImpl->outstream().streambuf();
- writebuf
-- .putn_nocopy(boost::asio::buffer_cast(m_request_buf.data()),
-+ .putn_nocopy(static_cast(m_request_buf.data().data()),
- (std::min)(m_request_buf.size(), m_read_size - m_read))
- .then([this](pplx::task writtenSizeTask) -> will_deref_t {
- size_t writtenSize = 0;
-@@ -1134,7 +1131,7 @@ will_deref_and_erase_t asio_server_connection::handle_write_chunked_response(con
- }
- auto membuf = m_response_buf.prepare(ChunkSize + chunked_encoding::additional_encoding_space);
-
-- readbuf.getn(buffer_cast(membuf) + chunked_encoding::data_offset, ChunkSize)
-+ readbuf.getn(static_cast(membuf.data()) + chunked_encoding::data_offset, ChunkSize)
- .then([=](pplx::task actualSizeTask) -> will_deref_and_erase_t {
- size_t actualSize = 0;
- try
-@@ -1146,7 +1143,7 @@ will_deref_and_erase_t asio_server_connection::handle_write_chunked_response(con
- return cancel_sending_response_with_error(response, std::current_exception());
- }
- size_t offset = chunked_encoding::add_chunked_delimiters(
-- buffer_cast(membuf), ChunkSize + chunked_encoding::additional_encoding_space, actualSize);
-+ static_cast(membuf.data()), ChunkSize + chunked_encoding::additional_encoding_space, actualSize);
- m_response_buf.commit(actualSize + chunked_encoding::additional_encoding_space);
- m_response_buf.consume(offset);
- if (actualSize == 0)
-@@ -1167,7 +1164,7 @@ will_deref_and_erase_t asio_server_connection::handle_write_large_response(const
- return cancel_sending_response_with_error(
- response, std::make_exception_ptr(http_exception("Response stream close early!")));
- size_t readBytes = (std::min)(ChunkSize, m_write_size - m_write);
-- readbuf.getn(buffer_cast(m_response_buf.prepare(readBytes)), readBytes)
-+ readbuf.getn(static_cast(m_response_buf.prepare(readBytes).data()), readBytes)
- .then([=](pplx::task actualSizeTask) -> will_deref_and_erase_t {
- size_t actualSize = 0;
- try
-diff --git a/Release/src/pplx/pplxlinux.cpp b/Release/src/pplx/pplxlinux.cpp
-index 630a9e4..65625b6 100644
---- a/Release/src/pplx/pplxlinux.cpp
-+++ b/Release/src/pplx/pplxlinux.cpp
-@@ -35,7 +35,7 @@ _PPLXIMP void YieldExecution() { std::this_thread::yield(); }
-
- _PPLXIMP void linux_scheduler::schedule(TaskProc_t proc, void* param)
- {
-- crossplat::threadpool::shared_instance().service().post(boost::bind(proc, param));
-+ boost::asio::post(crossplat::threadpool::shared_instance().service(), boost::bind(proc, param));
- }
-
- } // namespace details
-diff --git a/Release/src/pplx/threadpool.cpp b/Release/src/pplx/threadpool.cpp
-index ba38a1a..e12e48d 100644
---- a/Release/src/pplx/threadpool.cpp
-+++ b/Release/src/pplx/threadpool.cpp
-@@ -37,7 +37,7 @@ static void abort_if_no_jvm()
-
- struct threadpool_impl final : crossplat::threadpool
- {
-- threadpool_impl(size_t n) : crossplat::threadpool(n), m_work(m_service)
-+ threadpool_impl(size_t n) : crossplat::threadpool(n), m_work(m_service.get_executor())
- {
- for (size_t i = 0; i < n; i++)
- add_thread();
-@@ -84,7 +84,7 @@ private:
- }
-
- std::vector> m_threads;
-- boost::asio::io_service::work m_work;
-+ boost::asio::executor_work_guard m_work;
- };
-
- #if defined(_WIN32)
-diff --git a/Release/src/websockets/client/ws_client_wspp.cpp b/Release/src/websockets/client/ws_client_wspp.cpp
-index d7c31c4..8dfa815 100644
---- a/Release/src/websockets/client/ws_client_wspp.cpp
-+++ b/Release/src/websockets/client/ws_client_wspp.cpp
-@@ -225,7 +225,7 @@ public:
- verifyCtx, utility::conversions::to_utf8string(m_uri.host()));
- }
- #endif
-- boost::asio::ssl::rfc2818_verification rfc2818(utility::conversions::to_utf8string(m_uri.host()));
-+ boost::asio::ssl::host_name_verification rfc2818(utility::conversions::to_utf8string(m_uri.host()));
- return rfc2818(preverified, verifyCtx);
- });
-
diff --git a/src/VcpkgPortOverlay/cpprestsdk/fix-clang-dllimport.patch b/src/VcpkgPortOverlay/cpprestsdk/fix-clang-dllimport.patch
deleted file mode 100644
index 52552a5766..0000000000
--- a/src/VcpkgPortOverlay/cpprestsdk/fix-clang-dllimport.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-diff --git a/Release/include/cpprest/details/cpprest_compat.h b/Release/include/cpprest/details/cpprest_compat.h
-index bf107479..00581371 100644
---- a/Release/include/cpprest/details/cpprest_compat.h
-+++ b/Release/include/cpprest/details/cpprest_compat.h
-@@ -29,7 +29,6 @@
- #else // ^^^ _WIN32 ^^^ // vvv !_WIN32 vvv
-
- #define __declspec(x) __attribute__((x))
--#define dllimport
- #define novtable /* no novtable equivalent */
- #define __assume(x) \
- do \
-@@ -74,9 +73,17 @@
- #define _ASYNCRTIMP_TYPEINFO
- #else // ^^^ _NO_ASYNCRTIMP ^^^ // vvv !_NO_ASYNCRTIMP vvv
- #ifdef _ASYNCRT_EXPORT
-+#ifdef _WIN32
- #define _ASYNCRTIMP __declspec(dllexport)
-+#else
-+#define _ASYNCRTIMP __attribute__((visibility("default")))
-+#endif
- #else // ^^^ _ASYNCRT_EXPORT ^^^ // vvv !_ASYNCRT_EXPORT vvv
-+#ifdef _WIN32
- #define _ASYNCRTIMP __declspec(dllimport)
-+#else
-+#define _ASYNCRTIMP
-+#endif
- #endif // _ASYNCRT_EXPORT
-
- #if defined(_WIN32)
-diff --git a/Release/include/pplx/pplx.h b/Release/include/pplx/pplx.h
-index d9ba9c61..8d36252c 100644
---- a/Release/include/pplx/pplx.h
-+++ b/Release/include/pplx/pplx.h
-@@ -30,9 +30,17 @@
- #define _PPLXIMP
- #else
- #ifdef _PPLX_EXPORT
-+#ifdef _WIN32
- #define _PPLXIMP __declspec(dllexport)
- #else
-+#define _PPLXIMP __attribute__((visibility("default")))
-+#endif
-+#else
-+#ifdef _WIN32
- #define _PPLXIMP __declspec(dllimport)
-+#else
-+#define _PPLXIMP
-+#endif
- #endif
- #endif
-
diff --git a/src/VcpkgPortOverlay/cpprestsdk/portfile.cmake b/src/VcpkgPortOverlay/cpprestsdk/portfile.cmake
index 162e3c8863..0568ae7e8f 100644
--- a/src/VcpkgPortOverlay/cpprestsdk/portfile.cmake
+++ b/src/VcpkgPortOverlay/cpprestsdk/portfile.cmake
@@ -1,19 +1,24 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Microsoft/cpprestsdk
- REF 411a109150b270f23c8c97fa4ec9a0a4a98cdecf
- SHA512 4f604763f05d53e50dec5deaba283fa4f82d5e7a94c7c8142bf422f4c0bc24bcef00666ddbdd820f64c14e552997d6657b6aca79a29e69db43799961b44b2a1a
+ REF 122d09549201da5383321d870bed45ecb9e168c5
+ SHA512 c9ded33d3c67880e2471e479a38b40a14a9ff45d241e928b6339eca697b06ad621846260eca47b6b1b8a2bc9ab7bf4fea8d3e8e795cd430d8839beb530e16dd7
HEAD_REF master
PATCHES
fix-find-openssl.patch
fix_narrowing.patch
fix-uwp.patch
- fix-clang-dllimport.patch # workaround for https://github.com/microsoft/cpprestsdk/issues/1710
- silence-stdext-checked-array-iterators-warning.patch
- fix-asio-error.patch
add-server-certificate-validation.patch
)
+set(OPTIONS)
+if(NOT VCPKG_TARGET_IS_UWP)
+ SET(WEBSOCKETPP_PATH "${CURRENT_INSTALLED_DIR}/share/websocketpp")
+ list(APPEND OPTIONS
+ -DWEBSOCKETPP_CONFIG=${WEBSOCKETPP_PATH}
+ -DWEBSOCKETPP_CONFIG_VERSION=${WEBSOCKETPP_PATH})
+endif()
+
vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
INVERTED_FEATURES
@@ -30,6 +35,7 @@ vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}/Release"
${configure_opts}
OPTIONS
+ ${OPTIONS}
${FEATURE_OPTIONS}
-DBUILD_TESTS=OFF
-DBUILD_SAMPLES=OFF
diff --git a/src/VcpkgPortOverlay/cpprestsdk/silence-stdext-checked-array-iterators-warning.patch b/src/VcpkgPortOverlay/cpprestsdk/silence-stdext-checked-array-iterators-warning.patch
deleted file mode 100644
index aa63367845..0000000000
--- a/src/VcpkgPortOverlay/cpprestsdk/silence-stdext-checked-array-iterators-warning.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git a/Release/CMakeLists.txt b/Release/CMakeLists.txt
-index 3d6df65..9ff6d66 100644
---- a/Release/CMakeLists.txt
-+++ b/Release/CMakeLists.txt
-@@ -178,6 +178,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
- set(WARNINGS)
- set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4264")
- add_compile_options(/bigobj)
-+ add_compile_options(/D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING)
- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MP")
- set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MP")
- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MP")
diff --git a/src/VcpkgPortOverlay/cpprestsdk/vcpkg.json b/src/VcpkgPortOverlay/cpprestsdk/vcpkg.json
index 8d26279f45..a270085312 100644
--- a/src/VcpkgPortOverlay/cpprestsdk/vcpkg.json
+++ b/src/VcpkgPortOverlay/cpprestsdk/vcpkg.json
@@ -1,7 +1,7 @@
{
"name": "cpprestsdk",
- "version": "2.10.19",
- "port-version": 3,
+ "version": "2.10.18",
+ "port-version": 4,
"description": [
"C++11 JSON, REST, and OAuth library",
"The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services."
@@ -80,6 +80,38 @@
"dependencies": [
"zlib"
]
+ },
+ "websockets": {
+ "description": "Websockets support",
+ "dependencies": [
+ {
+ "name": "boost-date-time",
+ "platform": "!uwp"
+ },
+ {
+ "name": "boost-regex",
+ "platform": "!uwp"
+ },
+ {
+ "name": "boost-system",
+ "platform": "!uwp"
+ },
+ {
+ "name": "cpprestsdk",
+ "default-features": false,
+ "features": [
+ "compression"
+ ]
+ },
+ {
+ "name": "openssl",
+ "platform": "!uwp"
+ },
+ {
+ "name": "websocketpp",
+ "platform": "!uwp"
+ }
+ ]
}
}
}
diff --git a/src/vcpkg.json b/src/vcpkg.json
index 052c0000d0..d16190cc25 100644
--- a/src/vcpkg.json
+++ b/src/vcpkg.json
@@ -35,6 +35,10 @@
"name": "correlation-vector-cpp",
"version": "1.0"
},
+ {
+ "name": "cpprestsdk",
+ "version": "2.10.18"
+ },
{
"name": "curl",
"version": "8.12.1"