Skip to content

Commit

Permalink
GH-19: More curl patches for NT4
Browse files Browse the repository at this point in the history
  • Loading branch information
negrutiu committed May 30, 2024
1 parent f9798e2 commit 38ddf40
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
diff --git a/lib/vtls/schannel_verify.c b/lib/vtls/schannel_verify.c
--- a/lib/vtls/schannel_verify.c
+++ b/lib/vtls/schannel_verify.c
@@ -267,3 +267,4 @@

- if(!GetFileSizeEx(ca_file_handle, &file_size)) {
+ file_size.LowPart = GetFileSize(ca_file_handle, &file_size.HighPart);
+ if(file_size.LowPart == INVALID_FILE_SIZE && GetLastError() != NO_ERROR) {
char buffer[STRERROR_LEN];
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
diff -git a/CMake/Platforms/WindowsCache.cmake b/CMake/Platforms/WindowsCache.cmake
--- a/CMake/Platforms/WindowsCache.cmake
+++ b/CMake/Platforms/WindowsCache.cmake
@@ -39,3 +39,3 @@
set(HAVE_STRCASECMP 1)
- set(HAVE_FTRUNCATE 1)
+ set(HAVE_FTRUNCATE 0) # nscurl: The mingw-x64 implementation of ftruncate() calls FindFirstVolume/FindNextVolume/GetFileSizeEx, unavailable in NT4 */
set(HAVE_SYS_PARAM_H 1)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
diff --git a/lib/config-win32.h b/lib/config-win32.h
--- a/lib/config-win32.h
+++ b/lib/config-win32.h
@@ -125,3 +125,4 @@
#if defined(__MINGW32__)
-#define HAVE_FTRUNCATE 1
+/* nscurl: The mingw-x64 implementation of ftruncate() calls FindFirstVolume/FindNextVolume/GetFileSizeEx, unavailable in NT4 */
+/* #define HAVE_FTRUNCATE 1 */
#endif
12 changes: 12 additions & 0 deletions vcpkg_overlay_ports/curl/nscurl/curl_ftruncate_tool_cb_hdr.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff -git a/src/tool_cb_hdr.c b/src/tool_cb_hdr.c
--- a/src/tool_cb_hdr.c
+++ b/src/tool_cb_hdr.c
@@ -146,2 +146,8 @@
}
+#if defined(_WIN32)
+ /* nscurl: mark the end-of-file */
+ if(!SetEndOfFile((HANDLE)_get_osfhandle(etag_save->stream))) {
+ return CURL_WRITEFUNC_ERROR;
+ }
+#endif
#endif
12 changes: 12 additions & 0 deletions vcpkg_overlay_ports/curl/nscurl/curl_ftruncate_tool_operate.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff -git a/src/tool_operate.c b/src/tool_operate.c
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -610,2 +610,8 @@
rc = fseek(outs->stream, (long)outs->init, SEEK_SET);
+#if defined(_WIN32)
+ /* nscurl: mark the end-of-file */
+ if(!SetEndOfFile((HANDLE)_get_osfhandle(outs->stream))) {
+ rc = -1;
+ }
+#endif
#endif
7 changes: 6 additions & 1 deletion vcpkg_overlay_ports/curl/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ vcpkg_from_github(
export-components.patch
dependencies.patch
cmake-config.patch
nscurl/curl_ftruncate.patch # nscurl: mingw-x64 implementation of ftruncate() calls FindFirstVolume/FindNextVolume/GetFileSizeEx, unavailable in NT4
nscurl/curl_ftruncate_CMakeLists.patch # nscurl: mingw-x64 implementation of ftruncate() calls FindFirstVolume/FindNextVolume/GetFileSizeEx, unavailable in NT4
nscurl/curl_ftruncate_config-win32.patch
nscurl/curl_ftruncate_WindowsCache.patch
nscurl/curl_ftruncate_tool_operate.patch
nscurl/curl_ftruncate_tool_cb_hdr.patch
nscurl/curl_toolhelp.diff # nscurl: no Tool Help calls (i.e. CreateToolhelp32Snapshot). inexistent in NT4, unneeded by nscurl
nscurl/curl_wspiapi.diff # nscurl: fix linking to Ws2_32!getaddrinfo and Ws2_32!freeaddrinfo when _WIN32_WINNT <= 0x0500
nscurl/curl_xprequirement.diff # nscurl: remove target >= XP restriction
nscurl/curl_GetFileSizeEx_schannel_verify.patch # nscurl: kernel32!GetFileSizeEx is unavailable in NT4
)

# nscurl: remove "-DEV" version suffix
Expand Down

0 comments on commit 38ddf40

Please sign in to comment.