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
curl with WinSSL does not enable HTTP2 against nghttp2.org #2591
Comments
HTTP/2 support (over plain HTTP) is built-in when you build with nghttp2, which you seem to have done. HTTP/2 support over HTTPS requires that the TLS library/backend speaks ALPN properly so curl can negotiate 'h2' with the server and when built with WinSSL that is conditionally present:
... and the run-time check at connection-time: BACKEND->use_alpn = conn->bits.tls_enable_alpn &&
!GetProcAddress(GetModuleHandleA("ntdll"),
"wine_get_version") &&
Curl_verify_windows_version(6, 3, PLATFORM_WINNT,
VERSION_GREATER_THAN_EQUAL); ... if those match on your system, I think you need to debug how come HTTP/2 doesn't get used with nghttp2.org. |
cURL use WinSSL
cURL use OpenSSL
|
Given that your verbose output doesn't mention ALPN at all, I'd guess Can you verify and check that the code on Lines 300 to 304 in d5a2df5
|
https://github.com/curl/curl/blob/master/lib/system_win32.c#L126 When I modify code, Rebuid curl, It can use WinSSL support HTTP2 //#ifdef HAS_ALPN
// /* ALPN is only supported on Windows 8.1 / Server 2012 R2 and above.
// Also it doesn't seem to be supported for Wine, see curl bug #983. */
// BACKEND->use_alpn = conn->bits.tls_enable_alpn &&
// !GetProcAddress(GetModuleHandleA("ntdll"),
// "wine_get_version") &&
// Curl_verify_windows_version(6, 3, PLATFORM_WINNT,
// VERSION_GREATER_THAN_EQUAL);
//#else
// BACKEND->use_alpn = false;
//#endif
BACKEND->use_alpn = true;
|
Good, then you've identified the bug. Now we only need a proper fix... |
Great Thanks. I love curl. |
Test code: #ifdef HAS_ALPN
/* ALPN is only supported on Windows 8.1 / Server 2012 R2 and above.
Also it doesn't seem to be supported for Wine, see curl bug #983. */
if(!Curl_verify_windows_version(6, 3, PLATFORM_WINNT,
VERSION_GREATER_THAN_EQUAL)){
fprintf(stderr,"OS not support ALPN\n");
}
BACKEND->use_alpn = conn->bits.tls_enable_alpn &&
!GetProcAddress(GetModuleHandleA("ntdll"),
"wine_get_version") &&
Curl_verify_windows_version(6, 3, PLATFORM_WINNT,
VERSION_GREATER_THAN_EQUAL);
#else
BACKEND->use_alpn = false;
#endif
Update curl manifest is work !!!
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity version="1.0.0.0" name="curl.app"/>
<description>curl</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"
/>
</requestedPrivileges>
</security>
</trustInfo>
<dependency optional="yes">
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.1.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="*"></assemblyIdentity>
</dependentAssembly>
</dependency>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
</application>
</compatibility>
</assembly> |
|
I use Register check OS version. struct RegKeyHelper {
~RegKeyHelper() {
if (hKey != nullptr) {
RegCloseKey(hKey);
}
}
HKEY hKey{nullptr};
};
bool IsWindowsVersionOrGreaterEx(WORD wMajorVersion, WORD wMinorVersion,
DWORD buildNumber) {
const wchar_t *currentVersion =
LR"(SOFTWARE\Microsoft\Windows NT\CurrentVersion)";
RegKeyHelper key;
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, currentVersion, 0, KEY_READ,
&(key.hKey)) != ERROR_SUCCESS) {
ErrorMessage err(GetLastError());
fwprintf(stderr, L"error: %s\n", err.message());
return false;
}
DWORD wMajor, wMinor;
DWORD type = 0;
DWORD dwSizeM = sizeof(DWORD);
if (RegGetValueW(key.hKey, nullptr, L"CurrentMajorVersionNumber",
RRF_RT_DWORD, &type, &wMajor, &dwSizeM) != ERROR_SUCCESS) {
ErrorMessage err(GetLastError());
fwprintf(stderr, L"error: %s\n", err.message());
return false;
}
dwSizeM = sizeof(DWORD);
if (RegGetValueW(key.hKey, nullptr, L"CurrentMinorVersionNumber",
RRF_RT_DWORD, &type, &wMinor, &dwSizeM) != ERROR_SUCCESS) {
ErrorMessage err(GetLastError());
fwprintf(stderr, L"error: %s\n", err.message());
return false;
}
WCHAR buffer[32];
DWORD dwSize = sizeof(buffer);
if (RegGetValueW(key.hKey, nullptr, L"CurrentBuildNumber", RRF_RT_REG_SZ,
&type, buffer, &dwSize) != ERROR_SUCCESS) {
ErrorMessage err(GetLastError());
fwprintf(stderr, L"error: %s\n", err.message());
return false;
}
wchar_t *w;
auto bn = wcstol(buffer, &w, 10);
if (wMajor < wMajorVersion) {
return false;
}
if (wMajor > wMajorVersion) {
return true;
}
if (wMinor > wMinorVersion) {
return true;
}
if (wMinor < wMinorVersion) {
return false;
}
return ((DWORD)bn >= buildNumber);
}
|
|
I've reopened #1221 to add a manifest to |
I've added CMake builds into the mix having a correct manifest enabled. Testers wanted. |
@vszakats OK.
Manifest is OK: |
* [curl] update to 7.61.0 * [curl] Fix wrong checksum. * [curl] Remove winssl-http2 patch which is not needed anymore. per curl/curl#2591.
* [curl] update to 7.61.0 * [curl] Fix wrong checksum. * [curl] Remove winssl-http2 patch which is not needed anymore. per curl/curl#2591.
I did this
I built CURL on the Windows 10 2018 April Update use
WinSSL
.I used CURL to request an HTTP2 URL and found it didn't use HTTP2
CURL with OpenSSL is OK.
I expected the following
curl/libcurl version
[curl -V output]
Build Step
See: microsoft/WSL#3141 (comment)
Nghttp2, zlib use vcpkg build.
Build Environment
MSVC Version
operating system
The text was updated successfully, but these errors were encountered: