Skip to content

Commit 6034e78

Browse files
authored
SfsClient update 1.1.0 for proxy support (#5052)
Pulling SfsClient subtree release 1.1.0 [SfsClient Release 1.1.0](https://github.com/microsoft/sfs-client/releases/tag/1.1.0) Which brought especially [SfsClient - Client: proxy support #84](microsoft/sfs-client#218) This subtree update is required for WinGet Download Proxy support [WinGet download doesn't work through a proxy #5030](#5030) Also requires passing the appropriate proxy to SfsClient which is done as part of separate PR [Allows setting WinGet proxy setting as SFS Client Proxy #5032](#5032)
2 parents ad9a0ae + 3d1402c commit 6034e78

29 files changed

+641
-220
lines changed

src/SfsClient/SfsClient.vcxproj

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@
241241
</PropertyGroup>
242242
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
243243
<ClCompile>
244-
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.0.0";WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
244+
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.1.0";WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
245245
<WarningLevel>TurnOffAllWarnings</WarningLevel>
246246
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
247247
<LanguageStandard>stdcpp17</LanguageStandard>
@@ -257,7 +257,7 @@
257257
</ItemDefinitionGroup>
258258
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
259259
<ClCompile>
260-
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.0.0";WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
260+
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.1.0";WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
261261
<WarningLevel>Level3</WarningLevel>
262262
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
263263
<LanguageStandard>stdcpp17</LanguageStandard>
@@ -274,7 +274,7 @@
274274
</ItemDefinitionGroup>
275275
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'">
276276
<ClCompile>
277-
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.0.0";WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
277+
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.1.0";WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
278278
<WarningLevel>Level3</WarningLevel>
279279
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
280280
<LanguageStandard>stdcpp17</LanguageStandard>
@@ -294,7 +294,7 @@
294294
<ClCompile>
295295
<LanguageStandard>stdcpp17</LanguageStandard>
296296
<PrecompiledHeader>NotUsing</PrecompiledHeader>
297-
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.0.0";NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
297+
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.1.0";NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
298298
<WarningLevel>Level3</WarningLevel>
299299
<AdditionalIncludeDirectories>$(ProjectDir)sfs-client\client\include\sfsclient;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
300300
<RuntimeTypeInfo>true</RuntimeTypeInfo>
@@ -304,7 +304,7 @@
304304
<ClCompile>
305305
<LanguageStandard>stdcpp17</LanguageStandard>
306306
<PrecompiledHeader>NotUsing</PrecompiledHeader>
307-
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.0.0";NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
307+
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.1.0";NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
308308
<WarningLevel>Level3</WarningLevel>
309309
<AdditionalIncludeDirectories>$(ProjectDir)sfs-client\client\include\sfsclient;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
310310
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -315,7 +315,7 @@
315315
<ClCompile>
316316
<LanguageStandard>stdcpp17</LanguageStandard>
317317
<PrecompiledHeader>NotUsing</PrecompiledHeader>
318-
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.0.0";NDEBUG;%(PreprocessorDefinitions)%(PreprocessorDefinitions)</PreprocessorDefinitions>
318+
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.1.0";NDEBUG;%(PreprocessorDefinitions)%(PreprocessorDefinitions)</PreprocessorDefinitions>
319319
<WarningLevel>Level3</WarningLevel>
320320
<AdditionalIncludeDirectories>$(ProjectDir)sfs-client\client\include\sfsclient;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
321321
<RuntimeTypeInfo>true</RuntimeTypeInfo>
@@ -325,7 +325,7 @@
325325
<ClCompile>
326326
<LanguageStandard>stdcpp17</LanguageStandard>
327327
<PrecompiledHeader>NotUsing</PrecompiledHeader>
328-
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.0.0";NDEBUG;%(PreprocessorDefinitions)%(PreprocessorDefinitions)</PreprocessorDefinitions>
328+
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.1.0";NDEBUG;%(PreprocessorDefinitions)%(PreprocessorDefinitions)</PreprocessorDefinitions>
329329
<WarningLevel>Level3</WarningLevel>
330330
<AdditionalIncludeDirectories>$(ProjectDir)sfs-client\client\include\sfsclient;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
331331
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -336,7 +336,7 @@
336336
<ClCompile>
337337
<LanguageStandard>stdcpp17</LanguageStandard>
338338
<PrecompiledHeader>NotUsing</PrecompiledHeader>
339-
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.0.0";NDEBUG;%(PreprocessorDefinitions)%(PreprocessorDefinitions)</PreprocessorDefinitions>
339+
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.1.0";NDEBUG;%(PreprocessorDefinitions)%(PreprocessorDefinitions)</PreprocessorDefinitions>
340340
<WarningLevel>Level3</WarningLevel>
341341
<AdditionalIncludeDirectories>$(ProjectDir)sfs-client\client\include\sfsclient;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
342342
<RuntimeTypeInfo>true</RuntimeTypeInfo>
@@ -346,7 +346,7 @@
346346
<ClCompile>
347347
<LanguageStandard>stdcpp17</LanguageStandard>
348348
<PrecompiledHeader>NotUsing</PrecompiledHeader>
349-
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.0.0";NDEBUG;%(PreprocessorDefinitions)%(PreprocessorDefinitions)</PreprocessorDefinitions>
349+
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.1.0";NDEBUG;%(PreprocessorDefinitions)%(PreprocessorDefinitions)</PreprocessorDefinitions>
350350
<WarningLevel>Level3</WarningLevel>
351351
<AdditionalIncludeDirectories>$(ProjectDir)sfs-client\client\include\sfsclient;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
352352
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -357,7 +357,7 @@
357357
<ClCompile>
358358
<LanguageStandard>stdcpp17</LanguageStandard>
359359
<PrecompiledHeader>NotUsing</PrecompiledHeader>
360-
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.0.0";_DEBUG;%(PreprocessorDefinitions)%(PreprocessorDefinitions)</PreprocessorDefinitions>
360+
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.1.0";_DEBUG;%(PreprocessorDefinitions)%(PreprocessorDefinitions)</PreprocessorDefinitions>
361361
<WarningLevel>TurnOffAllWarnings</WarningLevel>
362362
<AdditionalIncludeDirectories>$(ProjectDir)sfs-client\client\include\sfsclient;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
363363
<RuntimeTypeInfo>true</RuntimeTypeInfo>
@@ -367,7 +367,7 @@
367367
<ClCompile>
368368
<LanguageStandard>stdcpp17</LanguageStandard>
369369
<PrecompiledHeader>NotUsing</PrecompiledHeader>
370-
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.0.0";_DEBUG;%(PreprocessorDefinitions)%(PreprocessorDefinitions)</PreprocessorDefinitions>
370+
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.1.0";_DEBUG;%(PreprocessorDefinitions)%(PreprocessorDefinitions)</PreprocessorDefinitions>
371371
<WarningLevel>TurnOffAllWarnings</WarningLevel>
372372
<AdditionalIncludeDirectories>$(ProjectDir)sfs-client\client\include\sfsclient;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
373373
<RuntimeTypeInfo>true</RuntimeTypeInfo>
@@ -377,7 +377,7 @@
377377
<ClCompile>
378378
<LanguageStandard>stdcpp17</LanguageStandard>
379379
<PrecompiledHeader>NotUsing</PrecompiledHeader>
380-
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.0.0";_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
380+
<PreprocessorDefinitions>CURL_STATICLIB;GUID_WINDOWS;SFS_VERSION="1.1.0";_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
381381
<WarningLevel>TurnOffAllWarnings</WarningLevel>
382382
<AdditionalIncludeDirectories>$(ProjectDir)sfs-client\client\include\sfsclient;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
383383
<RuntimeTypeInfo>true</RuntimeTypeInfo>

src/SfsClient/readme.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
## SfsClient
22

3-
Do not change code under the sfs-client directory; it contains sfs-client source code from commit [be733af](https://github.com/microsoft/sfs-client/commits/be733af).
4-
It is created using git subtree command:
3+
Do not change code under the sfs-client directory; it contains sfs-client source code from release 1.1.0 (https://github.com/microsoft/sfs-client/releases/tag/1.1.0).
4+
It was initially created using git subtree command:
55
```
66
git subtree add --prefix=src/SfsClient/sfs-client https://github.com/microsoft/sfs-client.git be733af9e5c8e9227f2018ff618800bf08a31180 --squash
77
```
8+
Then updated to release 1.1.0 using:
9+
```
10+
git subtree pull -P src/SfsClient/sfs-client https://github.com/microsoft/sfs-client 1.1.0 --squash
11+
```
12+
813

914
### Update
1015
To update, run the following command, then update the above commit for reference. 'master' can be replaced with the appropriate commit spec as desired.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Initialize CodeQL
2+
3+
description: Initializes CodeQL action to be used in build workflows
4+
5+
runs:
6+
using: "composite"
7+
8+
steps:
9+
- name: Initialize CodeQL
10+
uses: github/codeql-action/init@v3
11+
with:
12+
languages: cpp

src/SfsClient/sfs-client/.github/workflows/main-build-ubuntu.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ on:
55
branches: [ "main" ]
66

77
# Permissions and environment values to be able to update the dependency graph with vcpkg information
8+
# and to enable the writing/uploading of CodeQL scan results
89
permissions:
910
contents: write
11+
security-events: write
1012

1113
env:
1214
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -19,6 +21,9 @@ jobs:
1921
steps:
2022
- uses: actions/checkout@v4
2123

24+
- name: Initialize CodeQL
25+
uses: ./.github/workflows/initialize-codeql
26+
2227
- name: Setup
2328
run: source ./scripts/setup.sh
2429

@@ -36,3 +41,6 @@ jobs:
3641
run: |
3742
./scripts/build.sh --build-type Release
3843
./scripts/test.sh --output-on-failure
44+
45+
- name: Perform CodeQL Analysis
46+
uses: github/codeql-action/analyze@v3

src/SfsClient/sfs-client/.github/workflows/main-build-windows.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ on:
55
branches: [ "main" ]
66

77
# Permissions and environment values to be able to update the dependency graph with vcpkg information
8+
# and to enable the writing/uploading of CodeQL scan results
89
permissions:
910
contents: write
11+
security-events: write
1012

1113
env:
1214
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -19,12 +21,15 @@ jobs:
1921
steps:
2022
- uses: actions/checkout@v4
2123

24+
- name: Initialize CodeQL
25+
uses: ./.github/workflows/initialize-codeql
26+
2227
- name: Install Winget
2328
uses: ./.github/workflows/install-winget
2429

2530
- name: Setup
2631
shell: pwsh
27-
run: .\scripts\Setup.ps1 -NoBuildTools
32+
run: .\scripts\Setup.ps1
2833

2934
- name: Build and Test (no test overrides)
3035
shell: pwsh
@@ -43,3 +48,6 @@ jobs:
4348
run: |
4449
.\scripts\Build.ps1 -BuildType Release
4550
.\scripts\Test.ps1 -OutputOnFailure
51+
52+
- name: Perform CodeQL Analysis
53+
uses: github/codeql-action/analyze@v3

src/SfsClient/sfs-client/.github/workflows/pr.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ jobs:
2222
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
2323
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
2424
25+
- name: Initialize CodeQL
26+
uses: ./.github/workflows/initialize-codeql
27+
2528
- name: Install Winget
2629
uses: ./.github/workflows/install-winget
2730

2831
- name: Setup
2932
shell: pwsh
30-
run: .\scripts\Setup.ps1 -NoBuildTools
33+
run: .\scripts\Setup.ps1
3134

3235
- name: Check formatting
3336
shell: pwsh
@@ -45,6 +48,9 @@ jobs:
4548
.\scripts\Build.ps1 -EnableTestOverrides
4649
.\scripts\Test.ps1 -OutputOnFailure
4750
51+
- name: Perform CodeQL Analysis
52+
uses: github/codeql-action/analyze@v3
53+
4854
build-ubuntu:
4955
runs-on: ubuntu-latest
5056

@@ -58,6 +64,9 @@ jobs:
5864
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
5965
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
6066
67+
- name: Initialize CodeQL
68+
uses: ./.github/workflows/initialize-codeql
69+
6170
- name: Setup
6271
run: source ./scripts/setup.sh
6372

@@ -73,3 +82,6 @@ jobs:
7382
run: |
7483
./scripts/build.sh --enable-test-overrides
7584
./scripts/test.sh --output-on-failure
85+
86+
- name: Perform CodeQL Analysis
87+
uses: github/codeql-action/analyze@v3

src/SfsClient/sfs-client/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ endif()
2727
# 1. MAJOR version when you make incompatible API changes
2828
# 2. MINOR version when you add functionality in a backward compatible manner
2929
# 3. PATCH version when you make backward compatible bug fixes
30-
set(SFS_LIBRARY_VERSION "1.0.0")
30+
set(SFS_LIBRARY_VERSION "1.1.0")
3131

3232
project(
3333
sfsclient

src/SfsClient/sfs-client/client/include/sfsclient/RequestParams.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ struct RequestParams
3535
/// @note If not provided, a new CorrelationVector will be generated
3636
std::optional<std::string> baseCV;
3737

38+
/// @brief Proxy setting which can be used to establish connections with the server (optional)
39+
/// @note The string can be a hostname or dotted numerical IP address. It can be suffixed with the port number
40+
/// like :[port], and can be prefixed with [scheme]://. If not provided, no proxy will be used.
41+
std::optional<std::string> proxy;
42+
3843
/// @brief Retry for a web request after a failed attempt. If true, client will retry up to c_maxRetries times
3944
bool retryOnError{true};
4045
};

src/SfsClient/sfs-client/client/src/details/UrlBuilder.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,31 @@ std::string UrlBuilder::GetUrl() const
6666
return urlPtr;
6767
}
6868

69+
std::string UrlBuilder::GetPath() const
70+
{
71+
CurlCharPtr path;
72+
char* pathPtr = path.get();
73+
THROW_IF_CURL_URL_SETUP_ERROR(curl_url_get(m_handle, CURLUPART_PATH, &pathPtr, 0 /*flags*/));
74+
return pathPtr;
75+
}
76+
77+
std::string UrlBuilder::GetQuery() const
78+
{
79+
CurlCharPtr query;
80+
char* queryPtr = query.get();
81+
const auto queryResult = curl_url_get(m_handle, CURLUPART_QUERY, &queryPtr, 0 /*flags*/);
82+
switch (queryResult)
83+
{
84+
case CURLUE_OK:
85+
return queryPtr;
86+
case CURLUE_NO_QUERY:
87+
return {};
88+
default:
89+
THROW_IF_CURL_URL_SETUP_ERROR(queryResult);
90+
}
91+
return {};
92+
}
93+
6994
UrlBuilder& UrlBuilder::SetScheme(Scheme scheme)
7095
{
7196
switch (scheme)

src/SfsClient/sfs-client/client/src/details/UrlBuilder.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ class UrlBuilder
3939

4040
std::string GetUrl() const;
4141

42+
std::string GetPath() const;
43+
std::string GetQuery() const;
44+
4245
/**
4346
* @brief Set the scheme for the URL
4447
* @param scheme The scheme to set for the URL Ex: Https

0 commit comments

Comments
 (0)