Support http2 on windows

This commit is contained in:
Filipe PINTO 2023-10-20 10:32:57 +02:00 committed by fpinto
parent 91a8efd1df
commit 5fb9b3a54f
No known key found for this signature in database
GPG Key ID: F4F06B068FB00692
7 changed files with 38 additions and 34 deletions

View File

@ -4,19 +4,19 @@ $ErrorActionPreference = 'Stop'
write-host -foregroundcolor Cyan "----- install system prerequisites -----"
# update vcpkg install
git -C ((Get-command vcpkg).Source | Split-Path) pull
$vcpkg_dir=((Get-command vcpkg).Source | Split-Path)
$lib_dir="$vcpkg_dir\installed\x64-windows\bin"
git -C $vcpkg_dir pull
# install libxml and libcurl[openssl]
$vcpkg_dir=(Get-command vcpkg).Source
vcpkg install --recurse --x-use-aria2 curl:x64-windows || true
vcpkg install --recurse --x-use-aria2 curl[core,non-http,schannel,ssl,sspi,http2]:x64-windows || true
vcpkg install --recurse --x-use-aria2 libxml2[core,iconv]:x64-windows || true
vcpkg update
if ($LASTEXITCODE) { Throw }
vcpkg upgrade --no-dry-run
if ($LASTEXITCODE) { Throw }
vcpkg integrate install
if ($LASTEXITCODE) { Throw }
Set-ItemProperty -Path HKCU:\Environment -Name VCPKGRS_DYNAMIC -Value "1"
$env:VCPKGRS_DYNAMIC = [System.Environment]::GetEnvironmentVariable("VCPKGRS_DYNAMIC","User")
if ($LASTEXITCODE) { Throw }

View File

@ -11,7 +11,7 @@ $toolchain=((((rustup show active-toolchain) -Split " ")[0]) -Split "-",2)[1]
# create windows64 zip package
cd $PSScriptRoot\..\..\target\win-package
Get-ChildItem -Path *.dll, *hurl.exe, *hurlfmt.exe, *.txt, ../../*.md -Exclude hex_literal* | Compress-Archive -DestinationPath hurl-${hurl_package_version}-${toolchain}.zip
Get-ChildItem -Path *.dll, *hurl.exe, *hurlfmt.exe, *.txt, ../../*.md | Compress-Archive -DestinationPath hurl-${hurl_package_version}-${toolchain}.zip
Get-ChildItem .\*win64.zip
cd $actual_dir

View File

@ -11,11 +11,17 @@ cargo build --release --verbose --locked
if ($LASTEXITCODE) { Throw }
# create final package
$lib_dir=((Get-Command vcpkg).Source | Split-path) + "\installed\x64-windows\bin"
$release_dir="$project_root_path\target\release"
$package_dir="$project_root_path\target\win-package"
New-Item -ItemType Directory -Force -Path $package_dir
Get-ChildItem -Path $release_dir -Recurse -Include *.dll -File | Copy-Item -Destination "$package_dir"
Get-ChildItem -Path $release_dir -Recurse -Include hurl*.exe -File | Copy-Item -Destination "$package_dir"
Copy-Item -Path $lib_dir\libcurl.dll -Destination $package_dir
Copy-Item -Path $lib_dir\zlib1.dll -Destination $package_dir
Copy-Item -Path $lib_dir\nghttp2.dll -Destination $package_dir
Copy-Item -Path $lib_dir\libxml2.dll -Destination $package_dir
Copy-Item -Path $lib_dir\iconv-2.dll -Destination $package_dir
Copy-Item -Path $release_dir\hurl.exe -Destination $package_dir
Copy-Item -Path $release_dir\hurlfmt.exe -Destination $package_dir
((& $package_dir\hurl --version) -Split " ")[1] > $package_dir\version.txt
Get-Content $package_dir\version.txt

View File

@ -2,5 +2,21 @@ Set-StrictMode -Version latest
$ErrorActionPreference = 'Stop'
write-host -foregroundcolor Cyan "----- unit tests -----"
# exe dir
$original_env_path="$env:Path"
# lib dir
$vcpkg_dir=((Get-command vcpkg).Source | Split-Path)
$lib_dir="$vcpkg_dir\installed\x64-windows\bin"
# link libs
$env:Path = "$lib_dir" + ";" + "$original_env_path"
# execute test units
cargo test --release --tests
if ($LASTEXITCODE) { Throw }
# unlink libs
$env:Path = "$original_env_path"

View File

@ -89,11 +89,6 @@ SectionGroup "executables"
SectionGroupEnd
SectionGroup "dlls"
Section "charset-1.dll"
SectionIn RO
SetOutPath $INSTDIR
File "charset-1.dll"
SectionEnd
Section "iconv-2.dll"
SectionIn RO
SetOutPath $INSTDIR
@ -114,6 +109,11 @@ SectionGroup "dlls"
SetOutPath $INSTDIR
File "libcurl.dll"
SectionEnd
Section "nghttp2.dll"
SectionIn RO
SetOutPath $INSTDIR
File "nghttp2.dll"
SectionEnd
SectionGroupEnd
SectionGroup "txt"

View File

@ -54,16 +54,6 @@ Set-ItemProperty -Path HKCU:\Environment -Name Path -Value $newpath
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
```
Install build libs requirement
```pwsh
vcpkg install --recurse --x-use-aria2 curl:x64-windows
vcpkg install --recurse --x-use-aria2 libxml2[core,iconv]:x64-windows
vcpkg integrate install
Set-ItemProperty -Path HKCU:\Environment -Name VCPKGRS_DYNAMIC -Value "1"
$env:VCPKGRS_DYNAMIC = [System.Environment]::GetEnvironmentVariable("VCPKGRS_DYNAMIC","User")
```
# Clone hurl project
```pwsh
@ -71,18 +61,18 @@ cd c:\
git.exe clone https://github.com/Orange-OpenSource/hurl.git
```
# Test your app
# Build
```pwsh
cd c:\hurl
.\bin\test\test.ps1
.\bin\install_prerequisites_windows.ps1
.\bin\release\release.ps1
```
# Create a simple zip package
```pwsh
cd c:\hurl
.\bin\release\release.ps1
.\bin\release\create_windows64_zip_package.ps1
```
@ -90,7 +80,6 @@ cd c:\hurl
```pwsh
cd c:\hurl
.\bin\release\release.ps1
.\bin\release\create_windows64_installer.ps1
```

View File

@ -1,11 +1,4 @@
Set-StrictMode -Version latest
$ErrorActionPreference = 'Stop'
$ErrorActionPreference = 'Continue'
curl --version | grep Features | grep -q HTTP2
if ($LASTEXITCODE -eq 1) {
exit 255
}
$ErrorActionPreference = 'Stop'
hurl tests_ok/http_version_2_option.hurl