ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
January 2021
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
15 participants
146 discussions
Start a n
N
ew thread
[reactos] 01/01: [CMAKE] Fix GCC -fstack-protector usage
by Jérôme Gardou
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c8d07514c8e0bc235e180…
commit c8d07514c8e0bc235e180f6990f914ee86880f8c Author: Jérôme Gardou <jerome.gardou(a)reactos.org> AuthorDate: Thu Dec 31 17:56:39 2020 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Tue Jan 5 13:38:57 2021 +0100 [CMAKE] Fix GCC -fstack-protector usage --- boot/environ/CMakeLists.txt | 4 +- boot/freeldr/freeldr/CMakeLists.txt | 4 +- dll/keyboard/CMakeLists.txt | 2 +- dll/ntdll/CMakeLists.txt | 10 ++++ dll/win32/msvcrt/CMakeLists.txt | 5 ++ drivers/storage/port/scsiport/CMakeLists.txt | 5 ++ .../apitests/win32u/win32u_ros/CMakeLists.txt | 6 +- ntoskrnl/CMakeLists.txt | 10 +++- ntoskrnl/ntkrnlmp/CMakeLists.txt | 2 +- sdk/cmake/gcc.cmake | 6 +- sdk/lib/crt/msvcrtex.cmake | 4 -- sdk/lib/gcc_ssp/CMakeLists.txt | 14 ++++- sdk/lib/gcc_ssp/gcc_ssp.c | 66 ++++++++++++++++++---- win32ss/CMakeLists.txt | 5 ++ win32ss/drivers/videoprt/CMakeLists.txt | 5 ++ 15 files changed, 117 insertions(+), 31 deletions(-) diff --git a/boot/environ/CMakeLists.txt b/boot/environ/CMakeLists.txt index 4f62a8b111b..05aa5b81ef9 100644 --- a/boot/environ/CMakeLists.txt +++ b/boot/environ/CMakeLists.txt @@ -105,7 +105,7 @@ target_link_libraries(bootmgfw bootlib cportlib cmlib rtl libcntpr) # dynamic analysis switches if(STACK_PROTECTOR) - target_link_libraries(bootmgfw gcc_ssp) + target_sources(bootmgfw PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>) endif() if(RUNTIME_CHECKS) @@ -153,7 +153,7 @@ target_link_libraries(rosload bootlib cportlib cmlib rtl libcntpr) # dynamic analysis switches if(STACK_PROTECTOR) - target_link_libraries(rosload gcc_ssp) + target_sources(rosload PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>) endif() if(RUNTIME_CHECKS) diff --git a/boot/freeldr/freeldr/CMakeLists.txt b/boot/freeldr/freeldr/CMakeLists.txt index 87116af5978..95dc2e31224 100644 --- a/boot/freeldr/freeldr/CMakeLists.txt +++ b/boot/freeldr/freeldr/CMakeLists.txt @@ -312,8 +312,8 @@ target_link_libraries(freeldr_pe_dbg freeldr_common cportlib cmlib rtl libcntpr) # dynamic analysis switches if(STACK_PROTECTOR) - target_link_libraries(freeldr_pe gcc_ssp) - target_link_libraries(freeldr_pe_dbg gcc_ssp) + target_sources(freeldr_pe PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>) + target_sources(freeldr_pe_dbg PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>) endif() if(RUNTIME_CHECKS) diff --git a/dll/keyboard/CMakeLists.txt b/dll/keyboard/CMakeLists.txt index f728060633c..76cb12e1ea7 100644 --- a/dll/keyboard/CMakeLists.txt +++ b/dll/keyboard/CMakeLists.txt @@ -109,7 +109,7 @@ foreach(_keyboard_layout ${_keyboard_layouts}) # dynamic analysis switches if(STACK_PROTECTOR) - target_link_libraries(${_keyboard_layout} gcc_ssp) + target_compile_options(${_keyboard_layout} PRIVATE -fno-stack-protector) endif() if(RUNTIME_CHECKS) diff --git a/dll/ntdll/CMakeLists.txt b/dll/ntdll/CMakeLists.txt index 09e077cb4e6..ce1a8fcc67b 100644 --- a/dll/ntdll/CMakeLists.txt +++ b/dll/ntdll/CMakeLists.txt @@ -3,6 +3,11 @@ add_subdirectory(nt_0600) spec2def(ntdll.dll def/ntdll.spec ADD_IMPORTLIB) +# Embed RTC libs +if (STACK_PROTECTOR) + target_sources(libntdll PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>) +endif() + add_definitions( -D__NTDLL__ -D_NTOSKRNL_ @@ -60,6 +65,11 @@ if(MSVC) endif() target_link_libraries(ntdll rtl ntdllsys libcntpr uuid ${PSEH_LIB}) + +if (STACK_PROTECTOR) + target_sources(ntdll PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>) +endif() + add_pch(ntdll include/ntdll.h "${PCH_SKIP_SOURCE}") add_dependencies(ntdll ntstatus asm) add_cd_file(TARGET ntdll DESTINATION reactos/system32 NO_CAB FOR all) diff --git a/dll/win32/msvcrt/CMakeLists.txt b/dll/win32/msvcrt/CMakeLists.txt index 61ae9432d74..f2f922ed85f 100644 --- a/dll/win32/msvcrt/CMakeLists.txt +++ b/dll/win32/msvcrt/CMakeLists.txt @@ -7,6 +7,11 @@ target_compile_definitions(libmsvcrt INTERFACE _DLL __USE_CRTIMP) # Embed msvcrtex into libmsvcrt target_sources(libmsvcrt PRIVATE $<TARGET_OBJECTS:msvcrtex>) +# Embed RTC libs +if (STACK_PROTECTOR) + target_sources(libmsvcrt PRIVATE $<TARGET_OBJECTS:gcc_ssp_msvcrt>) + target_link_libraries(libmsvcrt INTERFACE libkernel32) # For OutputDebugStringA +endif() add_definitions( -DUSE_MSVCRT_PREFIX diff --git a/drivers/storage/port/scsiport/CMakeLists.txt b/drivers/storage/port/scsiport/CMakeLists.txt index e0f3ce08a78..f4bbc0b48e8 100644 --- a/drivers/storage/port/scsiport/CMakeLists.txt +++ b/drivers/storage/port/scsiport/CMakeLists.txt @@ -1,6 +1,11 @@ spec2def(scsiport.sys scsiport.spec ADD_IMPORTLIB) +# Embed RTC libs +if (STACK_PROTECTOR) + target_sources(libscsiport PRIVATE $<TARGET_OBJECTS:gcc_ssp_scsiport>) +endif() + list(APPEND SOURCE fdo.c ioctl.c diff --git a/modules/rostests/apitests/win32u/win32u_ros/CMakeLists.txt b/modules/rostests/apitests/win32u/win32u_ros/CMakeLists.txt index e8a8c03cf24..38bf98e2d50 100644 --- a/modules/rostests/apitests/win32u/win32u_ros/CMakeLists.txt +++ b/modules/rostests/apitests/win32u/win32u_ros/CMakeLists.txt @@ -4,7 +4,7 @@ include_directories(${REACTOS_SOURCE_DIR}/win32ss) spec2def(win32u.dll win32u_ros.spec ADD_IMPORTLIB) add_asm_files(win32u_ros_asm sys-stubs.S) -add_library(win32u MODULE +add_library(win32u MODULE main.c ${win32u_ros_asm} ${CMAKE_CURRENT_BINARY_DIR}/win32u.def) @@ -12,3 +12,7 @@ add_library(win32u MODULE set_module_type(win32u module) add_dependencies(win32u psdk) add_rostests_file(TARGET win32u) + +if (STACK_PROTECTOR) + target_compile_options(win32u PRIVATE -fno-stack-protector) +endif() diff --git a/ntoskrnl/CMakeLists.txt b/ntoskrnl/CMakeLists.txt index fd093c6ca06..8048520ec90 100644 --- a/ntoskrnl/CMakeLists.txt +++ b/ntoskrnl/CMakeLists.txt @@ -10,11 +10,17 @@ set(NTKRNLMP_SOURCE ${SOURCE}) set(NTKRNLMP_ASM_SOURCE ${ASM_SOURCE}) spec2def(ntoskrnl.exe ntoskrnl.spec ADD_IMPORTLIB) + +# Embed RTC libs +if (STACK_PROTECTOR) + target_sources(libntoskrnl PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>) +endif() + add_asm_files(ntoskrnl_asm ${NTOSKRNL_ASM_SOURCE}) if (GCC AND CLANG) # Clang optimises strcmp calls to memcmp. - target_link_libraries(libntoskrnl INTERFACE memcmp) + target_sources(libntoskrnl PRIVATE $<TARGET_OBJECTS:memcmp>) endif() list(APPEND PCH_SKIP_SOURCE @@ -58,7 +64,7 @@ endif() target_link_libraries(ntoskrnl cportlib csq ${PSEH_LIB} arbiter cmlib ntlsalib rtl ${ROSSYM_LIB} libcntpr wdmguid ioevent) if(STACK_PROTECTOR) - target_link_libraries(ntoskrnl gcc_ssp) + target_sources(ntoskrnl PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>) elseif(RUNTIME_CHECKS) target_link_libraries(ntoskrnl runtmchk) endif() diff --git a/ntoskrnl/ntkrnlmp/CMakeLists.txt b/ntoskrnl/ntkrnlmp/CMakeLists.txt index eb9610e1719..393fee96409 100644 --- a/ntoskrnl/ntkrnlmp/CMakeLists.txt +++ b/ntoskrnl/ntkrnlmp/CMakeLists.txt @@ -39,7 +39,7 @@ endif() # dynamic analysis switches if(STACK_PROTECTOR) - target_link_libraries(ntkrnlmp gcc_ssp) + target_sources(ntkrnlmp PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>) endif() if(RUNTIME_CHECKS) diff --git a/sdk/cmake/gcc.cmake b/sdk/cmake/gcc.cmake index bec502d75c7..72c0f5d09e0 100644 --- a/sdk/cmake/gcc.cmake +++ b/sdk/cmake/gcc.cmake @@ -35,7 +35,7 @@ if(USE_DUMMY_PSEH) endif() if(STACK_PROTECTOR) - add_compile_options(-fstack-protector-all) + add_compile_options(-fstack-protector-strong) endif() # Compiler Core @@ -287,10 +287,6 @@ function(set_module_type_toolchain MODULE TYPE) #Disabled due to LD bug: ROSBE-154 #add_linker_script(${MODULE} ${REACTOS_SOURCE_DIR}/sdk/cmake/init-section.lds) endif() - - if(STACK_PROTECTOR) - target_link_libraries(${MODULE} gcc_ssp) - endif() endfunction() function(add_delay_importlibs _module) diff --git a/sdk/lib/crt/msvcrtex.cmake b/sdk/lib/crt/msvcrtex.cmake index f720b977534..d969ba53b47 100644 --- a/sdk/lib/crt/msvcrtex.cmake +++ b/sdk/lib/crt/msvcrtex.cmake @@ -127,8 +127,4 @@ if(NOT MSVC) target_link_libraries(msvcrtex oldnames) endif() -if(STACK_PROTECTOR) - target_link_libraries(msvcrtex gcc_ssp) -endif() - add_dependencies(msvcrtex psdk asm) diff --git a/sdk/lib/gcc_ssp/CMakeLists.txt b/sdk/lib/gcc_ssp/CMakeLists.txt index a7556901e07..2e5a9e5bc0e 100644 --- a/sdk/lib/gcc_ssp/CMakeLists.txt +++ b/sdk/lib/gcc_ssp/CMakeLists.txt @@ -1,2 +1,14 @@ -add_library(gcc_ssp gcc_ssp.c) +add_library(gcc_ssp_nt OBJECT gcc_ssp.c) + +add_library(gcc_ssp_msvcrt OBJECT gcc_ssp.c) +target_compile_definitions(gcc_ssp_msvcrt PRIVATE _GCC_SSP_MSVCRT_) + +add_library(gcc_ssp_win32k OBJECT gcc_ssp.c) +target_compile_definitions(gcc_ssp_win32k PRIVATE _GCC_SSP_WIN32K_) + +add_library(gcc_ssp_videoprt OBJECT gcc_ssp.c) +target_compile_definitions(gcc_ssp_videoprt PRIVATE _GCC_SSP_VIDEOPRT_) + +add_library(gcc_ssp_scsiport OBJECT gcc_ssp.c) +target_compile_definitions(gcc_ssp_scsiport PRIVATE _GCC_SSP_SCSIPORT_) diff --git a/sdk/lib/gcc_ssp/gcc_ssp.c b/sdk/lib/gcc_ssp/gcc_ssp.c index 58e662cc36c..cb3664d1f27 100644 --- a/sdk/lib/gcc_ssp/gcc_ssp.c +++ b/sdk/lib/gcc_ssp/gcc_ssp.c @@ -1,23 +1,65 @@ -#define FAST_FAIL_STACK_COOKIE_CHECK_FAILURE 2 +#ifdef _GCC_SSP_MSVCRT_ -/* Should be random :-/ */ -void * __stack_chk_guard = (void*)0xf00df00d; +#include <windef.h> +#include <winbase.h> +#include <stdio.h> + +#define print_caller() do { \ + char buffer[64]; \ + _snprintf(buffer, sizeof(buffer), "STACK PROTECTOR FAULT AT %p\n", __builtin_extract_return_addr(__builtin_return_address (0))); \ + OutputDebugStringA(buffer); \ +} while(0) + +#elif defined(_GCC_SSP_WIN32K_) -#if 0 -void __stack_chk_guard_setup() +#include <windef.h> +#include <wingdi.h> +#include <winddi.h> +#include <stdarg.h> + +static inline +void +print_caller_helper(char* fmt, ...) { - unsigned char * p; - p = (unsigned char *)&__stack_chk_guard; // *** Notice that this takes the address of __stack_chk_guard *** + va_list args; - /* If you have the ability to generate random numbers in your kernel then use them, - otherwise for 32-bit code: */ - *p = 0x00000aff; // *** p is &__stack_chk_guard so *p writes to __stack_chk_guard rather than *__stack_chk_guard *** + va_start(args, fmt); + EngDebugPrint("", fmt, args); + va_end(args); } + +#define print_caller() print_caller_helper("STACK PROTECTOR FAULT AT %p\n", __builtin_extract_return_addr(__builtin_return_address(0))) + +#elif defined(_GCC_SSP_SCSIPORT_) + +#include <ntddk.h> +#include <srb.h> + +#define print_caller() ScsiDebugPrint(0, "STACK PROTECTOR FAULT AT %p\n", __builtin_extract_return_addr(__builtin_return_address(0))) + +#elif defined(_GCC_SSP_VIDEOPRT_) + +#include <ntdef.h> +#include <miniport.h> +#include <video.h> + +#define print_caller() VideoPortDebugPrint(0, "STACK PROTECTOR FAULT AT %p\n", __builtin_extract_return_addr(__builtin_return_address(0))) + +#else + +#include <ntdef.h> +#include <debug.h> + +#define print_caller() DbgPrint("STACK PROTECTOR FAULT AT %p\n", __builtin_extract_return_addr(__builtin_return_address(0))) + #endif +/* Should be random :-/ */ +void * __stack_chk_guard = (void*)0xb00fbeefbaafb00f; + void __stack_chk_fail() { - /* Like __fastfail */ - __asm__("int $0x29" : : "c"(FAST_FAIL_STACK_COOKIE_CHECK_FAILURE) : "memory"); + print_caller(); + __asm__("int $3"); } diff --git a/win32ss/CMakeLists.txt b/win32ss/CMakeLists.txt index b74e41f0361..44dc77cd381 100644 --- a/win32ss/CMakeLists.txt +++ b/win32ss/CMakeLists.txt @@ -18,6 +18,11 @@ add_subdirectory(user/winsrv) spec2def(win32k.sys win32k.spec ADD_IMPORTLIB) +# embed RTC libs +if (STACK_PROTECTOR) + target_sources(libwin32k PRIVATE $<TARGET_OBJECTS:gcc_ssp_win32k>) +endif() + include_directories( . include diff --git a/win32ss/drivers/videoprt/CMakeLists.txt b/win32ss/drivers/videoprt/CMakeLists.txt index 6f652c9ccff..cc5a174f57f 100644 --- a/win32ss/drivers/videoprt/CMakeLists.txt +++ b/win32ss/drivers/videoprt/CMakeLists.txt @@ -3,6 +3,11 @@ include_directories(${REACTOS_SOURCE_DIR}/ntoskrnl/include) add_definitions(-D_VIDEOPORT_) spec2def(videoprt.sys videoprt.spec ADD_IMPORTLIB) +# Embed RTC libs +if (STACK_PROTECTOR) + target_sources(libvideoprt PRIVATE $<TARGET_OBJECTS:gcc_ssp_videoprt>) +endif() + list(APPEND SOURCE agp.c child.c
3 years, 10 months
1
0
0
0
[reactos] 39/39: [MEDIA] Update Winesync doc
by Jérôme Gardou
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a853102a7bae039b8c313…
commit a853102a7bae039b8c313fb37afdc0ccfa2509a2 Author: Jérôme Gardou <jerome.gardou(a)reactos.org> AuthorDate: Tue Dec 8 21:07:07 2020 +0100 Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com> CommitDate: Tue Jan 5 11:03:13 2021 +0100 [MEDIA] Update Winesync doc --- media/doc/WINESYNC.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media/doc/WINESYNC.txt b/media/doc/WINESYNC.txt index 3273024a322..e84eeeac794 100644 --- a/media/doc/WINESYNC.txt +++ b/media/doc/WINESYNC.txt @@ -204,7 +204,7 @@ dll/win32/windowscodecsext # Synced to WineStaging-2.9 dll/win32/winemp3.acm # Synced to WineStaging-4.18 dll/win32/wing32 # Synced to WineStaging-3.3 dll/win32/winhttp # Synced to WineStaging-4.18 -dll/win32/wininet # Synced to WineStaging-4.18 +dll/win32/wininet # Synced to WineStaging-6.0rc1 dll/win32/winmm # Forked at Wine-20050628 dll/win32/winmm/midimap # Forked at Wine-20050628 dll/win32/winmm/wavemap # Forked at Wine-20050628
3 years, 10 months
1
0
0
0
[reactos] 38/39: [WINESYNC]: wininet is now in sync with wine-staging wine-6.0-rc1
by Jérôme Gardou
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c590d6ddadd1949c10b75…
commit c590d6ddadd1949c10b758d9afe2063d1a9836c8 Author: Jérôme Gardou <jerome.gardou(a)reactos.org> AuthorDate: Tue Dec 8 18:34:46 2020 +0100 Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com> CommitDate: Tue Jan 5 11:03:13 2021 +0100 [WINESYNC]: wininet is now in sync with wine-staging wine-6.0-rc1 --- sdk/tools/winesync/wininet.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/tools/winesync/wininet.cfg b/sdk/tools/winesync/wininet.cfg index 4c9385fe431..b6f5a87e7f7 100644 --- a/sdk/tools/winesync/wininet.cfg +++ b/sdk/tools/winesync/wininet.cfg @@ -5,4 +5,4 @@ files: include/wininet.h: sdk/include/psdk/wininet.h include/winineti.h: sdk/include/psdk/winineti.h tags: - wine: e88abf0dc4ae7ec6b2fd21130be09dadc478b9fc + wine: wine-6.0-rc1
3 years, 10 months
1
0
0
0
[reactos] 37/39: [WINESYNC] wininet: Replacing header fields should fail if they do not exist yet.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=208ef143d3ed2a55e7c1d…
commit 208ef143d3ed2a55e7c1d57b8db776dabaa1073f Author: winesync <ros-dev(a)reactos.org> AuthorDate: Tue Dec 8 18:31:47 2020 +0100 Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com> CommitDate: Tue Jan 5 11:03:13 2021 +0100 [WINESYNC] wininet: Replacing header fields should fail if they do not exist yet. A lot of details are not properly covered by tests yet and were marked with FIXME comments. The implementation was written in such a way that it behaves identical to the old code in such situations. wine-staging patch by Michael Müller <michael(a)fds-team.de> --- dll/win32/wininet/http.c | 185 ++++++++--------- ...ields_should_fail_if_they_do_not_exist_yet.diff | 225 +++++++++++++++++++++ 2 files changed, 318 insertions(+), 92 deletions(-) diff --git a/dll/win32/wininet/http.c b/dll/win32/wininet/http.c index 28d48c1eb6b..7f0c1073b3b 100644 --- a/dll/win32/wininet/http.c +++ b/dll/win32/wininet/http.c @@ -6116,127 +6116,128 @@ static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer) static DWORD HTTP_ProcessHeader(http_request_t *request, LPCWSTR field, LPCWSTR value, DWORD dwModifier) { - LPHTTPHEADERW lphttpHdr = NULL; + LPHTTPHEADERW lphttpHdr; INT index; BOOL request_only = !!(dwModifier & HTTP_ADDHDR_FLAG_REQ); - DWORD res = ERROR_HTTP_INVALID_HEADER; + DWORD res = ERROR_SUCCESS; TRACE("--> %s: %s - 0x%08x\n", debugstr_w(field), debugstr_w(value), dwModifier); EnterCriticalSection( &request->headers_section ); - /* REPLACE wins out over ADD */ - if (dwModifier & HTTP_ADDHDR_FLAG_REPLACE) - dwModifier &= ~HTTP_ADDHDR_FLAG_ADD; - - if (dwModifier & HTTP_ADDHDR_FLAG_ADD) - index = -1; - else - index = HTTP_GetCustomHeaderIndex(request, field, 0, request_only); - + index = HTTP_GetCustomHeaderIndex(request, field, 0, request_only); if (index >= 0) { - if (dwModifier & HTTP_ADDHDR_FLAG_ADD_IF_NEW) - { - LeaveCriticalSection( &request->headers_section ); - return ERROR_HTTP_INVALID_HEADER; - } lphttpHdr = &request->custHeaders[index]; - } - else if (value) - { - HTTPHEADERW hdr; - hdr.lpszField = (LPWSTR)field; - hdr.lpszValue = (LPWSTR)value; - hdr.wFlags = hdr.wCount = 0; + /* replace existing header if FLAG_REPLACE is given */ + if (dwModifier & HTTP_ADDHDR_FLAG_REPLACE) + { + HTTP_DeleteCustomHeader( request, index ); - if (dwModifier & HTTP_ADDHDR_FLAG_REQ) - hdr.wFlags |= HDR_ISREQUEST; + if (value && value[0]) + { + HTTPHEADERW hdr; - res = HTTP_InsertCustomHeader(request, &hdr); - LeaveCriticalSection( &request->headers_section ); - return res; - } - /* no value to delete */ - else - { - LeaveCriticalSection( &request->headers_section ); - return ERROR_SUCCESS; - } + hdr.lpszField = (LPWSTR)field; + hdr.lpszValue = (LPWSTR)value; + hdr.wFlags = hdr.wCount = 0; - if (dwModifier & HTTP_ADDHDR_FLAG_REQ) - lphttpHdr->wFlags |= HDR_ISREQUEST; - else - lphttpHdr->wFlags &= ~HDR_ISREQUEST; + if (dwModifier & HTTP_ADDHDR_FLAG_REQ) + hdr.wFlags |= HDR_ISREQUEST; - if (dwModifier & HTTP_ADDHDR_FLAG_REPLACE) - { - HTTP_DeleteCustomHeader( request, index ); + res = HTTP_InsertCustomHeader( request, &hdr ); + } + + goto out; + } - if (value && value[0]) + /* do not add new header if FLAG_ADD_IF_NEW is set */ + if (dwModifier & HTTP_ADDHDR_FLAG_ADD_IF_NEW) { - HTTPHEADERW hdr; + res = ERROR_HTTP_INVALID_HEADER; /* FIXME */ + goto out; + } - hdr.lpszField = (LPWSTR)field; - hdr.lpszValue = (LPWSTR)value; - hdr.wFlags = hdr.wCount = 0; + /* handle appending to existing header */ + if (dwModifier & COALESCEFLAGS) + { + LPWSTR lpsztmp; + WCHAR ch = 0; + INT len = 0; + INT origlen = lstrlenW(lphttpHdr->lpszValue); + INT valuelen = lstrlenW(value); + /* FIXME: Should it really clear HDR_ISREQUEST? */ if (dwModifier & HTTP_ADDHDR_FLAG_REQ) - hdr.wFlags |= HDR_ISREQUEST; - - res = HTTP_InsertCustomHeader(request, &hdr); - LeaveCriticalSection( &request->headers_section ); - return res; - } + lphttpHdr->wFlags |= HDR_ISREQUEST; + else + lphttpHdr->wFlags &= ~HDR_ISREQUEST; - LeaveCriticalSection( &request->headers_section ); - return ERROR_SUCCESS; - } - else if (dwModifier & COALESCEFLAGS) - { - LPWSTR lpsztmp; - WCHAR ch = 0; - INT len = 0; - INT origlen = lstrlenW(lphttpHdr->lpszValue); - INT valuelen = lstrlenW(value); + if (dwModifier & HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA) + { + ch = ','; + lphttpHdr->wFlags |= HDR_COMMADELIMITED; + } + else if (dwModifier & HTTP_ADDHDR_FLAG_COALESCE_WITH_SEMICOLON) + { + ch = ';'; + lphttpHdr->wFlags |= HDR_COMMADELIMITED; + } - if (dwModifier & HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA) - { - ch = ','; - lphttpHdr->wFlags |= HDR_COMMADELIMITED; - } - else if (dwModifier & HTTP_ADDHDR_FLAG_COALESCE_WITH_SEMICOLON) - { - ch = ';'; - lphttpHdr->wFlags |= HDR_COMMADELIMITED; - } + len = origlen + valuelen + ((ch > 0) ? 2 : 0); - len = origlen + valuelen + ((ch > 0) ? 2 : 0); + lpsztmp = heap_realloc(lphttpHdr->lpszValue, (len+1)*sizeof(WCHAR)); + if (lpsztmp) + { + lphttpHdr->lpszValue = lpsztmp; + /* FIXME: Increment lphttpHdr->wCount. Perhaps lpszValue should be an array */ + if (ch > 0) + { + lphttpHdr->lpszValue[origlen] = ch; + origlen++; + lphttpHdr->lpszValue[origlen] = ' '; + origlen++; + } - lpsztmp = heap_realloc(lphttpHdr->lpszValue, (len+1)*sizeof(WCHAR)); - if (lpsztmp) - { - lphttpHdr->lpszValue = lpsztmp; - /* FIXME: Increment lphttpHdr->wCount. Perhaps lpszValue should be an array */ - if (ch > 0) + memcpy(&lphttpHdr->lpszValue[origlen], value, valuelen*sizeof(WCHAR)); + lphttpHdr->lpszValue[len] = '\0'; + } + else { - lphttpHdr->lpszValue[origlen] = ch; - origlen++; - lphttpHdr->lpszValue[origlen] = ' '; - origlen++; + WARN("heap_realloc (%d bytes) failed\n",len+1); + res = ERROR_OUTOFMEMORY; } - memcpy(&lphttpHdr->lpszValue[origlen], value, valuelen*sizeof(WCHAR)); - lphttpHdr->lpszValue[len] = '\0'; - res = ERROR_SUCCESS; - } - else - { - WARN("heap_realloc (%d bytes) failed\n",len+1); - res = ERROR_OUTOFMEMORY; + goto out; } } + + /* FIXME: What about other combinations? */ + if ((dwModifier & ~HTTP_ADDHDR_FLAG_REQ) == HTTP_ADDHDR_FLAG_REPLACE) + { + res = ERROR_HTTP_HEADER_NOT_FOUND; + goto out; + } + + /* FIXME: What if value == ""? */ + if (value) + { + HTTPHEADERW hdr; + + hdr.lpszField = (LPWSTR)field; + hdr.lpszValue = (LPWSTR)value; + hdr.wFlags = hdr.wCount = 0; + + if (dwModifier & HTTP_ADDHDR_FLAG_REQ) + hdr.wFlags |= HDR_ISREQUEST; + + res = HTTP_InsertCustomHeader( request, &hdr ); + goto out; + } + + /* FIXME: What if value == NULL? */ +out: TRACE("<-- %d\n", res); LeaveCriticalSection( &request->headers_section ); return res; diff --git a/sdk/tools/winesync/wininet_staging/0005-wininet__Replacing_header_fields_should_fail_if_they_do_not_exist_yet.diff b/sdk/tools/winesync/wininet_staging/0005-wininet__Replacing_header_fields_should_fail_if_they_do_not_exist_yet.diff new file mode 100644 index 00000000000..9d5ab4e28a6 --- /dev/null +++ b/sdk/tools/winesync/wininet_staging/0005-wininet__Replacing_header_fields_should_fail_if_they_do_not_exist_yet.diff @@ -0,0 +1,225 @@ +diff --git a/dll/win32/wininet/http.c b/dll/win32/wininet/http.c +index f7d9e29b96..09566b7cde 100644 +--- a/dll/win32/wininet/http.c ++++ b/dll/win32/wininet/http.c +@@ -6112,127 +6112,128 @@ static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer) + + static DWORD HTTP_ProcessHeader(http_request_t *request, LPCWSTR field, LPCWSTR value, DWORD dwModifier) + { +- LPHTTPHEADERW lphttpHdr = NULL; ++ LPHTTPHEADERW lphttpHdr; + INT index; + BOOL request_only = !!(dwModifier & HTTP_ADDHDR_FLAG_REQ); +- DWORD res = ERROR_HTTP_INVALID_HEADER; ++ DWORD res = ERROR_SUCCESS; + + TRACE("--> %s: %s - 0x%08x\n", debugstr_w(field), debugstr_w(value), dwModifier); + + EnterCriticalSection( &request->headers_section ); + +- /* REPLACE wins out over ADD */ +- if (dwModifier & HTTP_ADDHDR_FLAG_REPLACE) +- dwModifier &= ~HTTP_ADDHDR_FLAG_ADD; +- +- if (dwModifier & HTTP_ADDHDR_FLAG_ADD) +- index = -1; +- else +- index = HTTP_GetCustomHeaderIndex(request, field, 0, request_only); +- ++ index = HTTP_GetCustomHeaderIndex(request, field, 0, request_only); + if (index >= 0) + { +- if (dwModifier & HTTP_ADDHDR_FLAG_ADD_IF_NEW) +- { +- LeaveCriticalSection( &request->headers_section ); +- return ERROR_HTTP_INVALID_HEADER; +- } + lphttpHdr = &request->custHeaders[index]; +- } +- else if (value) +- { +- HTTPHEADERW hdr; + +- hdr.lpszField = (LPWSTR)field; +- hdr.lpszValue = (LPWSTR)value; +- hdr.wFlags = hdr.wCount = 0; ++ /* replace existing header if FLAG_REPLACE is given */ ++ if (dwModifier & HTTP_ADDHDR_FLAG_REPLACE) ++ { ++ HTTP_DeleteCustomHeader( request, index ); + +- if (dwModifier & HTTP_ADDHDR_FLAG_REQ) +- hdr.wFlags |= HDR_ISREQUEST; ++ if (value && value[0]) ++ { ++ HTTPHEADERW hdr; + +- res = HTTP_InsertCustomHeader(request, &hdr); +- LeaveCriticalSection( &request->headers_section ); +- return res; +- } +- /* no value to delete */ +- else +- { +- LeaveCriticalSection( &request->headers_section ); +- return ERROR_SUCCESS; +- } ++ hdr.lpszField = (LPWSTR)field; ++ hdr.lpszValue = (LPWSTR)value; ++ hdr.wFlags = hdr.wCount = 0; + +- if (dwModifier & HTTP_ADDHDR_FLAG_REQ) +- lphttpHdr->wFlags |= HDR_ISREQUEST; +- else +- lphttpHdr->wFlags &= ~HDR_ISREQUEST; ++ if (dwModifier & HTTP_ADDHDR_FLAG_REQ) ++ hdr.wFlags |= HDR_ISREQUEST; + +- if (dwModifier & HTTP_ADDHDR_FLAG_REPLACE) +- { +- HTTP_DeleteCustomHeader( request, index ); ++ res = HTTP_InsertCustomHeader( request, &hdr ); ++ } ++ ++ goto out; ++ } + +- if (value && value[0]) ++ /* do not add new header if FLAG_ADD_IF_NEW is set */ ++ if (dwModifier & HTTP_ADDHDR_FLAG_ADD_IF_NEW) + { +- HTTPHEADERW hdr; ++ res = ERROR_HTTP_INVALID_HEADER; /* FIXME */ ++ goto out; ++ } + +- hdr.lpszField = (LPWSTR)field; +- hdr.lpszValue = (LPWSTR)value; +- hdr.wFlags = hdr.wCount = 0; ++ /* handle appending to existing header */ ++ if (dwModifier & COALESCEFLAGS) ++ { ++ LPWSTR lpsztmp; ++ WCHAR ch = 0; ++ INT len = 0; ++ INT origlen = lstrlenW(lphttpHdr->lpszValue); ++ INT valuelen = lstrlenW(value); + ++ /* FIXME: Should it really clear HDR_ISREQUEST? */ + if (dwModifier & HTTP_ADDHDR_FLAG_REQ) +- hdr.wFlags |= HDR_ISREQUEST; +- +- res = HTTP_InsertCustomHeader(request, &hdr); +- LeaveCriticalSection( &request->headers_section ); +- return res; +- } ++ lphttpHdr->wFlags |= HDR_ISREQUEST; ++ else ++ lphttpHdr->wFlags &= ~HDR_ISREQUEST; + +- LeaveCriticalSection( &request->headers_section ); +- return ERROR_SUCCESS; +- } +- else if (dwModifier & COALESCEFLAGS) +- { +- LPWSTR lpsztmp; +- WCHAR ch = 0; +- INT len = 0; +- INT origlen = lstrlenW(lphttpHdr->lpszValue); +- INT valuelen = lstrlenW(value); ++ if (dwModifier & HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA) ++ { ++ ch = ','; ++ lphttpHdr->wFlags |= HDR_COMMADELIMITED; ++ } ++ else if (dwModifier & HTTP_ADDHDR_FLAG_COALESCE_WITH_SEMICOLON) ++ { ++ ch = ';'; ++ lphttpHdr->wFlags |= HDR_COMMADELIMITED; ++ } + +- if (dwModifier & HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA) +- { +- ch = ','; +- lphttpHdr->wFlags |= HDR_COMMADELIMITED; +- } +- else if (dwModifier & HTTP_ADDHDR_FLAG_COALESCE_WITH_SEMICOLON) +- { +- ch = ';'; +- lphttpHdr->wFlags |= HDR_COMMADELIMITED; +- } ++ len = origlen + valuelen + ((ch > 0) ? 2 : 0); + +- len = origlen + valuelen + ((ch > 0) ? 2 : 0); ++ lpsztmp = heap_realloc(lphttpHdr->lpszValue, (len+1)*sizeof(WCHAR)); ++ if (lpsztmp) ++ { ++ lphttpHdr->lpszValue = lpsztmp; ++ /* FIXME: Increment lphttpHdr->wCount. Perhaps lpszValue should be an array */ ++ if (ch > 0) ++ { ++ lphttpHdr->lpszValue[origlen] = ch; ++ origlen++; ++ lphttpHdr->lpszValue[origlen] = ' '; ++ origlen++; ++ } + +- lpsztmp = heap_realloc(lphttpHdr->lpszValue, (len+1)*sizeof(WCHAR)); +- if (lpsztmp) +- { +- lphttpHdr->lpszValue = lpsztmp; +- /* FIXME: Increment lphttpHdr->wCount. Perhaps lpszValue should be an array */ +- if (ch > 0) ++ memcpy(&lphttpHdr->lpszValue[origlen], value, valuelen*sizeof(WCHAR)); ++ lphttpHdr->lpszValue[len] = '\0'; ++ } ++ else + { +- lphttpHdr->lpszValue[origlen] = ch; +- origlen++; +- lphttpHdr->lpszValue[origlen] = ' '; +- origlen++; ++ WARN("heap_realloc (%d bytes) failed\n",len+1); ++ res = ERROR_OUTOFMEMORY; + } + +- memcpy(&lphttpHdr->lpszValue[origlen], value, valuelen*sizeof(WCHAR)); +- lphttpHdr->lpszValue[len] = '\0'; +- res = ERROR_SUCCESS; +- } +- else +- { +- WARN("heap_realloc (%d bytes) failed\n",len+1); +- res = ERROR_OUTOFMEMORY; ++ goto out; + } + } ++ ++ /* FIXME: What about other combinations? */ ++ if ((dwModifier & ~HTTP_ADDHDR_FLAG_REQ) == HTTP_ADDHDR_FLAG_REPLACE) ++ { ++ res = ERROR_HTTP_HEADER_NOT_FOUND; ++ goto out; ++ } ++ ++ /* FIXME: What if value == ""? */ ++ if (value) ++ { ++ HTTPHEADERW hdr; ++ ++ hdr.lpszField = (LPWSTR)field; ++ hdr.lpszValue = (LPWSTR)value; ++ hdr.wFlags = hdr.wCount = 0; ++ ++ if (dwModifier & HTTP_ADDHDR_FLAG_REQ) ++ hdr.wFlags |= HDR_ISREQUEST; ++ ++ res = HTTP_InsertCustomHeader( request, &hdr ); ++ goto out; ++ } ++ ++ /* FIXME: What if value == NULL? */ ++out: + TRACE("<-- %d\n", res); + LeaveCriticalSection( &request->headers_section ); + return res;
3 years, 10 months
1
0
0
0
[reactos] 36/39: [WINESYNC] wininet: Strip filename if no path is set in cookie.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=aa27aac08b8c0a8501ad4…
commit aa27aac08b8c0a8501ad491171bba9108fd090bd Author: winesync <ros-dev(a)reactos.org> AuthorDate: Tue Dec 8 18:22:04 2020 +0100 Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com> CommitDate: Tue Jan 5 11:03:13 2021 +0100 [WINESYNC] wininet: Strip filename if no path is set in cookie. The order of the stored cookies doesn't match in /testC, so be a bit less strict in the test. wine-staging patch by Michael Müller <michael(a)fds-team.de> --- dll/win32/wininet/http.c | 11 +++- modules/rostests/winetests/wininet/http.c | 6 +- ...Strip_filename_if_no_path_is_set_in_cookie.diff | 67 ++++++++++++++++++++++ 3 files changed, 80 insertions(+), 4 deletions(-) diff --git a/dll/win32/wininet/http.c b/dll/win32/wininet/http.c index 73c5a61dae4..28d48c1eb6b 100644 --- a/dll/win32/wininet/http.c +++ b/dll/win32/wininet/http.c @@ -668,10 +668,18 @@ static void HTTP_ProcessCookies( http_request_t *request ) int HeaderIndex; int numCookies = 0; LPHTTPHEADERW setCookieHeader; + WCHAR *path, *tmp; if(request->hdr.dwFlags & INTERNET_FLAG_NO_COOKIES) return; + path = heap_strdupW(request->path); + if (!path) + return; + + tmp = wcsrchr(path, '/'); + if (tmp && tmp[1]) tmp[1] = 0; + EnterCriticalSection( &request->headers_section ); while((HeaderIndex = HTTP_GetCustomHeaderIndex(request, L"Set-Cookie", numCookies++, FALSE)) != -1) @@ -690,10 +698,11 @@ static void HTTP_ProcessCookies( http_request_t *request ) name = substr(setCookieHeader->lpszValue, data - setCookieHeader->lpszValue); data++; - set_cookie(substrz(request->server->name), substrz(request->path), name, substrz(data), INTERNET_COOKIE_HTTPONLY); + set_cookie(substrz(request->server->name), substrz(path), name, substrz(data), INTERNET_COOKIE_HTTPONLY); } LeaveCriticalSection( &request->headers_section ); + heap_free(path); } static void strip_spaces(LPWSTR start) diff --git a/modules/rostests/winetests/wininet/http.c b/modules/rostests/winetests/wininet/http.c index ce2dfd477c3..3b7fd390556 100644 --- a/modules/rostests/winetests/wininet/http.c +++ b/modules/rostests/winetests/wininet/http.c @@ -2364,7 +2364,7 @@ static DWORD CALLBACK server_thread(LPVOID param) } if (strstr(buffer, "/testC")) { - if (strstr(buffer, "Cookie: cookie=biscuit")) + if (strstr(buffer, "cookie=biscuit")) send(c, okmsg, sizeof okmsg-1, 0); else send(c, notokmsg, sizeof notokmsg-1, 0); @@ -3352,7 +3352,7 @@ static void test_header_override(int port) ret = HttpSendRequestA(req, NULL, 0, NULL, 0); ok(ret, "HttpSendRequest failed\n"); - test_status_code_todo(req, 200); + test_status_code(req, 200); InternetCloseHandle(req); req = HttpOpenRequestA(con, NULL, "/test_cookie_check_host_override", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); @@ -3361,7 +3361,7 @@ static void test_header_override(int port) ret = HttpSendRequestA(req, NULL, 0, NULL, 0); ok(ret, "HttpSendRequest failed\n"); - test_status_code_todo(req, 200); + test_status_code(req, 200); InternetCloseHandle(req); InternetSetCookieA("
http://test.local
", "foo", "bar"); diff --git a/sdk/tools/winesync/wininet_staging/0004-wininet__Strip_filename_if_no_path_is_set_in_cookie.diff b/sdk/tools/winesync/wininet_staging/0004-wininet__Strip_filename_if_no_path_is_set_in_cookie.diff new file mode 100644 index 00000000000..b45c152a8db --- /dev/null +++ b/sdk/tools/winesync/wininet_staging/0004-wininet__Strip_filename_if_no_path_is_set_in_cookie.diff @@ -0,0 +1,67 @@ +diff --git a/dll/win32/wininet/http.c b/dll/win32/wininet/http.c +index c770c31..d95b39b 100644 +--- a/dll/win32/wininet/http.c ++++ b/dll/win32/wininet/http.c +@@ -654,10 +654,18 @@ static void HTTP_ProcessCookies( http_request_t *request ) + int HeaderIndex; + int numCookies = 0; + LPHTTPHEADERW setCookieHeader; ++ WCHAR *path, *tmp; + + if(request->hdr.dwFlags & INTERNET_FLAG_NO_COOKIES) + return; + ++ path = heap_strdupW(request->path); ++ if (!path) ++ return; ++ ++ tmp = wcsrchr(path, '/'); ++ if (tmp && tmp[1]) tmp[1] = 0; ++ + EnterCriticalSection( &request->headers_section ); + + while((HeaderIndex = HTTP_GetCustomHeaderIndex(request, L"Set-Cookie", numCookies++, FALSE)) != -1) +@@ -676,10 +684,11 @@ static void HTTP_ProcessCookies( http_request_t *request ) + + name = substr(setCookieHeader->lpszValue, data - setCookieHeader->lpszValue); + data++; +- set_cookie(substrz(request->server->name), substrz(request->path), name, substrz(data), INTERNET_COOKIE_HTTPONLY); ++ set_cookie(substrz(request->server->name), substrz(path), name, substrz(data), INTERNET_COOKIE_HTTPONLY); + } + + LeaveCriticalSection( &request->headers_section ); ++ heap_free(path); + } + + static void strip_spaces(LPWSTR start) +diff --git a/modules/rostests/winetests/wininet/http.c b/modules/rostests/winetests/wininet/http.c +index 510c3ac..b98e648 100644 +--- a/modules/rostests/winetests/wininet/http.c ++++ b/modules/rostests/winetests/wininet/http.c +@@ -2363,7 +2363,7 @@ static DWORD CALLBACK server_thread(LPVOID param) + } + if (strstr(buffer, "/testC")) + { +- if (strstr(buffer, "Cookie: cookie=biscuit")) ++ if (strstr(buffer, "cookie=biscuit")) + send(c, okmsg, sizeof okmsg-1, 0); + else + send(c, notokmsg, sizeof notokmsg-1, 0); +@@ -3351,7 +3351,7 @@ static void test_header_override(int port) + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed\n"); + +- test_status_code_todo(req, 200); ++ test_status_code(req, 200); + + InternetCloseHandle(req); + req = HttpOpenRequestA(con, NULL, "/test_cookie_check_host_override", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); +@@ -3360,7 +3360,7 @@ static void test_header_override(int port) + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed\n"); + +- test_status_code_todo(req, 200); ++ test_status_code(req, 200); + + InternetCloseHandle(req); + InternetSetCookieA("
http://test.local
", "foo", "bar");
3 years, 10 months
1
0
0
0
[reactos] 35/39: [WINESYNC] wininet/tests: Check cookie behaviour when overriding host.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ff5fa7aea456e4cfecbe2…
commit ff5fa7aea456e4cfecbe2401725b31b1ba664d3b Author: winesync <ros-dev(a)reactos.org> AuthorDate: Tue Dec 8 18:22:04 2020 +0100 Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com> CommitDate: Tue Jan 5 11:03:13 2021 +0100 [WINESYNC] wininet/tests: Check cookie behaviour when overriding host. wine-staging patch by Michael Müller <michael(a)fds-team.de> --- modules/rostests/winetests/wininet/http.c | 95 ++++++++++++++++ ...heck_cookie_behaviour_when_overriding_host.diff | 120 +++++++++++++++++++++ 2 files changed, 215 insertions(+) diff --git a/modules/rostests/winetests/wininet/http.c b/modules/rostests/winetests/wininet/http.c index 11d9f8b18db..ce2dfd477c3 100644 --- a/modules/rostests/winetests/wininet/http.c +++ b/modules/rostests/winetests/wininet/http.c @@ -2138,6 +2138,14 @@ static const char okmsg_cookie_path[] = "Set-Cookie: subcookie2=data; path=/test_cookie_set_path\r\n" "\r\n"; +static const char okmsg_cookie[] = +"HTTP/1.1 200 OK\r\n" +"Date: Mon, 01 Dec 2008 13:44:34 GMT\r\n" +"Server: winetest\r\n" +"Content-Length: 0\r\n" +"Set-Cookie: testcookie=testvalue\r\n" +"\r\n"; + static const char notokmsg[] = "HTTP/1.1 400 Bad Request\r\n" "Server: winetest\r\n" @@ -2543,6 +2551,25 @@ static DWORD CALLBACK server_thread(LPVOID param) else send(c, notokmsg, sizeof notokmsg-1, 0); } + if (strstr(buffer, "/test_cookie_set_host_override")) + { + send(c, okmsg_cookie, sizeof okmsg_cookie-1, 0); + } + if (strstr(buffer, "/test_cookie_check_host_override")) + { + if (strstr(buffer, "Cookie:") && strstr(buffer, "testcookie=testvalue")) + send(c, okmsg, sizeof okmsg-1, 0); + else + send(c, notokmsg, sizeof notokmsg-1, 0); + } + if (strstr(buffer, "/test_cookie_check_different_host")) + { + if (!strstr(buffer, "foo") && + strstr(buffer, "cookie=biscuit")) + send(c, okmsg, sizeof okmsg-1, 0); + else + send(c, notokmsg, sizeof notokmsg-1, 0); + } if (strstr(buffer, "/test_host_override")) { if (strstr(buffer, host_header_override)) @@ -3290,6 +3317,74 @@ static void test_header_override(int port) test_status_code(req, 400); } + InternetCloseHandle(req); + InternetSetCookieA("
http://localhost
", "cookie", "biscuit"); + req = HttpOpenRequestA(con, NULL, "/testC", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); + ok(req != NULL, "HttpOpenRequest failed\n"); + + ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); + ok(ret, "HttpAddRequestHeaders failed\n"); + + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed\n"); + + test_status_code(req, 200); + + InternetCloseHandle(req); + req = HttpOpenRequestA(con, NULL, "/test_cookie_set_host_override", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); + ok(req != NULL, "HttpOpenRequest failed\n"); + + ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); + ok(ret, "HttpAddRequestHeaders failed\n"); + + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed\n"); + + test_status_code(req, 200); + + InternetCloseHandle(req); + req = HttpOpenRequestA(con, NULL, "/test_cookie_check_host_override", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); + ok(req != NULL, "HttpOpenRequest failed\n"); + + ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); + ok(ret, "HttpAddRequestHeaders failed\n"); + + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed\n"); + + test_status_code_todo(req, 200); + + InternetCloseHandle(req); + req = HttpOpenRequestA(con, NULL, "/test_cookie_check_host_override", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); + ok(req != NULL, "HttpOpenRequest failed\n"); + + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed\n"); + + test_status_code_todo(req, 200); + + InternetCloseHandle(req); + InternetSetCookieA("
http://test.local
", "foo", "bar"); + req = HttpOpenRequestA(con, NULL, "/test_cookie_check_different_host", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); + ok(req != NULL, "HttpOpenRequest failed\n"); + + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed\n"); + + test_status_code(req, 200); + + InternetCloseHandle(req); + req = HttpOpenRequestA(con, NULL, "/test_cookie_check_different_host", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); + ok(req != NULL, "HttpOpenRequest failed\n"); + + ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); + ok(ret, "HttpAddRequestHeaders failed\n"); + + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed\n"); + + test_status_code(req, 200); + InternetCloseHandle(req); InternetCloseHandle(con); InternetCloseHandle(ses); diff --git a/sdk/tools/winesync/wininet_staging/0003-wininet_tests__Check_cookie_behaviour_when_overriding_host.diff b/sdk/tools/winesync/wininet_staging/0003-wininet_tests__Check_cookie_behaviour_when_overriding_host.diff new file mode 100644 index 00000000000..f9d45bd4382 --- /dev/null +++ b/sdk/tools/winesync/wininet_staging/0003-wininet_tests__Check_cookie_behaviour_when_overriding_host.diff @@ -0,0 +1,120 @@ +diff --git a/modules/rostests/winetests/wininet/http.c b/modules/rostests/winetests/wininet/http.c +index 79fd5e9..510c3ac 100644 +--- a/modules/rostests/winetests/wininet/http.c ++++ b/modules/rostests/winetests/wininet/http.c +@@ -2137,6 +2137,14 @@ static const char okmsg_cookie_path[] = + "Set-Cookie: subcookie2=data; path=/test_cookie_set_path\r\n" + "\r\n"; + ++static const char okmsg_cookie[] = ++"HTTP/1.1 200 OK\r\n" ++"Date: Mon, 01 Dec 2008 13:44:34 GMT\r\n" ++"Server: winetest\r\n" ++"Content-Length: 0\r\n" ++"Set-Cookie: testcookie=testvalue\r\n" ++"\r\n"; ++ + static const char notokmsg[] = + "HTTP/1.1 400 Bad Request\r\n" + "Server: winetest\r\n" +@@ -2542,6 +2550,25 @@ static DWORD CALLBACK server_thread(LPVOID param) + else + send(c, notokmsg, sizeof notokmsg-1, 0); + } ++ if (strstr(buffer, "/test_cookie_set_host_override")) ++ { ++ send(c, okmsg_cookie, sizeof okmsg_cookie-1, 0); ++ } ++ if (strstr(buffer, "/test_cookie_check_host_override")) ++ { ++ if (strstr(buffer, "Cookie:") && strstr(buffer, "testcookie=testvalue")) ++ send(c, okmsg, sizeof okmsg-1, 0); ++ else ++ send(c, notokmsg, sizeof notokmsg-1, 0); ++ } ++ if (strstr(buffer, "/test_cookie_check_different_host")) ++ { ++ if (!strstr(buffer, "foo") && ++ strstr(buffer, "cookie=biscuit")) ++ send(c, okmsg, sizeof okmsg-1, 0); ++ else ++ send(c, notokmsg, sizeof notokmsg-1, 0); ++ } + if (strstr(buffer, "/test_host_override")) + { + if (strstr(buffer, host_header_override)) +@@ -3290,6 +3317,74 @@ static void test_header_override(int port) + } + + InternetCloseHandle(req); ++ InternetSetCookieA("
http://localhost
", "cookie", "biscuit"); ++ req = HttpOpenRequestA(con, NULL, "/testC", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); ++ ok(req != NULL, "HttpOpenRequest failed\n"); ++ ++ ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); ++ ok(ret, "HttpAddRequestHeaders failed\n"); ++ ++ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); ++ ok(ret, "HttpSendRequest failed\n"); ++ ++ test_status_code(req, 200); ++ ++ InternetCloseHandle(req); ++ req = HttpOpenRequestA(con, NULL, "/test_cookie_set_host_override", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); ++ ok(req != NULL, "HttpOpenRequest failed\n"); ++ ++ ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); ++ ok(ret, "HttpAddRequestHeaders failed\n"); ++ ++ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); ++ ok(ret, "HttpSendRequest failed\n"); ++ ++ test_status_code(req, 200); ++ ++ InternetCloseHandle(req); ++ req = HttpOpenRequestA(con, NULL, "/test_cookie_check_host_override", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); ++ ok(req != NULL, "HttpOpenRequest failed\n"); ++ ++ ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); ++ ok(ret, "HttpAddRequestHeaders failed\n"); ++ ++ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); ++ ok(ret, "HttpSendRequest failed\n"); ++ ++ test_status_code_todo(req, 200); ++ ++ InternetCloseHandle(req); ++ req = HttpOpenRequestA(con, NULL, "/test_cookie_check_host_override", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); ++ ok(req != NULL, "HttpOpenRequest failed\n"); ++ ++ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); ++ ok(ret, "HttpSendRequest failed\n"); ++ ++ test_status_code_todo(req, 200); ++ ++ InternetCloseHandle(req); ++ InternetSetCookieA("
http://test.local
", "foo", "bar"); ++ req = HttpOpenRequestA(con, NULL, "/test_cookie_check_different_host", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); ++ ok(req != NULL, "HttpOpenRequest failed\n"); ++ ++ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); ++ ok(ret, "HttpSendRequest failed\n"); ++ ++ test_status_code(req, 200); ++ ++ InternetCloseHandle(req); ++ req = HttpOpenRequestA(con, NULL, "/test_cookie_check_different_host", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); ++ ok(req != NULL, "HttpOpenRequest failed\n"); ++ ++ ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); ++ ok(ret, "HttpAddRequestHeaders failed\n"); ++ ++ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); ++ ok(ret, "HttpSendRequest failed\n"); ++ ++ test_status_code(req, 200); ++ ++ InternetCloseHandle(req); + InternetCloseHandle(con); + InternetCloseHandle(ses); +
3 years, 10 months
1
0
0
0
[reactos] 34/39: [WINESYNC] wininet/tests: Test auth credential reusage with host override.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0adc3ed6ba137516f2676…
commit 0adc3ed6ba137516f2676fe2a8f9933643cf671e Author: winesync <ros-dev(a)reactos.org> AuthorDate: Tue Dec 8 18:22:03 2020 +0100 Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com> CommitDate: Tue Jan 5 11:03:13 2021 +0100 [WINESYNC] wininet/tests: Test auth credential reusage with host override. wine-staging patch by Michael Müller <michael(a)fds-team.de> --- modules/rostests/winetests/wininet/http.c | 93 ++++++++++++++++ ...auth_credential_reusage_with_host_override.diff | 117 +++++++++++++++++++++ 2 files changed, 210 insertions(+) diff --git a/modules/rostests/winetests/wininet/http.c b/modules/rostests/winetests/wininet/http.c index c7cdea84ce3..11d9f8b18db 100644 --- a/modules/rostests/winetests/wininet/http.c +++ b/modules/rostests/winetests/wininet/http.c @@ -2574,12 +2574,27 @@ static DWORD CALLBACK server_thread(LPVOID param) { send(c, okmsg, sizeof(okmsg)-1, 0); } + if (strstr(buffer, "HEAD /test_large_content")) { char msg[sizeof(largemsg) + 16]; sprintf(msg, largemsg, content_length); send(c, msg, strlen(msg), 0); } + if (strstr(buffer, "HEAD /test_auth_host1")) + { + if (strstr(buffer, "Authorization: Basic dGVzdDE6cGFzcw==")) + send(c, okmsg, sizeof okmsg-1, 0); + else + send(c, noauthmsg, sizeof noauthmsg-1, 0); + } + if (strstr(buffer, "HEAD /test_auth_host2")) + { + if (strstr(buffer, "Authorization: Basic dGVzdDE6cGFzczI=")) + send(c, okmsg, sizeof okmsg-1, 0); + else + send(c, noauthmsg, sizeof noauthmsg-1, 0); + } shutdown(c, 2); closesocket(c); c = -1; @@ -3278,6 +3293,84 @@ static void test_header_override(int port) InternetCloseHandle(req); InternetCloseHandle(con); InternetCloseHandle(ses); + + ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); + ok(ses != NULL, "InternetOpenA failed\n"); + + con = InternetConnectA(ses, "localhost", port, "test1", "pass", INTERNET_SERVICE_HTTP, 0, 0); + ok(con != NULL, "InternetConnectA failed %u\n", GetLastError()); + + req = HttpOpenRequestA( con, "HEAD", "/test_auth_host1", NULL, NULL, NULL, 0, 0); + ok(req != NULL, "HttpOpenRequestA failed %u\n", GetLastError()); + + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequestA failed %u\n", GetLastError()); + + test_status_code(req, 200); + + InternetCloseHandle(req); + InternetCloseHandle(con); + InternetCloseHandle(ses); + + ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); + ok(ses != NULL, "InternetOpenA failed\n"); + + con = InternetConnectA( ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); + ok(con != NULL, "InternetConnectA failed %u\n", GetLastError()); + + req = HttpOpenRequestA(con, "HEAD", "/test_auth_host1", NULL, NULL, NULL, 0, 0); + ok(req != NULL, "HttpOpenRequestA failed %u\n", GetLastError()); + + ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); + ok(ret, "HttpAddRequestHeaders failed\n"); + + ret = HttpSendRequestA( req, NULL, 0, NULL, 0 ); + ok( ret, "HttpSendRequestA failed %u\n", GetLastError() ); + + test_status_code(req, 200); + + InternetCloseHandle(req); + InternetCloseHandle(con); + InternetCloseHandle(ses); + + ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); + ok(ses != NULL, "InternetOpenA failed\n"); + + con = InternetConnectA(ses, "localhost", port, "test1", "pass2", INTERNET_SERVICE_HTTP, 0, 0); + ok(con != NULL, "InternetConnectA failed %u\n", GetLastError()); + + req = HttpOpenRequestA(con, "HEAD", "/test_auth_host2", NULL, NULL, NULL, 0, 0); + ok(req != NULL, "HttpOpenRequestA failed %u\n", GetLastError()); + + ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); + ok(ret, "HttpAddRequestHeaders failed\n"); + + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequestA failed %u\n", GetLastError()); + + test_status_code(req, 200); + + InternetCloseHandle(req); + InternetCloseHandle(con); + InternetCloseHandle(ses); + + ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); + ok(ses != NULL, "InternetOpenA failed\n"); + + con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); + ok(con != NULL, "InternetConnectA failed %u\n", GetLastError()); + + req = HttpOpenRequestA(con, "HEAD", "/test_auth_host2", NULL, NULL, NULL, 0, 0); + ok(req != NULL, "HttpOpenRequestA failed %u\n", GetLastError()); + + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequestA failed %u\n", GetLastError()); + + test_status_code(req, 200); + + InternetCloseHandle(req); + InternetCloseHandle(con); + InternetCloseHandle(ses); } static void test_connection_closing(int port) diff --git a/sdk/tools/winesync/wininet_staging/0002-wininet_tests__Test_auth_credential_reusage_with_host_override.diff b/sdk/tools/winesync/wininet_staging/0002-wininet_tests__Test_auth_credential_reusage_with_host_override.diff new file mode 100644 index 00000000000..4fe77d35487 --- /dev/null +++ b/sdk/tools/winesync/wininet_staging/0002-wininet_tests__Test_auth_credential_reusage_with_host_override.diff @@ -0,0 +1,117 @@ +diff --git a/modules/rostests/winetests/wininet/http.c b/modules/rostests/winetests/wininet/http.c +index 9ef56ce..79fd5e9 100644 +--- a/modules/rostests/winetests/wininet/http.c ++++ b/modules/rostests/winetests/wininet/http.c +@@ -2573,12 +2573,27 @@ static DWORD CALLBACK server_thread(LPVOID param) + { + send(c, okmsg, sizeof(okmsg)-1, 0); + } ++ + if (strstr(buffer, "HEAD /test_large_content")) + { + char msg[sizeof(largemsg) + 16]; + sprintf(msg, largemsg, content_length); + send(c, msg, strlen(msg), 0); + } ++ if (strstr(buffer, "HEAD /test_auth_host1")) ++ { ++ if (strstr(buffer, "Authorization: Basic dGVzdDE6cGFzcw==")) ++ send(c, okmsg, sizeof okmsg-1, 0); ++ else ++ send(c, noauthmsg, sizeof noauthmsg-1, 0); ++ } ++ if (strstr(buffer, "HEAD /test_auth_host2")) ++ { ++ if (strstr(buffer, "Authorization: Basic dGVzdDE6cGFzczI=")) ++ send(c, okmsg, sizeof okmsg-1, 0); ++ else ++ send(c, noauthmsg, sizeof noauthmsg-1, 0); ++ } + shutdown(c, 2); + closesocket(c); + c = -1; +@@ -3277,6 +3292,84 @@ static void test_header_override(int port) + InternetCloseHandle(req); + InternetCloseHandle(con); + InternetCloseHandle(ses); ++ ++ ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); ++ ok(ses != NULL, "InternetOpenA failed\n"); ++ ++ con = InternetConnectA(ses, "localhost", port, "test1", "pass", INTERNET_SERVICE_HTTP, 0, 0); ++ ok(con != NULL, "InternetConnectA failed %u\n", GetLastError()); ++ ++ req = HttpOpenRequestA( con, "HEAD", "/test_auth_host1", NULL, NULL, NULL, 0, 0); ++ ok(req != NULL, "HttpOpenRequestA failed %u\n", GetLastError()); ++ ++ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); ++ ok(ret, "HttpSendRequestA failed %u\n", GetLastError()); ++ ++ test_status_code(req, 200); ++ ++ InternetCloseHandle(req); ++ InternetCloseHandle(con); ++ InternetCloseHandle(ses); ++ ++ ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); ++ ok(ses != NULL, "InternetOpenA failed\n"); ++ ++ con = InternetConnectA( ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); ++ ok(con != NULL, "InternetConnectA failed %u\n", GetLastError()); ++ ++ req = HttpOpenRequestA(con, "HEAD", "/test_auth_host1", NULL, NULL, NULL, 0, 0); ++ ok(req != NULL, "HttpOpenRequestA failed %u\n", GetLastError()); ++ ++ ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); ++ ok(ret, "HttpAddRequestHeaders failed\n"); ++ ++ ret = HttpSendRequestA( req, NULL, 0, NULL, 0 ); ++ ok( ret, "HttpSendRequestA failed %u\n", GetLastError() ); ++ ++ test_status_code(req, 200); ++ ++ InternetCloseHandle(req); ++ InternetCloseHandle(con); ++ InternetCloseHandle(ses); ++ ++ ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); ++ ok(ses != NULL, "InternetOpenA failed\n"); ++ ++ con = InternetConnectA(ses, "localhost", port, "test1", "pass2", INTERNET_SERVICE_HTTP, 0, 0); ++ ok(con != NULL, "InternetConnectA failed %u\n", GetLastError()); ++ ++ req = HttpOpenRequestA(con, "HEAD", "/test_auth_host2", NULL, NULL, NULL, 0, 0); ++ ok(req != NULL, "HttpOpenRequestA failed %u\n", GetLastError()); ++ ++ ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); ++ ok(ret, "HttpAddRequestHeaders failed\n"); ++ ++ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); ++ ok(ret, "HttpSendRequestA failed %u\n", GetLastError()); ++ ++ test_status_code(req, 200); ++ ++ InternetCloseHandle(req); ++ InternetCloseHandle(con); ++ InternetCloseHandle(ses); ++ ++ ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); ++ ok(ses != NULL, "InternetOpenA failed\n"); ++ ++ con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); ++ ok(con != NULL, "InternetConnectA failed %u\n", GetLastError()); ++ ++ req = HttpOpenRequestA(con, "HEAD", "/test_auth_host2", NULL, NULL, NULL, 0, 0); ++ ok(req != NULL, "HttpOpenRequestA failed %u\n", GetLastError()); ++ ++ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); ++ ok(ret, "HttpSendRequestA failed %u\n", GetLastError()); ++ ++ test_status_code(req, 200); ++ ++ InternetCloseHandle(req); ++ InternetCloseHandle(con); ++ InternetCloseHandle(ses); + } + + static void test_connection_closing(int port)
3 years, 10 months
1
0
0
0
[reactos] 33/39: [WINESYNC] wininet/tests: Add more tests for cookies.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=45c19ac584a4cb0a232e1…
commit 45c19ac584a4cb0a232e16e9f68edcc8c4ca8888 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Tue Dec 8 18:22:03 2020 +0100 Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com> CommitDate: Tue Jan 5 11:03:13 2021 +0100 [WINESYNC] wininet/tests: Add more tests for cookies. wine-staging patch by Michael Müller <michael(a)fds-team.de> --- modules/rostests/winetests/wininet/http.c | 92 +++++++++++++- ...-wininet_tests__Add_more_tests_for_cookies.diff | 133 +++++++++++++++++++++ 2 files changed, 222 insertions(+), 3 deletions(-) diff --git a/modules/rostests/winetests/wininet/http.c b/modules/rostests/winetests/wininet/http.c index 882f293b856..c7cdea84ce3 100644 --- a/modules/rostests/winetests/wininet/http.c +++ b/modules/rostests/winetests/wininet/http.c @@ -2130,6 +2130,14 @@ static const char largemsg[] = "Content-Length: %I64u\r\n" "\r\n"; +static const char okmsg_cookie_path[] = +"HTTP/1.1 200 OK\r\n" +"Date: Mon, 01 Dec 2008 13:44:34 GMT\r\n" +"Server: winetest\r\n" +"Content-Length: 0\r\n" +"Set-Cookie: subcookie2=data; path=/test_cookie_set_path\r\n" +"\r\n"; + static const char notokmsg[] = "HTTP/1.1 400 Bad Request\r\n" "Server: winetest\r\n" @@ -2509,6 +2517,32 @@ static DWORD CALLBACK server_thread(LPVOID param) else send(c, noauthmsg, sizeof noauthmsg-1, 0); } + if (strstr(buffer, "/test_cookie_path1")) + { + if (strstr(buffer, "subcookie=data")) + send(c, okmsg, sizeof okmsg-1, 0); + else + send(c, notokmsg, sizeof notokmsg-1, 0); + } + if (strstr(buffer, "/test_cookie_path2")) + { + if (strstr(buffer, "subcookie2=data")) + send(c, okmsg, sizeof okmsg-1, 0); + else + send(c, notokmsg, sizeof notokmsg-1, 0); + } + if (strstr(buffer, "/test_cookie_set_path")) + { + send(c, okmsg_cookie_path, sizeof okmsg_cookie_path-1, 0); + } + if (strstr(buffer, "/test_cookie_merge")) + { + if (strstr(buffer, "subcookie=data") && + !strstr(buffer, "manual_cookie=test")) + send(c, okmsg, sizeof okmsg-1, 0); + else + send(c, notokmsg, sizeof notokmsg-1, 0); + } if (strstr(buffer, "/test_host_override")) { if (strstr(buffer, host_header_override)) @@ -3887,7 +3921,7 @@ static void test_cookie_header(int port) HINTERNET ses, con, req; DWORD size, error; BOOL ret; - char buffer[64]; + char buffer[256]; ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); ok(ses != NULL, "InternetOpen failed\n"); @@ -3915,7 +3949,7 @@ static void test_cookie_header(int port) size = sizeof(buffer); ret = HttpQueryInfoA(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL); ok(ret, "HttpQueryInfo failed: %u\n", GetLastError()); - ok(!strcmp(buffer, "cookie=not biscuit"), "got '%s' expected \'cookie=not biscuit\'\n", buffer); + ok(!!strstr(buffer, "cookie=not biscuit"), "got '%s' expected \'cookie=not biscuit\'\n", buffer); ret = HttpSendRequestA(req, NULL, 0, NULL, 0); ok(ret, "HttpSendRequest failed: %u\n", GetLastError()); @@ -3926,9 +3960,61 @@ static void test_cookie_header(int port) size = sizeof(buffer); ret = HttpQueryInfoA(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL); ok(ret, "HttpQueryInfo failed: %u\n", GetLastError()); - ok(!strcmp(buffer, "cookie=biscuit"), "got '%s' expected \'cookie=biscuit\'\n", buffer); + ok(!strstr(buffer, "cookie=not biscuit"), "'%s' should not contain \'cookie=not biscuit\'\n", buffer); + ok(!!strstr(buffer, "cookie=biscuit"), "'%s' should contain \'cookie=biscuit\'\n", buffer); + + InternetCloseHandle(req); + + InternetSetCookieA("
http://localhost/testCCCC
", "subcookie", "data"); + + req = HttpOpenRequestA(con, NULL, "/test_cookie_path1", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); + ok(req != NULL, "HttpOpenRequest failed\n"); + + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed\n"); + + test_status_code(req, 200); + InternetCloseHandle(req); + + req = HttpOpenRequestA(con, NULL, "/test_cookie_path1/abc", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); + ok(req != NULL, "HttpOpenRequest failed\n"); + + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed\n"); + + test_status_code(req, 200); + InternetCloseHandle(req); + + req = HttpOpenRequestA(con, NULL, "/test_cookie_set_path", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); + ok(req != NULL, "HttpOpenRequest failed\n"); + + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed\n"); + + test_status_code(req, 200); + InternetCloseHandle(req); + + req = HttpOpenRequestA(con, NULL, "/test_cookie_path2", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); + ok(req != NULL, "HttpOpenRequest failed\n"); + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed\n"); + + test_status_code(req, 400); InternetCloseHandle(req); + + req = HttpOpenRequestA(con, NULL, "/test_cookie_merge", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); + ok(req != NULL, "HttpOpenRequest failed\n"); + + ret = HttpAddRequestHeadersA(req, "Cookie: manual_cookie=test\r\n", ~0u, HTTP_ADDREQ_FLAG_ADD); + ok(ret, "HttpAddRequestHeaders failed: %u\n", GetLastError()); + + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed\n"); + + test_status_code(req, 200); + InternetCloseHandle(req); + InternetCloseHandle(con); InternetCloseHandle(ses); } diff --git a/sdk/tools/winesync/wininet_staging/0001-wininet_tests__Add_more_tests_for_cookies.diff b/sdk/tools/winesync/wininet_staging/0001-wininet_tests__Add_more_tests_for_cookies.diff new file mode 100644 index 00000000000..ca5ed5a6d44 --- /dev/null +++ b/sdk/tools/winesync/wininet_staging/0001-wininet_tests__Add_more_tests_for_cookies.diff @@ -0,0 +1,133 @@ +diff --git a/modules/rostests/winetests/wininet/http.c b/modules/rostests/winetests/wininet/http.c +index a5f5215..9ef56ce 100644 +--- a/modules/rostests/winetests/wininet/http.c ++++ b/modules/rostests/winetests/wininet/http.c +@@ -2129,6 +2129,14 @@ static const char largemsg[] = + "Content-Length: %I64u\r\n" + "\r\n"; + ++static const char okmsg_cookie_path[] = ++"HTTP/1.1 200 OK\r\n" ++"Date: Mon, 01 Dec 2008 13:44:34 GMT\r\n" ++"Server: winetest\r\n" ++"Content-Length: 0\r\n" ++"Set-Cookie: subcookie2=data; path=/test_cookie_set_path\r\n" ++"\r\n"; ++ + static const char notokmsg[] = + "HTTP/1.1 400 Bad Request\r\n" + "Server: winetest\r\n" +@@ -2508,6 +2516,32 @@ static DWORD CALLBACK server_thread(LPVOID param) + else + send(c, noauthmsg, sizeof noauthmsg-1, 0); + } ++ if (strstr(buffer, "/test_cookie_path1")) ++ { ++ if (strstr(buffer, "subcookie=data")) ++ send(c, okmsg, sizeof okmsg-1, 0); ++ else ++ send(c, notokmsg, sizeof notokmsg-1, 0); ++ } ++ if (strstr(buffer, "/test_cookie_path2")) ++ { ++ if (strstr(buffer, "subcookie2=data")) ++ send(c, okmsg, sizeof okmsg-1, 0); ++ else ++ send(c, notokmsg, sizeof notokmsg-1, 0); ++ } ++ if (strstr(buffer, "/test_cookie_set_path")) ++ { ++ send(c, okmsg_cookie_path, sizeof okmsg_cookie_path-1, 0); ++ } ++ if (strstr(buffer, "/test_cookie_merge")) ++ { ++ if (strstr(buffer, "subcookie=data") && ++ !strstr(buffer, "manual_cookie=test")) ++ send(c, okmsg, sizeof okmsg-1, 0); ++ else ++ send(c, notokmsg, sizeof notokmsg-1, 0); ++ } + if (strstr(buffer, "/test_host_override")) + { + if (strstr(buffer, host_header_override)) +@@ -3886,7 +3920,7 @@ static void test_cookie_header(int port) + HINTERNET ses, con, req; + DWORD size, error; + BOOL ret; +- char buffer[64]; ++ char buffer[256]; + + ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); + ok(ses != NULL, "InternetOpen failed\n"); +@@ -3914,7 +3948,7 @@ static void test_cookie_header(int port) + size = sizeof(buffer); + ret = HttpQueryInfoA(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL); + ok(ret, "HttpQueryInfo failed: %u\n", GetLastError()); +- ok(!strcmp(buffer, "cookie=not biscuit"), "got '%s' expected \'cookie=not biscuit\'\n", buffer); ++ ok(!!strstr(buffer, "cookie=not biscuit"), "got '%s' expected \'cookie=not biscuit\'\n", buffer); + + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed: %u\n", GetLastError()); +@@ -3925,9 +3959,61 @@ static void test_cookie_header(int port) + size = sizeof(buffer); + ret = HttpQueryInfoA(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL); + ok(ret, "HttpQueryInfo failed: %u\n", GetLastError()); +- ok(!strcmp(buffer, "cookie=biscuit"), "got '%s' expected \'cookie=biscuit\'\n", buffer); ++ ok(!strstr(buffer, "cookie=not biscuit"), "'%s' should not contain \'cookie=not biscuit\'\n", buffer); ++ ok(!!strstr(buffer, "cookie=biscuit"), "'%s' should contain \'cookie=biscuit\'\n", buffer); ++ ++ InternetCloseHandle(req); ++ ++ InternetSetCookieA("
http://localhost/testCCCC
", "subcookie", "data"); ++ ++ req = HttpOpenRequestA(con, NULL, "/test_cookie_path1", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); ++ ok(req != NULL, "HttpOpenRequest failed\n"); ++ ++ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); ++ ok(ret, "HttpSendRequest failed\n"); ++ ++ test_status_code(req, 200); ++ InternetCloseHandle(req); ++ ++ req = HttpOpenRequestA(con, NULL, "/test_cookie_path1/abc", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); ++ ok(req != NULL, "HttpOpenRequest failed\n"); ++ ++ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); ++ ok(ret, "HttpSendRequest failed\n"); ++ ++ test_status_code(req, 200); ++ InternetCloseHandle(req); ++ ++ req = HttpOpenRequestA(con, NULL, "/test_cookie_set_path", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); ++ ok(req != NULL, "HttpOpenRequest failed\n"); ++ ++ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); ++ ok(ret, "HttpSendRequest failed\n"); ++ ++ test_status_code(req, 200); ++ InternetCloseHandle(req); ++ ++ req = HttpOpenRequestA(con, NULL, "/test_cookie_path2", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); ++ ok(req != NULL, "HttpOpenRequest failed\n"); + ++ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); ++ ok(ret, "HttpSendRequest failed\n"); ++ ++ test_status_code(req, 400); + InternetCloseHandle(req); ++ ++ req = HttpOpenRequestA(con, NULL, "/test_cookie_merge", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); ++ ok(req != NULL, "HttpOpenRequest failed\n"); ++ ++ ret = HttpAddRequestHeadersA(req, "Cookie: manual_cookie=test\r\n", ~0u, HTTP_ADDREQ_FLAG_ADD); ++ ok(ret, "HttpAddRequestHeaders failed: %u\n", GetLastError()); ++ ++ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); ++ ok(ret, "HttpSendRequest failed\n"); ++ ++ test_status_code(req, 200); ++ InternetCloseHandle(req); ++ + InternetCloseHandle(con); + InternetCloseHandle(ses); + }
3 years, 10 months
1
0
0
0
[reactos] 32/39: [WINESYNC] wininet: Use wide-char string literals.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e152f78aa30a8f4d32a18…
commit e152f78aa30a8f4d32a18f735e1b05fcff8bf195 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Tue Dec 8 18:22:00 2020 +0100 Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com> CommitDate: Tue Jan 5 11:03:13 2021 +0100 [WINESYNC] wininet: Use wide-char string literals. Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id e88abf0dc4ae7ec6b2fd21130be09dadc478b9fc by Michael Stefaniuc <mstefani(a)winehq.org> --- dll/win32/wininet/cookie.c | 13 +- dll/win32/wininet/dialogs.c | 9 +- dll/win32/wininet/ftp.c | 26 ++-- dll/win32/wininet/http.c | 284 +++++++++++++++-------------------------- dll/win32/wininet/internet.c | 52 +++----- dll/win32/wininet/urlcache.c | 24 +--- sdk/tools/winesync/wininet.cfg | 2 +- 7 files changed, 147 insertions(+), 263 deletions(-) diff --git a/dll/win32/wininet/cookie.c b/dll/win32/wininet/cookie.c index 20de3bf3909..02a69f741aa 100644 --- a/dll/win32/wininet/cookie.c +++ b/dll/win32/wininet/cookie.c @@ -396,8 +396,6 @@ static BOOL load_persistent_cookie(substr_t domain, substr_t path) static BOOL save_persistent_cookie(cookie_container_t *container) { - static const WCHAR txtW[] = {'t','x','t',0}; - WCHAR cookie_file[MAX_PATH]; HANDLE cookie_handle; cookie_t *cookie_container = NULL, *cookie_iter; @@ -428,7 +426,7 @@ static BOOL save_persistent_cookie(cookie_container_t *container) return TRUE; } - if(!CreateUrlCacheEntryW(container->cookie_url, 0, txtW, cookie_file, 0)) + if(!CreateUrlCacheEntryW(container->cookie_url, 0, L"txt", cookie_file, 0)) return FALSE; cookie_handle = CreateFileW(cookie_file, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); @@ -504,13 +502,12 @@ static BOOL save_persistent_cookie(cookie_container_t *container) } memset(&time, 0, sizeof(time)); - return CommitUrlCacheEntryW(container->cookie_url, cookie_file, time, time, 0, NULL, 0, txtW, 0); + return CommitUrlCacheEntryW(container->cookie_url, cookie_file, time, time, 0, NULL, 0, L"txt", 0); } static BOOL cookie_parse_url(const WCHAR *url, substr_t *host, substr_t *path) { URL_COMPONENTSW comp = { sizeof(comp) }; - static const WCHAR rootW[] = {'/',0}; comp.dwHostNameLength = 1; comp.dwUrlPathLength = 1; @@ -523,7 +520,7 @@ static BOOL cookie_parse_url(const WCHAR *url, substr_t *host, substr_t *path) comp.dwUrlPathLength--; *host = substr(comp.lpszHostName, comp.dwHostNameLength); - *path = comp.dwUrlPathLength ? substr(comp.lpszUrlPath, comp.dwUrlPathLength) : substr(rootW, 1); + *path = comp.dwUrlPathLength ? substr(comp.lpszUrlPath, comp.dwUrlPathLength) : substr(L"/", 1); return TRUE; } @@ -537,8 +534,6 @@ typedef struct { static DWORD get_cookie(substr_t host, substr_t path, DWORD flags, cookie_set_t *res) { - static const WCHAR empty_path[] = { '/',0 }; - const WCHAR *p; cookie_domain_t *domain; cookie_container_t *container; @@ -553,7 +548,7 @@ static DWORD get_cookie(substr_t host, substr_t path, DWORD flags, cookie_set_t while(p > host.str && p[-1] != '.') p--; if(p == host.str) break; - load_persistent_cookie(substr(p, host.str+host.len-p), substr(empty_path, 1)); + load_persistent_cookie(substr(p, host.str+host.len-p), substr(L"/", 1)); } p = path.str + path.len; diff --git a/dll/win32/wininet/dialogs.c b/dll/win32/wininet/dialogs.c index f381a66041b..8e06a9ba4bc 100644 --- a/dll/win32/wininet/dialogs.c +++ b/dll/win32/wininet/dialogs.c @@ -63,7 +63,6 @@ static BOOL WININET_GetAuthRealm( HINTERNET hRequest, LPWSTR szBuf, DWORD sz, BO { LPWSTR p, q; DWORD index, query; - static const WCHAR szRealm[] = { 'r','e','a','l','m','=',0 }; if (proxy) query = HTTP_QUERY_PROXY_AUTHENTICATE; @@ -80,7 +79,7 @@ static BOOL WININET_GetAuthRealm( HINTERNET hRequest, LPWSTR szBuf, DWORD sz, BO * dealing with 'Basic' Authentication */ p = wcschr( szBuf, ' ' ); - if( !p || wcsncmp( p+1, szRealm, lstrlenW(szRealm) ) ) + if( !p || wcsncmp( p+1, L"realm=", lstrlenW(L"realm=") ) ) { ERR("response wrong? (%s)\n", debugstr_w(szBuf)); return FALSE; @@ -116,15 +115,13 @@ static BOOL WININET_GetSetPassword( HWND hdlg, LPCWSTR szServer, DWORD r, dwMagic = 19; UINT r_len, u_len; WORD sz; - static const WCHAR szColon[] = { ':',0 }; - static const WCHAR szbs[] = { '/', 0 }; hUserItem = GetDlgItem( hdlg, IDC_USERNAME ); hPassItem = GetDlgItem( hdlg, IDC_PASSWORD ); /* now try fetch the username and password */ lstrcpyW( szResource, szServer); - lstrcatW( szResource, szbs); + lstrcatW( szResource, L"/"); lstrcatW( szResource, szRealm); /* @@ -137,7 +134,7 @@ static BOOL WININET_GetSetPassword( HWND hdlg, LPCWSTR szServer, { szUserPass[0] = 0; GetWindowTextW( hUserItem, szUserPass, ARRAY_SIZE( szUserPass ) - 1 ); - lstrcatW(szUserPass, szColon); + lstrcatW(szUserPass, L":"); u_len = lstrlenW( szUserPass ); GetWindowTextW( hPassItem, szUserPass+u_len, ARRAY_SIZE( szUserPass ) - u_len ); diff --git a/dll/win32/wininet/ftp.c b/dll/win32/wininet/ftp.c index 979b21f8b8d..dfb2797df30 100644 --- a/dll/win32/wininet/ftp.c +++ b/dll/win32/wininet/ftp.c @@ -163,7 +163,6 @@ static const CHAR *const szFtpCommands[] = { }; static const CHAR szMonths[] = "JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC"; -static const WCHAR szNoAccount[] = {'n','o','a','c','c','o','u','n','t','\0'}; static BOOL FTP_SendCommand(INT nSocket, FTP_COMMAND ftpCmd, LPCWSTR lpszParam, INTERNET_STATUS_CALLBACK lpfnStatusCB, object_header_t *hdr, DWORD_PTR dwContext); @@ -2431,14 +2430,6 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, LPCWSTR lpszPassword, DWORD dwFlags, DWORD_PTR dwContext, DWORD dwInternalFlags) { - static const WCHAR szKey[] = {'S','o','f','t','w','a','r','e','\\', - 'M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\', - 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s',0}; - static const WCHAR szValue[] = {'E','m','a','i','l','N','a','m','e',0}; - static const WCHAR szDefaultUsername[] = {'a','n','o','n','y','m','o','u','s','\0'}; - static const WCHAR szEmpty[] = {'\0'}; struct sockaddr_in socketAddr; INT nsocket = -1; socklen_t sock_namelen; @@ -2494,14 +2485,14 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, WCHAR szPassword[MAX_PATH]; DWORD len = sizeof(szPassword); - lpwfs->lpszUserName = heap_strdupW(szDefaultUsername); + lpwfs->lpszUserName = heap_strdupW(L"anonymous"); - RegOpenKeyW(HKEY_CURRENT_USER, szKey, &key); - if (RegQueryValueExW(key, szValue, NULL, NULL, (LPBYTE)szPassword, &len)) { + RegOpenKeyW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", &key); + if (RegQueryValueExW(key, L"EmailName", NULL, NULL, (LPBYTE)szPassword, &len)) { /* Nothing in the registry, get the username and use that as the password */ if (!GetUserNameW(szPassword, &len)) { /* Should never get here, but use an empty password as failsafe */ - lstrcpyW(szPassword, szEmpty); + lstrcpyW(szPassword, L""); } } RegCloseKey(key); @@ -2511,7 +2502,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, } else { lpwfs->lpszUserName = heap_strdupW(lpszUserName); - lpwfs->lpszPassword = heap_strdupW(lpszPassword ? lpszPassword : szEmpty); + lpwfs->lpszPassword = heap_strdupW(lpszPassword ? lpszPassword : L""); } lpwfs->servername = heap_strdupW(lpszServerName); @@ -2881,7 +2872,7 @@ static BOOL FTP_SendAccount(ftp_session_t *lpwfs) BOOL bSuccess = FALSE; TRACE("\n"); - if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_ACCT, szNoAccount, 0, 0, 0)) + if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_ACCT, L"noaccount", 0, 0, 0)) goto lend; nResCode = FTP_ReceiveResponse(lpwfs, lpwfs->hdr.dwContext); @@ -3015,7 +3006,7 @@ lend: static BOOL FTP_SendType(ftp_session_t *lpwfs, DWORD dwType) { INT nResCode; - WCHAR type[] = { 'I','\0' }; + WCHAR type[] = L"I"; BOOL bSuccess = FALSE; TRACE("\n"); @@ -3096,13 +3087,12 @@ lend: */ static BOOL FTP_SendPort(ftp_session_t *lpwfs) { - static const WCHAR szIPFormat[] = {'%','d',',','%','d',',','%','d',',','%','d',',','%','d',',','%','d','\0'}; INT nResCode; WCHAR szIPAddress[64]; BOOL bSuccess = FALSE; TRACE("\n"); - swprintf(szIPAddress, ARRAY_SIZE(szIPAddress), szIPFormat, + swprintf(szIPAddress, ARRAY_SIZE(szIPAddress), L"%d,%d,%d,%d,%d,%d", lpwfs->lstnSocketAddress.sin_addr.S_un.S_addr&0x000000FF, (lpwfs->lstnSocketAddress.sin_addr.S_un.S_addr&0x0000FF00)>>8, (lpwfs->lstnSocketAddress.sin_addr.S_un.S_addr&0x00FF0000)>>16, diff --git a/dll/win32/wininet/http.c b/dll/win32/wininet/http.c index 7e2de88783e..73c5a61dae4 100644 --- a/dll/win32/wininet/http.c +++ b/dll/win32/wininet/http.c @@ -64,35 +64,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(wininet); -static const WCHAR g_szHttp1_0[] = {'H','T','T','P','/','1','.','0',0}; -static const WCHAR g_szHttp1_1[] = {'H','T','T','P','/','1','.','1',0}; -static const WCHAR szOK[] = {'O','K',0}; -static const WCHAR hostW[] = { 'H','o','s','t',0 }; -static const WCHAR szAuthorization[] = { 'A','u','t','h','o','r','i','z','a','t','i','o','n',0 }; -static const WCHAR szProxy_Authorization[] = { 'P','r','o','x','y','-','A','u','t','h','o','r','i','z','a','t','i','o','n',0 }; -static const WCHAR szStatus[] = { 'S','t','a','t','u','s',0 }; -static const WCHAR szKeepAlive[] = {'K','e','e','p','-','A','l','i','v','e',0}; -static const WCHAR szGET[] = { 'G','E','T', 0 }; -static const WCHAR szHEAD[] = { 'H','E','A','D', 0 }; - -static const WCHAR szAccept[] = { 'A','c','c','e','p','t',0 }; -static const WCHAR szCache_Control[] = { 'C','a','c','h','e','-','C','o','n','t','r','o','l',0 }; -static const WCHAR szConnection[] = { 'C','o','n','n','e','c','t','i','o','n',0 }; -static const WCHAR szContent_Encoding[] = { 'C','o','n','t','e','n','t','-','E','n','c','o','d','i','n','g',0 }; -static const WCHAR szContent_Length[] = { 'C','o','n','t','e','n','t','-','L','e','n','g','t','h',0 }; -static const WCHAR szContent_Type[] = { 'C','o','n','t','e','n','t','-','T','y','p','e',0 }; -static const WCHAR szExpires[] = { 'E','x','p','i','r','e','s',0 }; -static const WCHAR szLast_Modified[] = { 'L','a','s','t','-','M','o','d','i','f','i','e','d',0 }; -static const WCHAR szProxy_Connection[] = { 'P','r','o','x','y','-','C','o','n','n','e','c','t','i','o','n',0 }; -static const WCHAR szReferer[] = { 'R','e','f','e','r','e','r',0 }; -static const WCHAR szSet_Cookie[] = { 'S','e','t','-','C','o','o','k','i','e',0 }; - -static const WCHAR emptyW[] = {0}; - -#define HTTP_REFERER szReferer -#define HTTP_ACCEPT szAccept -#define HTTP_USERAGENT szUser_Agent - #define HTTP_ADDHDR_FLAG_ADD 0x20000000 #define HTTP_ADDHDR_FLAG_ADD_IF_NEW 0x10000000 #define HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA 0x40000000 @@ -206,17 +177,13 @@ static BOOL process_host_port(server_t *server) size_t name_len, len; WCHAR *buf; - static const WCHAR httpW[] = {'h','t','t','p',0}; - static const WCHAR httpsW[] = {'h','t','t','p','s',0}; - static const WCHAR formatW[] = {'%','s',':','/','/','%','s',':','%','u',0}; - name_len = lstrlenW(server->name); - len = name_len + 10 /* strlen("://:<port>") */ + ARRAY_SIZE(httpsW); + len = name_len + 10 /* strlen("://:<port>") */ + ARRAY_SIZE(L"https"); buf = heap_alloc( len * sizeof(WCHAR) ); if(!buf) return FALSE; - swprintf(buf, len, formatW, server->is_https ? httpsW : httpW, server->name, server->port); + swprintf(buf, len, L"%s://%s:%u", server->is_https ? L"https" : L"http", server->name, server->port); server->scheme_host_port = buf; server->host_port = server->scheme_host_port + 7 /* strlen("http://") */; @@ -340,7 +307,7 @@ static WCHAR *get_host_header( http_request_t *req ) WCHAR *ret = NULL; EnterCriticalSection( &req->headers_section ); - if ((header = HTTP_GetHeader( req, hostW ))) ret = heap_strdupW( header->lpszValue ); + if ((header = HTTP_GetHeader( req, L"Host" ))) ret = heap_strdupW( header->lpszValue ); else ret = heap_strdupW( req->server->canon_host_port ); LeaveCriticalSection( &req->headers_section ); return ret; @@ -528,7 +495,7 @@ static DWORD init_gzip_stream(http_request_t *req, BOOL is_gzip) return ERROR_OUTOFMEMORY; } - remove_header(req, szContent_Length, FALSE); + remove_header(req, L"Content-Length", FALSE); if(req->read_size) { memcpy(gzip_stream->buf, req->read_buf+req->read_pos, req->read_size); @@ -556,12 +523,9 @@ static void HTTP_FreeTokens(LPWSTR * token_array) static void HTTP_FixURL(http_request_t *request) { - static const WCHAR szSlash[] = { '/',0 }; - static const WCHAR szHttp[] = { 'h','t','t','p',':','/','/', 0 }; - /* If we don't have a path we set it to root */ if (NULL == request->path) - request->path = heap_strdupW(szSlash); + request->path = heap_strdupW(L"/"); else /* remove \r and \n*/ { int nLen = lstrlenW(request->path); @@ -578,7 +542,7 @@ static void HTTP_FixURL(http_request_t *request) } if(CSTR_EQUAL != CompareStringW( LOCALE_INVARIANT, NORM_IGNORECASE, - request->path, lstrlenW(request->path), szHttp, lstrlenW(szHttp) ) + request->path, lstrlenW(request->path), L"http://", lstrlenW(L"http://") ) && request->path[0] != '/') /* not an absolute path ?? --> fix it !! */ { WCHAR *fixurl = heap_alloc((lstrlenW(request->path) + 2)*sizeof(WCHAR)); @@ -592,10 +556,6 @@ static void HTTP_FixURL(http_request_t *request) static WCHAR* build_request_header(http_request_t *request, const WCHAR *verb, const WCHAR *path, const WCHAR *version, BOOL use_cr) { - static const WCHAR szSpace[] = {' ',0}; - static const WCHAR szColon[] = {':',' ',0}; - static const WCHAR szCr[] = {'\r',0}; - static const WCHAR szLf[] = {'\n',0}; LPWSTR requestString; DWORD len, n; LPCWSTR *req; @@ -614,13 +574,13 @@ static WCHAR* build_request_header(http_request_t *request, const WCHAR *verb, /* add the verb, path and HTTP version string */ n = 0; req[n++] = verb; - req[n++] = szSpace; + req[n++] = L" "; req[n++] = path; - req[n++] = szSpace; + req[n++] = L" "; req[n++] = version; if (use_cr) - req[n++] = szCr; - req[n++] = szLf; + req[n++] = L"\r"; + req[n++] = L"\n"; /* Append custom request headers */ for (i = 0; i < request->nCustHeaders; i++) @@ -628,11 +588,11 @@ static WCHAR* build_request_header(http_request_t *request, const WCHAR *verb, if (request->custHeaders[i].wFlags & HDR_ISREQUEST) { req[n++] = request->custHeaders[i].lpszField; - req[n++] = szColon; + req[n++] = L": "; req[n++] = request->custHeaders[i].lpszValue; if (use_cr) - req[n++] = szCr; - req[n++] = szLf; + req[n++] = L"\r"; + req[n++] = L"\n"; TRACE("Adding custom header %s (%s)\n", debugstr_w(request->custHeaders[i].lpszField), @@ -640,8 +600,8 @@ static WCHAR* build_request_header(http_request_t *request, const WCHAR *verb, } } if (use_cr) - req[n++] = szCr; - req[n++] = szLf; + req[n++] = L"\r"; + req[n++] = L"\n"; req[n] = NULL; requestString = HTTP_build_req( req, 4 ); @@ -652,10 +612,6 @@ static WCHAR* build_request_header(http_request_t *request, const WCHAR *verb, static WCHAR* build_response_header(http_request_t *request, BOOL use_cr) { - static const WCHAR colonW[] = { ':',' ',0 }; - static const WCHAR crW[] = { '\r',0 }; - static const WCHAR lfW[] = { '\n',0 }; - static const WCHAR status_fmt[] = { ' ','%','u',' ',0 }; const WCHAR **req; WCHAR *ret, buf[14]; DWORD i, n = 0; @@ -671,25 +627,25 @@ static WCHAR* build_response_header(http_request_t *request, BOOL use_cr) if (request->status_code) { req[n++] = request->version; - swprintf(buf, ARRAY_SIZE(buf), status_fmt, request->status_code); + swprintf(buf, ARRAY_SIZE(buf), L" %u ", request->status_code); req[n++] = buf; req[n++] = request->statusText; if (use_cr) - req[n++] = crW; - req[n++] = lfW; + req[n++] = L"\r"; + req[n++] = L"\n"; } for(i = 0; i < request->nCustHeaders; i++) { if(!(request->custHeaders[i].wFlags & HDR_ISREQUEST) - && wcscmp(request->custHeaders[i].lpszField, szStatus)) + && wcscmp(request->custHeaders[i].lpszField, L"Status")) { req[n++] = request->custHeaders[i].lpszField; - req[n++] = colonW; + req[n++] = L": "; req[n++] = request->custHeaders[i].lpszValue; if(use_cr) - req[n++] = crW; - req[n++] = lfW; + req[n++] = L"\r"; + req[n++] = L"\n"; TRACE("Adding custom header %s (%s)\n", debugstr_w(request->custHeaders[i].lpszField), @@ -697,8 +653,8 @@ static WCHAR* build_response_header(http_request_t *request, BOOL use_cr) } } if(use_cr) - req[n++] = crW; - req[n++] = lfW; + req[n++] = L"\r"; + req[n++] = L"\n"; req[n] = NULL; ret = HTTP_build_req(req, 0); @@ -718,7 +674,7 @@ static void HTTP_ProcessCookies( http_request_t *request ) EnterCriticalSection( &request->headers_section ); - while((HeaderIndex = HTTP_GetCustomHeaderIndex(request, szSet_Cookie, numCookies++, FALSE)) != -1) + while((HeaderIndex = HTTP_GetCustomHeaderIndex(request, L"Set-Cookie", numCookies++, FALSE)) != -1) { const WCHAR *data; substr_t name; @@ -1037,8 +993,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue, if (is_basic_auth_value(pszAuthValue,NULL)) { - static const WCHAR szBasic[] = {'B','a','s','i','c',0}; - pAuthInfo->scheme = heap_strdupW(szBasic); + pAuthInfo->scheme = heap_strdupW(L"Basic"); if (!pAuthInfo->scheme) { heap_free(pAuthInfo); @@ -1629,7 +1584,6 @@ static WCHAR *encode_auth_data( const WCHAR *scheme, const char *data, UINT data */ static BOOL HTTP_InsertAuthorization( http_request_t *request, struct HttpAuthInfo *pAuthInfo, LPCWSTR header ) { - static const WCHAR wszBasic[] = {'B','a','s','i','c',0}; WCHAR *host, *authorization = NULL; if (pAuthInfo) @@ -1642,7 +1596,7 @@ static BOOL HTTP_InsertAuthorization( http_request_t *request, struct HttpAuthIn /* clear the data as it isn't valid now that it has been sent to the * server, unless it's Basic authentication which doesn't do * connection tracking */ - if (wcsicmp(pAuthInfo->scheme, wszBasic)) + if (wcsicmp(pAuthInfo->scheme, L"Basic")) { heap_free(pAuthInfo->auth_data); pAuthInfo->auth_data = NULL; @@ -1662,7 +1616,7 @@ static BOOL HTTP_InsertAuthorization( http_request_t *request, struct HttpAuthIn char *data; /* Don't use cached credentials when a username or Authorization was specified */ - if ((request->session->userName && request->session->userName[0]) || wcscmp(header, szAuthorization)) + if ((request->session->userName && request->session->userName[0]) || wcscmp(header, L"Authorization")) return TRUE; if (!(host = get_host_header(request))) @@ -1672,7 +1626,7 @@ static BOOL HTTP_InsertAuthorization( http_request_t *request, struct HttpAuthIn { TRACE("Found cached basic authorization for %s\n", debugstr_w(host)); - if (!(authorization = encode_auth_data(wszBasic, data, data_len))) + if (!(authorization = encode_auth_data(L"Basic", data, data_len))) { heap_free(data); heap_free(host); @@ -1716,11 +1670,10 @@ static WCHAR *build_proxy_path_url(http_request_t *req) static BOOL HTTP_DomainMatches(LPCWSTR server, substr_t domain) { - static const WCHAR localW[] = { '<','l','o','c','a','l','>',0 }; const WCHAR *dot, *ptr; int len; - if(domain.len == ARRAY_SIZE(localW)-1 && !wcsnicmp(domain.str, localW, domain.len) && !wcschr(server, '.' )) + if(domain.len == ARRAY_SIZE(L"<local>")-1 && !wcsnicmp(domain.str, L"<local>", domain.len) && !wcschr(server, '.' )) return TRUE; if(domain.len && *domain.str != '*') @@ -1785,24 +1738,22 @@ static BOOL HTTP_ShouldBypassProxy(appinfo_t *lpwai, LPCWSTR server) */ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_request_t *request) { - static const WCHAR protoHttp[] = { 'h','t','t','p',0 }; - static const WCHAR szHttp[] = { 'h','t','t','p',':','/','/',0 }; - static WCHAR szNul[] = { 0 }; + static WCHAR szNul[] = L""; URL_COMPONENTSW UrlComponents = { sizeof(UrlComponents) }; server_t *new_server = NULL; WCHAR *proxy; - proxy = INTERNET_FindProxyForProtocol(hIC->proxy, protoHttp); + proxy = INTERNET_FindProxyForProtocol(hIC->proxy, L"http"); if(!proxy) return FALSE; if(CSTR_EQUAL != CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, - proxy, lstrlenW(szHttp), szHttp, lstrlenW(szHttp))) { - WCHAR *proxy_url = heap_alloc(lstrlenW(proxy)*sizeof(WCHAR) + sizeof(szHttp)); + proxy, lstrlenW(L"http://"), L"http://", lstrlenW(L"http://"))) { + WCHAR *proxy_url = heap_alloc(lstrlenW(proxy)*sizeof(WCHAR) + sizeof(L"http://")); if(!proxy_url) { heap_free(proxy); return FALSE; } - lstrcpyW(proxy_url, szHttp); + lstrcpyW(proxy_url, L"http://"); lstrcatW(proxy_url, proxy); heap_free(proxy); proxy = proxy_url; @@ -1854,8 +1805,6 @@ static DWORD HTTP_ResolveName(http_request_t *request) static WCHAR *compose_request_url(http_request_t *req) { - static const WCHAR http[] = { 'h','t','t','p',':','/','/',0 }; - static const WCHAR https[] = { 'h','t','t','p','s',':','/','/',0 }; const WCHAR *host, *scheme; WCHAR *buf, *ptr; size_t len; @@ -1863,9 +1812,9 @@ static WCHAR *compose_request_url(http_request_t *req) host = req->server->canon_host_port; if (req->server->is_https) - scheme = https; + scheme = L"https://"; else - scheme = http; + scheme = L"http://"; len = lstrlenW(scheme) + lstrlenW(host) + (req->path[0] != '/' ? 1 : 0) + lstrlenW(req->path); ptr = buf = heap_alloc((len+1) * sizeof(WCHAR)); @@ -2000,7 +1949,7 @@ static BOOL HTTP_KeepAlive(http_request_t *request) /* as per RFC 2068, S8.1.2.1, if the client is HTTP/1.1 then assume that * the connection is keep-alive by default */ if (HTTP_HttpQueryInfoW(request, HTTP_QUERY_VERSION, szVersion, &dwBufferSize, NULL) == ERROR_SUCCESS - && !wcsicmp(szVersion, g_szHttp1_1)) + && !wcsicmp(szVersion, L"HTTP/1.1")) { keepalive = TRUE; } @@ -2009,7 +1958,7 @@ static BOOL HTTP_KeepAlive(http_request_t *request) if (HTTP_HttpQueryInfoW(request, HTTP_QUERY_PROXY_CONNECTION, szConnectionResponse, &dwBufferSize, NULL) == ERROR_SUCCESS || HTTP_HttpQueryInfoW(request, HTTP_QUERY_CONNECTION, szConnectionResponse, &dwBufferSize, NULL) == ERROR_SUCCESS) { - keepalive = !wcsicmp(szConnectionResponse, szKeepAlive); + keepalive = !wcsicmp(szConnectionResponse, L"Keep-Alive"); } return keepalive; @@ -2490,9 +2439,6 @@ static void commit_cache_entry(http_request_t *req) static void create_cache_entry(http_request_t *req) { - static const WCHAR no_cacheW[] = {'n','o','-','c','a','c','h','e',0}; - static const WCHAR no_storeW[] = {'n','o','-','s','t','o','r','e',0}; - WCHAR file_name[MAX_PATH+1]; WCHAR *url; BOOL b = TRUE; @@ -2515,7 +2461,7 @@ static void create_cache_entry(http_request_t *req) EnterCriticalSection( &req->headers_section ); - header_idx = HTTP_GetCustomHeaderIndex(req, szCache_Control, 0, FALSE); + header_idx = HTTP_GetCustomHeaderIndex(req, L"Cache-Control", 0, FALSE); if(header_idx != -1) { WCHAR *ptr; @@ -2529,8 +2475,8 @@ static void create_cache_entry(http_request_t *req) if(!end) end = ptr + lstrlenW(ptr); - if(!wcsnicmp(ptr, no_cacheW, ARRAY_SIZE(no_cacheW)-1) - || !wcsnicmp(ptr, no_storeW, ARRAY_SIZE(no_storeW)-1)) { + if(!wcsnicmp(ptr, L"no-cache", ARRAY_SIZE(L"no-cache")-1) + || !wcsnicmp(ptr, L"no-store", ARRAY_SIZE(L"no-store")-1)) { b = FALSE; break; } @@ -2987,13 +2933,11 @@ static const data_stream_vtbl_t chunked_stream_vtbl = { /* set the request content length based on the headers */ static DWORD set_content_length(http_request_t *request) { - static const WCHAR szChunked[] = {'c','h','u','n','k','e','d',0}; - static const WCHAR headW[] = {'H','E','A','D',0}; WCHAR contentLength[32]; WCHAR encoding[20]; DWORD size; - if(request->status_code == HTTP_STATUS_NO_CONTENT || !wcscmp(request->verb, headW)) { + if(request->status_code == HTTP_STATUS_NO_CONTENT || !wcscmp(request->verb, L"HEAD")) { request->contentLength = request->netconn_stream.content_length = 0; return ERROR_SUCCESS; } @@ -3010,7 +2954,7 @@ static DWORD set_content_length(http_request_t *request) size = sizeof(encoding); if (HTTP_HttpQueryInfoW(request, HTTP_QUERY_TRANSFER_ENCODING, encoding, &size, NULL) == ERROR_SUCCESS && - !wcsicmp(encoding, szChunked)) + !wcsicmp(encoding, L"chunked")) { chunked_stream_t *chunked_stream; @@ -3036,19 +2980,16 @@ static DWORD set_content_length(http_request_t *request) if(request->hdr.decoding) { int encoding_idx; - static const WCHAR deflateW[] = {'d','e','f','l','a','t','e',0}; - static const WCHAR gzipW[] = {'g','z','i','p',0}; - EnterCriticalSection( &request->headers_section ); - encoding_idx = HTTP_GetCustomHeaderIndex(request, szContent_Encoding, 0, FALSE); + encoding_idx = HTTP_GetCustomHeaderIndex(request, L"Content-Encoding", 0, FALSE); if(encoding_idx != -1) { - if(!wcsicmp(request->custHeaders[encoding_idx].lpszValue, gzipW)) { + if(!wcsicmp(request->custHeaders[encoding_idx].lpszValue, L"gzip")) { HTTP_DeleteCustomHeader(request, encoding_idx); LeaveCriticalSection( &request->headers_section ); return init_gzip_stream(request, TRUE); } - if(!wcsicmp(request->custHeaders[encoding_idx].lpszValue, deflateW)) { + if(!wcsicmp(request->custHeaders[encoding_idx].lpszValue, L"deflate")) { HTTP_DeleteCustomHeader(request, encoding_idx); LeaveCriticalSection( &request->headers_section ); return init_gzip_stream(request, FALSE); @@ -3147,7 +3088,7 @@ static DWORD drain_content(http_request_t *req, BOOL blocking) if(!is_valid_netconn(req->netconn)) return ERROR_NO_DATA; - if(!wcscmp(req->verb, szHEAD)) + if(!wcscmp(req->verb, L"HEAD")) return ERROR_SUCCESS; EnterCriticalSection( &req->read_section ); @@ -3471,13 +3412,11 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session, lstrcpyW(request->path,lpszObjectName); } }else { - static const WCHAR slashW[] = {'/',0}; - - request->path = heap_strdupW(slashW); + request->path = heap_strdupW(L"/"); } if (lpszReferrer && *lpszReferrer) - HTTP_ProcessHeader(request, HTTP_REFERER, lpszReferrer, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDHDR_FLAG_REQ); + HTTP_ProcessHeader(request, L"Referer", lpszReferrer, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDHDR_FLAG_REQ); if (lpszAcceptTypes) { @@ -3485,15 +3424,15 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session, for (i = 0; lpszAcceptTypes[i]; i++) { if (!*lpszAcceptTypes[i]) continue; - HTTP_ProcessHeader(request, HTTP_ACCEPT, lpszAcceptTypes[i], + HTTP_ProcessHeader(request, L"Accept", lpszAcceptTypes[i], HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA | HTTP_ADDHDR_FLAG_REQ | (i == 0 ? (HTTP_ADDHDR_FLAG_REPLACE | HTTP_ADDHDR_FLAG_ADD) : 0)); } } - request->verb = heap_strdupW(lpszVerb && *lpszVerb ? lpszVerb : szGET); - request->version = heap_strdupW(lpszVersion && *lpszVersion ? lpszVersion : g_szHttp1_1); + request->verb = heap_strdupW(lpszVerb && *lpszVerb ? lpszVerb : L"GET"); + request->version = heap_strdupW(lpszVersion && *lpszVersion ? lpszVersion : L"HTTP/1.1"); if (hIC->proxy && hIC->proxy[0] && !HTTP_ShouldBypassProxy(hIC, session->hostName)) HTTP_DealWithProxy( hIC, session, request ); @@ -3806,9 +3745,8 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel, }else { WCHAR buf[12]; DWORD size; - static const WCHAR formatW[] = {'%','u',0}; - size = swprintf(buf, ARRAY_SIZE(buf), formatW, request->status_code) * sizeof(WCHAR); + size = swprintf(buf, ARRAY_SIZE(buf), L"%u", request->status_code) * sizeof(WCHAR); if(size <= *lpdwBufferLength) { memcpy(lpBuffer, buf, size+sizeof(WCHAR)); @@ -4128,8 +4066,8 @@ BOOL WINAPI HttpQueryInfoA(HINTERNET hHttpRequest, DWORD dwInfoLevel, static WCHAR *get_redirect_url(http_request_t *request) { - static WCHAR szHttp[] = {'h','t','t','p',0}; - static WCHAR szHttps[] = {'h','t','t','p','s',0}; + static WCHAR szHttp[] = L"http"; + static WCHAR szHttps[] = L"https"; http_session_t *session = request->session; URL_COMPONENTSW urlComponents = { sizeof(urlComponents) }; WCHAR *orig_url = NULL, *redirect_url = NULL, *combined_url = NULL; @@ -4266,9 +4204,11 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, WCHAR *url) } if (custom_port) - HTTP_ProcessHeader(request, hostW, request->server->host_port, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDHDR_FLAG_REQ); + HTTP_ProcessHeader(request, L"Host", request->server->host_port, + HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDHDR_FLAG_REQ); else - HTTP_ProcessHeader(request, hostW, request->server->name, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDHDR_FLAG_REQ); + HTTP_ProcessHeader(request, L"Host", request->server->name, + HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDHDR_FLAG_REQ); } heap_free(request->path); @@ -4277,11 +4217,11 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, WCHAR *url) { DWORD needed = 1; HRESULT rc; - WCHAR dummy = 0; + WCHAR dummy[] = L""; WCHAR *path; path = heap_strndupW(urlComponents.lpszUrlPath, urlComponents.dwUrlPathLength); - rc = UrlEscapeW(path, &dummy, &needed, URL_ESCAPE_SPACES_ONLY); + rc = UrlEscapeW(path, dummy, &needed, URL_ESCAPE_SPACES_ONLY); if (rc != E_POINTER) ERR("Unable to escape string!(%s) (%d)\n",debugstr_w(path),rc); request->path = heap_alloc(needed*sizeof(WCHAR)); @@ -4296,8 +4236,8 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, WCHAR *url) } /* Remove custom content-type/length headers on redirects. */ - remove_header(request, szContent_Type, TRUE); - remove_header(request, szContent_Length, TRUE); + remove_header(request, L"Content-Type", TRUE); + remove_header(request, L"Content-Length", TRUE); return ERROR_SUCCESS; } @@ -4433,7 +4373,6 @@ static BOOL HTTP_ParseTime(SYSTEMTIME *st, LPCWSTR *str) static BOOL HTTP_ParseDateAsAsctime(LPCWSTR value, FILETIME *ft) { - static const WCHAR gmt[]= { 'G','M','T',0 }; WCHAR day[4], *dayPtr, month[4], *monthPtr, *nextPtr; LPCWSTR ptr; SYSTEMTIME st = { 0 }; @@ -4500,7 +4439,7 @@ static BOOL HTTP_ParseDateAsAsctime(LPCWSTR value, FILETIME *ft) /* asctime() doesn't report a timezone, but some web servers do, so accept * with or without GMT. */ - if (*ptr && wcscmp(ptr, gmt)) + if (*ptr && wcscmp(ptr, L"GMT")) { ERR("unexpected timezone %s\n", debugstr_w(ptr)); return FALSE; @@ -4510,7 +4449,6 @@ static BOOL HTTP_ParseDateAsAsctime(LPCWSTR value, FILETIME *ft) static BOOL HTTP_ParseRfc1123Date(LPCWSTR value, FILETIME *ft) { - static const WCHAR gmt[]= { 'G','M','T',0 }; WCHAR *nextPtr, day[4], month[4], *monthPtr; LPCWSTR ptr; unsigned long num; @@ -4578,7 +4516,7 @@ static BOOL HTTP_ParseRfc1123Date(LPCWSTR value, FILETIME *ft) while (iswspace(*ptr)) ptr++; - if (wcscmp(ptr, gmt)) + if (wcscmp(ptr, L"GMT")) { ERR("unexpected time zone %s\n", debugstr_w(ptr)); return FALSE; @@ -4606,7 +4544,6 @@ static WORD HTTP_ParseWeekday(LPCWSTR day) static BOOL HTTP_ParseRfc850Date(LPCWSTR value, FILETIME *ft) { - static const WCHAR gmt[]= { 'G','M','T',0 }; WCHAR *nextPtr, day[10], month[4], *monthPtr; LPCWSTR ptr; unsigned long num; @@ -4696,7 +4633,7 @@ static BOOL HTTP_ParseRfc850Date(LPCWSTR value, FILETIME *ft) while (iswspace(*ptr)) ptr++; - if (wcscmp(ptr, gmt)) + if (wcscmp(ptr, L"GMT")) { ERR("unexpected time zone %s\n", debugstr_w(ptr)); return FALSE; @@ -4706,10 +4643,9 @@ static BOOL HTTP_ParseRfc850Date(LPCWSTR value, FILETIME *ft) static BOOL HTTP_ParseDate(LPCWSTR value, FILETIME *ft) { - static const WCHAR zero[] = { '0',0 }; BOOL ret; - if (!wcscmp(value, zero)) + if (!wcscmp(value, L"0")) { ft->dwLowDateTime = ft->dwHighDateTime = 0; ret = TRUE; @@ -4743,7 +4679,7 @@ static void HTTP_ProcessExpires(http_request_t *request) /* Look for a Cache-Control header with a max-age directive, as it takes * precedence over the Expires header. */ - headerIndex = HTTP_GetCustomHeaderIndex(request, szCache_Control, 0, FALSE); + headerIndex = HTTP_GetCustomHeaderIndex(request, L"Cache-Control", 0, FALSE); if (headerIndex != -1) { LPHTTPHEADERW ccHeader = &request->custHeaders[headerIndex]; @@ -4761,10 +4697,7 @@ static void HTTP_ProcessExpires(http_request_t *request) ; if (*equal == '=') { - static const WCHAR max_age[] = { - 'm','a','x','-','a','g','e',0 }; - - if (!wcsnicmp(ptr, max_age, equal - ptr - 1)) + if (!wcsnicmp(ptr, L"max-age", equal - ptr - 1)) { LPWSTR nextPtr; unsigned long age; @@ -4797,7 +4730,7 @@ static void HTTP_ProcessExpires(http_request_t *request) } if (!expirationFound) { - headerIndex = HTTP_GetCustomHeaderIndex(request, szExpires, 0, FALSE); + headerIndex = HTTP_GetCustomHeaderIndex(request, L"Expires", 0, FALSE); if (headerIndex != -1) { LPHTTPHEADERW expiresHeader = &request->custHeaders[headerIndex]; @@ -4830,7 +4763,7 @@ static void HTTP_ProcessLastModified(http_request_t *request) EnterCriticalSection( &request->headers_section ); - headerIndex = HTTP_GetCustomHeaderIndex(request, szLast_Modified, 0, FALSE); + headerIndex = HTTP_GetCustomHeaderIndex(request, L"Last-Modified", 0, FALSE); if (headerIndex != -1) { LPHTTPHEADERW expiresHeader = &request->custHeaders[headerIndex]; @@ -4849,12 +4782,12 @@ static void http_process_keep_alive(http_request_t *req) EnterCriticalSection( &req->headers_section ); - if ((index = HTTP_GetCustomHeaderIndex(req, szConnection, 0, FALSE)) != -1) - req->netconn->keep_alive = !wcsicmp(req->custHeaders[index].lpszValue, szKeepAlive); - else if ((index = HTTP_GetCustomHeaderIndex(req, szProxy_Connection, 0, FALSE)) != -1) - req->netconn->keep_alive = !wcsicmp(req->custHeaders[index].lpszValue, szKeepAlive); + if ((index = HTTP_GetCustomHeaderIndex(req, L"Connection", 0, FALSE)) != -1) + req->netconn->keep_alive = !wcsicmp(req->custHeaders[index].lpszValue, L"Keep-Alive"); + else if ((index = HTTP_GetCustomHeaderIndex(req, L"Proxy-Connection", 0, FALSE)) != -1) + req->netconn->keep_alive = !wcsicmp(req->custHeaders[index].lpszValue, L"Keep-Alive"); else - req->netconn->keep_alive = !wcsicmp(req->version, g_szHttp1_1); + req->netconn->keep_alive = !wcsicmp(req->version, L"HTTP/1.1"); LeaveCriticalSection( &req->headers_section ); } @@ -4949,11 +4882,9 @@ static char *build_ascii_request( const WCHAR *str, void *data, DWORD data_len, static void set_content_length_header( http_request_t *request, DWORD len, DWORD flags ) { - static const WCHAR fmtW[] = - {'C','o','n','t','e','n','t','-','L','e','n','g','t','h',':',' ','%','u','\r','\n',0}; - WCHAR buf[ARRAY_SIZE(fmtW) + 10]; + WCHAR buf[ARRAY_SIZE(L"Content-Length: %u\r\n") + 10]; - swprintf( buf, ARRAY_SIZE(buf), fmtW, len ); + swprintf( buf, ARRAY_SIZE(buf), L"Content-Length: %u\r\n", len ); HTTP_HttpAddRequestHeadersW( request, buf, ~0u, flags ); } @@ -4982,12 +4913,12 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, /* if the verb is NULL default to GET */ if (!request->verb) - request->verb = heap_strdupW(szGET); + request->verb = heap_strdupW(L"GET"); - HTTP_ProcessHeader(request, hostW, request->server->canon_host_port, + HTTP_ProcessHeader(request, L"Host", request->server->canon_host_port, HTTP_ADDREQ_FLAG_ADD_IF_NEW | HTTP_ADDHDR_FLAG_REQ); - if (dwContentLength || wcscmp(request->verb, szGET)) + if (dwContentLength || wcscmp(request->verb, L"GET")) { set_content_length_header(request, dwContentLength, HTTP_ADDREQ_FLAG_ADD_IF_NEW); request->bytesToWrite = dwContentLength; @@ -4995,26 +4926,24 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, if (request->session->appInfo->agent) { WCHAR *agent_header; - static const WCHAR user_agent[] = {'U','s','e','r','-','A','g','e','n','t',':',' ','%','s','\r','\n',0}; int len; - len = lstrlenW(request->session->appInfo->agent) + lstrlenW(user_agent); + len = lstrlenW(request->session->appInfo->agent) + lstrlenW(L"User-Agent: %s\r\n"); agent_header = heap_alloc(len * sizeof(WCHAR)); - swprintf(agent_header, len, user_agent, request->session->appInfo->agent); + swprintf(agent_header, len, L"User-Agent: %s\r\n", request->session->appInfo->agent); HTTP_HttpAddRequestHeadersW(request, agent_header, lstrlenW(agent_header), HTTP_ADDREQ_FLAG_ADD_IF_NEW); heap_free(agent_header); } if (request->hdr.dwFlags & INTERNET_FLAG_PRAGMA_NOCACHE) { - static const WCHAR pragma_nocache[] = {'P','r','a','g','m','a',':',' ','n','o','-','c','a','c','h','e','\r','\n',0}; - HTTP_HttpAddRequestHeadersW(request, pragma_nocache, lstrlenW(pragma_nocache), HTTP_ADDREQ_FLAG_ADD_IF_NEW); + HTTP_HttpAddRequestHeadersW(request, L"Pragma: no-cache\r\n", + lstrlenW(L"Pragma: no-cache\r\n"), HTTP_ADDREQ_FLAG_ADD_IF_NEW); } - if ((request->hdr.dwFlags & INTERNET_FLAG_NO_CACHE_WRITE) && wcscmp(request->verb, szGET)) + if ((request->hdr.dwFlags & INTERNET_FLAG_NO_CACHE_WRITE) && wcscmp(request->verb, L"GET")) { - static const WCHAR cache_control[] = {'C','a','c','h','e','-','C','o','n','t','r','o','l',':', - ' ','n','o','-','c','a','c','h','e','\r','\n',0}; - HTTP_HttpAddRequestHeadersW(request, cache_control, lstrlenW(cache_control), HTTP_ADDREQ_FLAG_ADD_IF_NEW); + HTTP_HttpAddRequestHeadersW(request, L"Cache-Control: no-cache\r\n", + lstrlenW(L"Cache-Control: no-cache\r\n"), HTTP_ADDREQ_FLAG_ADD_IF_NEW); } /* add the headers the caller supplied */ @@ -5039,7 +4968,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, HTTPHEADERW *host; EnterCriticalSection( &request->headers_section ); - host = HTTP_GetHeader( request, hostW ); + host = HTTP_GetHeader(request, L"Host"); TRACE("Going to url %s %s\n", debugstr_w(host->lpszValue), debugstr_w(request->path)); LeaveCriticalSection( &request->headers_section ); } @@ -5047,11 +4976,11 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, HTTP_FixURL(request); if (request->hdr.dwFlags & INTERNET_FLAG_KEEP_CONNECTION) { - HTTP_ProcessHeader(request, szConnection, szKeepAlive, + HTTP_ProcessHeader(request, L"Connection", L"Keep-Alive", HTTP_ADDHDR_FLAG_REQ | HTTP_ADDHDR_FLAG_REPLACE | HTTP_ADDHDR_FLAG_ADD); } - HTTP_InsertAuthorization(request, request->authInfo, szAuthorization); - HTTP_InsertAuthorization(request, request->proxyAuthInfo, szProxy_Authorization); + HTTP_InsertAuthorization(request, request->authInfo, L"Authorization"); + HTTP_InsertAuthorization(request, request->proxyAuthInfo, L"Proxy-Authorization"); if (!(request->hdr.dwFlags & INTERNET_FLAG_NO_COOKIES)) HTTP_InsertCookies(request); @@ -5076,13 +5005,12 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, } if (secure_proxy_connect) { - static const WCHAR connectW[] = {'C','O','N','N','E','C','T',0}; const WCHAR *target = request->server->host_port; - if (HTTP_GetCustomHeaderIndex(request, szContent_Length, 0, TRUE) >= 0) + if (HTTP_GetCustomHeaderIndex(request, L"Content-Length", 0, TRUE) >= 0) set_content_length_header(request, 0, HTTP_ADDREQ_FLAG_REPLACE); - request_header = build_request_header(request, connectW, target, g_szHttp1_1, TRUE); + request_header = build_request_header(request, L"CONNECT", target, L"HTTP/1.1", TRUE); } else if (request->proxy && !(request->hdr.dwFlags & INTERNET_FLAG_SECURE)) { @@ -5092,7 +5020,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, } else { - if (request->proxy && HTTP_GetCustomHeaderIndex(request, szContent_Length, 0, TRUE) >= 0) + if (request->proxy && HTTP_GetCustomHeaderIndex(request, L"Content-Length", 0, TRUE) >= 0) set_content_length_header(request, dwContentLength, HTTP_ADDREQ_FLAG_REPLACE); request_header = build_request_header(request, request->verb, request->path, request->version, TRUE); @@ -5179,11 +5107,11 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, if(!new_url) break; - if (wcscmp(request->verb, szGET) && wcscmp(request->verb, szHEAD) && + if (wcscmp(request->verb, L"GET") && wcscmp(request->verb, L"HEAD") && request->status_code != HTTP_STATUS_REDIRECT_KEEP_VERB) { heap_free(request->verb); - request->verb = heap_strdupW(szGET); + request->verb = heap_strdupW(L"GET"); } http_release_netconn(request, drain_content(request, FALSE) == ERROR_SUCCESS); res = HTTP_HandleRedirect(request, new_url); @@ -5262,7 +5190,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, http_release_netconn( request, FALSE ); break; } - remove_header(request, szProxy_Authorization, TRUE); + remove_header(request, L"Proxy-Authorization", TRUE); destroy_authinfo(request->proxyAuthInfo); request->proxyAuthInfo = NULL; request->contentLength = 0; @@ -5373,11 +5301,11 @@ static DWORD HTTP_HttpEndRequestW(http_request_t *request, DWORD dwFlags, DWORD_ if(!new_url) break; - if (wcscmp(request->verb, szGET) && wcscmp(request->verb, szHEAD) && + if (wcscmp(request->verb, L"GET") && wcscmp(request->verb, L"HEAD") && request->status_code != HTTP_STATUS_REDIRECT_KEEP_VERB) { heap_free(request->verb); - request->verb = heap_strdupW(szGET); + request->verb = heap_strdupW(L"GET"); } http_release_netconn(request, drain_content(request, FALSE) == ERROR_SUCCESS); res = HTTP_HandleRedirect(request, new_url); @@ -6025,7 +5953,7 @@ static DWORD HTTP_GetResponseHeaders(http_request_t *request, INT *len) rc += buflen; MultiByteToWideChar( CP_ACP, 0, bufferA, buflen, buffer, MAX_REPLY_LEN ); /* check is this a status code line? */ - if (!wcsncmp(buffer, g_szHttp1_0, 4)) + if (!wcsncmp(buffer, L"HTTP/1.0", 4)) { /* split the version from the status code */ status_code = wcschr( buffer, ' ' ); @@ -6053,22 +5981,22 @@ static DWORD HTTP_GetResponseHeaders(http_request_t *request, INT *len) heap_free(request->statusText); request->status_code = HTTP_STATUS_OK; - request->version = heap_strdupW(g_szHttp1_0); - request->statusText = heap_strdupW(szOK); + request->version = heap_strdupW(L"HTTP/1.0"); + request->statusText = heap_strdupW(L"OK"); goto lend; } } while (codeHundred); /* Add status code */ - HTTP_ProcessHeader(request, szStatus, status_code, + HTTP_ProcessHeader(request, L"Status", status_code, HTTP_ADDHDR_FLAG_REPLACE | HTTP_ADDHDR_FLAG_ADD); heap_free(request->version); heap_free(request->statusText); request->version = heap_strdupW(buffer); - request->statusText = heap_strdupW(status_text ? status_text : emptyW); + request->statusText = heap_strdupW(status_text ? status_text : L""); /* Restore the spaces */ *(status_code-1) = ' '; diff --git a/dll/win32/wininet/internet.c b/dll/win32/wininet/internet.c index baf939a0fa8..9db4c9f3764 100644 --- a/dll/win32/wininet/internet.c +++ b/dll/win32/wininet/internet.c @@ -98,12 +98,7 @@ static ULONG max_conns = 2, max_1_0_conns = 4; static ULONG connect_timeout = 60000; static const WCHAR szInternetSettings[] = - { 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s',0 }; -static const WCHAR szProxyServer[] = { 'P','r','o','x','y','S','e','r','v','e','r', 0 }; -static const WCHAR szProxyEnable[] = { 'P','r','o','x','y','E','n','a','b','l','e', 0 }; -static const WCHAR szProxyOverride[] = { 'P','r','o','x','y','O','v','e','r','r','i','d','e', 0 }; + L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"; void *alloc_object(object_header_t *parent, const object_vtbl_t *vtbl, size_t size) { @@ -341,7 +336,7 @@ static LONG INTERNET_SaveProxySettings( proxyinfo_t *lpwpi ) if ((ret = RegOpenKeyW( HKEY_CURRENT_USER, szInternetSettings, &key ))) return ret; - if ((ret = RegSetValueExW( key, szProxyEnable, 0, REG_DWORD, (BYTE*)&lpwpi->proxyEnabled, sizeof(DWORD)))) + if ((ret = RegSetValueExW( key, L"ProxyEnable", 0, REG_DWORD, (BYTE*)&lpwpi->proxyEnabled, sizeof(DWORD)))) { RegCloseKey( key ); return ret; @@ -349,7 +344,7 @@ static LONG INTERNET_SaveProxySettings( proxyinfo_t *lpwpi ) if (lpwpi->proxy) { - if ((ret = RegSetValueExW( key, szProxyServer, 0, REG_SZ, (BYTE*)lpwpi->proxy, sizeof(WCHAR) * (lstrlenW(lpwpi->proxy) + 1)))) + if ((ret = RegSetValueExW( key, L"ProxyServer", 0, REG_SZ, (BYTE*)lpwpi->proxy, sizeof(WCHAR) * (lstrlenW(lpwpi->proxy) + 1)))) { RegCloseKey( key ); return ret; @@ -357,7 +352,7 @@ static LONG INTERNET_SaveProxySettings( proxyinfo_t *lpwpi ) } else { - if ((ret = RegDeleteValueW( key, szProxyServer )) && ret != ERROR_FILE_NOT_FOUND) + if ((ret = RegDeleteValueW( key, L"ProxyServer" )) && ret != ERROR_FILE_NOT_FOUND) { RegCloseKey( key ); return ret; @@ -495,7 +490,6 @@ static void free_global_proxy( void ) static BOOL parse_proxy_url( proxyinfo_t *info, const WCHAR *url ) { - static const WCHAR fmt[] = {'%','.','*','s',':','%','u',0}; URL_COMPONENTSW uc = {sizeof(uc)}; uc.dwHostNameLength = 1; @@ -511,7 +505,7 @@ static BOOL parse_proxy_url( proxyinfo_t *info, const WCHAR *url ) return TRUE; } if (!(info->proxy = heap_alloc( (uc.dwHostNameLength + 12) * sizeof(WCHAR) ))) return FALSE; - swprintf( info->proxy, uc.dwHostNameLength + 12, fmt, uc.dwHostNameLength, uc.lpszHostName, uc.nPort ); + swprintf( info->proxy, uc.dwHostNameLength + 12, L"%.*s:%u", uc.dwHostNameLength, uc.lpszHostName, uc.nPort ); if (!uc.dwUserNameLength) info->proxyUsername = NULL; else if (!(info->proxyUsername = heap_strndupW( uc.lpszUserName, uc.dwUserNameLength ))) @@ -566,10 +560,10 @@ static LONG INTERNET_LoadProxySettings( proxyinfo_t *lpwpi ) } len = sizeof(DWORD); - if (RegQueryValueExW( key, szProxyEnable, NULL, &type, (BYTE *)&lpwpi->proxyEnabled, &len ) || type != REG_DWORD) + if (RegQueryValueExW( key, L"ProxyEnable", NULL, &type, (BYTE *)&lpwpi->proxyEnabled, &len ) || type != REG_DWORD) { lpwpi->proxyEnabled = 0; - if((ret = RegSetValueExW( key, szProxyEnable, 0, REG_DWORD, (BYTE *)&lpwpi->proxyEnabled, sizeof(DWORD) ))) + if((ret = RegSetValueExW( key, L"ProxyEnable", 0, REG_DWORD, (BYTE *)&lpwpi->proxyEnabled, sizeof(DWORD) ))) { FreeProxyInfo( lpwpi ); RegCloseKey( key ); @@ -580,10 +574,9 @@ static LONG INTERNET_LoadProxySettings( proxyinfo_t *lpwpi ) if (!(envproxy = _wgetenv( L"http_proxy" )) || lpwpi->proxyEnabled) { /* figure out how much memory the proxy setting takes */ - if (!RegQueryValueExW( key, szProxyServer, NULL, &type, NULL, &len ) && len && (type == REG_SZ)) + if (!RegQueryValueExW( key, L"ProxyServer", NULL, &type, NULL, &len ) && len && (type == REG_SZ)) { LPWSTR szProxy, p; - static const WCHAR szHttp[] = {'h','t','t','p','=',0}; if (!(szProxy = heap_alloc(len))) { @@ -591,13 +584,13 @@ static LONG INTERNET_LoadProxySettings( proxyinfo_t *lpwpi ) FreeProxyInfo( lpwpi ); return ERROR_OUTOFMEMORY; } - RegQueryValueExW( key, szProxyServer, NULL, &type, (BYTE*)szProxy, &len ); + RegQueryValueExW( key, L"ProxyServer", NULL, &type, (BYTE*)szProxy, &len ); /* find the http proxy, and strip away everything else */ - p = wcsstr( szProxy, szHttp ); + p = wcsstr( szProxy, L"http=" ); if (p) { - p += lstrlenW( szHttp ); + p += lstrlenW( L"http=" ); lstrcpyW( szProxy, p ); } p = wcschr( szProxy, ';' ); @@ -642,7 +635,7 @@ static LONG INTERNET_LoadProxySettings( proxyinfo_t *lpwpi ) if (!(envproxy = _wgetenv( L"no_proxy" ))) { /* figure out how much memory the proxy setting takes */ - if (!RegQueryValueExW( key, szProxyOverride, NULL, &type, NULL, &len ) && len && (type == REG_SZ)) + if (!RegQueryValueExW( key, L"ProxyOverride", NULL, &type, NULL, &len ) && len && (type == REG_SZ)) { LPWSTR szProxy; @@ -651,7 +644,7 @@ static LONG INTERNET_LoadProxySettings( proxyinfo_t *lpwpi ) RegCloseKey( key ); return ERROR_OUTOFMEMORY; } - RegQueryValueExW( key, szProxyOverride, NULL, &type, (BYTE*)szProxy, &len ); + RegQueryValueExW( key, L"ProxyOverride", NULL, &type, (BYTE*)szProxy, &len ); heap_free( lpwpi->proxyBypass ); lpwpi->proxyBypass = szProxy; @@ -2391,8 +2384,6 @@ static int reverse_lookup( const struct addrinfo *ai, char *hostname, size_t len static WCHAR *build_wpad_url( const char *hostname, const struct addrinfo *ai ) { - static const WCHAR httpW[] = {'h','t','t','p',':','/','/',0}; - static const WCHAR wpadW[] = {'/','w','p','a','d','.','d','a','t',0}; char name[NI_MAXHOST]; WCHAR *ret, *p; int len; @@ -2402,12 +2393,12 @@ static WCHAR *build_wpad_url( const char *hostname, const struct addrinfo *ai ) if (!reverse_lookup( ai, name, sizeof(name) )) hostname = name; - len = lstrlenW( httpW ) + strlen( hostname ) + lstrlenW( wpadW ); + len = lstrlenW( L"http://" ) + strlen( hostname ) + lstrlenW( L"/wpad.dat" ); if (!(ret = p = GlobalAlloc( 0, (len + 1) * sizeof(WCHAR) ))) return NULL; - lstrcpyW( p, httpW ); - p += lstrlenW( httpW ); + lstrcpyW( p, L"http://" ); + p += lstrlenW( L"http://" ); while (*hostname) { *p++ = *hostname++; } - lstrcpyW( p, wpadW ); + lstrcpyW( p, L"/wpad.dat" ); return ret; } @@ -3336,10 +3327,6 @@ BOOL WINAPI InternetTimeFromSystemTimeA( const SYSTEMTIME* time, DWORD format, L */ BOOL WINAPI InternetTimeFromSystemTimeW( const SYSTEMTIME* time, DWORD format, LPWSTR string, DWORD size ) { - static const WCHAR date[] = - { '%','s',',',' ','%','0','2','d',' ','%','s',' ','%','4','d',' ','%','0', - '2','d',':','%','0','2','d',':','%','0','2','d',' ','G','M','T', 0 }; - TRACE( "%p 0x%08x %p 0x%08x\n", time, format, string, size ); if (!time || !string || format != INTERNET_RFC1123_FORMAT) @@ -3354,7 +3341,7 @@ BOOL WINAPI InternetTimeFromSystemTimeW( const SYSTEMTIME* time, DWORD format, L return FALSE; } - swprintf( string, size, date, + swprintf( string, size, L"%s, %02d %s %4d %02d:%02d:%02d GMT", WININET_wkday[time->wDayOfWeek], time->wDay, WININET_month[time->wMonth - 1], @@ -3661,8 +3648,7 @@ static HINTERNET INTERNET_InternetOpenUrlW(appinfo_t *hIC, LPCWSTR lpszUrl, case INTERNET_SCHEME_HTTP: case INTERNET_SCHEME_HTTPS: { - static const WCHAR szStars[] = { '*','/','*', 0 }; - LPCWSTR accept[2] = { szStars, NULL }; + LPCWSTR accept[2] = { L"*/*", NULL }; if (urlComponents.nScheme == INTERNET_SCHEME_HTTPS) dwFlags |= INTERNET_FLAG_SECURE; diff --git a/dll/win32/wininet/urlcache.c b/dll/win32/wininet/urlcache.c index 1a91d80d6a8..a2cd0635812 100644 --- a/dll/win32/wininet/urlcache.c +++ b/dll/win32/wininet/urlcache.c @@ -402,12 +402,10 @@ static void cache_container_create_object_name(LPWSTR lpszPath, WCHAR replace) /* Caller must hold container lock */ static HANDLE cache_container_map_index(HANDLE file, const WCHAR *path, DWORD size, BOOL *validate) { - static const WCHAR mapping_name_format[] - = {'%','s','i','n','d','e','x','.','d','a','t','_','%','l','u',0}; WCHAR mapping_name[MAX_PATH]; HANDLE mapping; - wsprintfW(mapping_name, mapping_name_format, path, size); + wsprintfW(mapping_name, L"%sindex.dat_%lu", path, size); cache_container_create_object_name(mapping_name, '_'); mapping = OpenFileMappingW(FILE_MAP_WRITE, FALSE, mapping_name); @@ -423,13 +421,6 @@ static HANDLE cache_container_map_index(HANDLE file, const WCHAR *path, DWORD si /* Caller must hold container lock */ static DWORD cache_container_set_size(cache_container *container, HANDLE file, DWORD blocks_no) { - static const WCHAR cache_content_key[] = {'S','o','f','t','w','a','r','e','\\', - 'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\', - 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s','\\', - 'C','a','c','h','e','\\','C','o','n','t','e','n','t',0}; - static const WCHAR cache_limit[] = {'C','a','c','h','e','L','i','m','i','t',0}; - DWORD file_size = FILE_SIZE(blocks_no); WCHAR dir_path[MAX_PATH], *dir_name; entry_hash_table *hashtable_entry; @@ -480,10 +471,11 @@ static DWORD cache_container_set_size(cache_container *container, HANDLE file, D header->dirs_no = container->default_entry_type==NORMAL_CACHE_ENTRY ? 4 : 0; /* If the registry has a cache size set, use the registry value */ - if(RegOpenKeyW(HKEY_CURRENT_USER, cache_content_key, &key) == ERROR_SUCCESS) { + if(RegOpenKeyW(HKEY_CURRENT_USER, + L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Cache\\Content", &key) == ERROR_SUCCESS) { DWORD dw, len = sizeof(dw), keytype; - if(RegQueryValueExW(key, cache_limit, NULL, &keytype, (BYTE*)&dw, &len) == ERROR_SUCCESS && + if(RegQueryValueExW(key, L"CacheLimit", NULL, &keytype, (BYTE*)&dw, &len) == ERROR_SUCCESS && keytype == REG_DWORD) header->cache_limit.QuadPart = (ULONGLONG)dw * 1024; RegCloseKey(key); @@ -603,8 +595,6 @@ static BOOL cache_container_is_valid(urlcache_header *header, DWORD file_size) */ static DWORD cache_container_open_index(cache_container *container, DWORD blocks_no) { - static const WCHAR index_dat[] = {'i','n','d','e','x','.','d','a','t',0}; - HANDLE file; WCHAR index_path[MAX_PATH]; DWORD file_size; @@ -618,7 +608,7 @@ static DWORD cache_container_open_index(cache_container *container, DWORD blocks } lstrcpyW(index_path, container->path); - lstrcatW(index_path, index_dat); + lstrcatW(index_path, L"index.dat"); file = CreateFileW(index_path, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, 0, NULL); if(file == INVALID_HANDLE_VALUE) { @@ -2757,9 +2747,7 @@ static BOOL urlcache_entry_create(const char *url, const char *ext, WCHAR *full_ } for(i=0; i<255 && !generate_name; i++) { - static const WCHAR format[] = {'[','%','u',']','%','s',0}; - - wsprintfW(full_path+full_path_len, format, i, extW); + wsprintfW(full_path+full_path_len, L"[%u]%s", i, extW); TRACE("Trying: %s\n", debugstr_w(full_path)); file = CreateFileW(full_path, GENERIC_READ, 0, NULL, CREATE_NEW, 0, NULL); diff --git a/sdk/tools/winesync/wininet.cfg b/sdk/tools/winesync/wininet.cfg index 0ddeaa60803..4c9385fe431 100644 --- a/sdk/tools/winesync/wininet.cfg +++ b/sdk/tools/winesync/wininet.cfg @@ -5,4 +5,4 @@ files: include/wininet.h: sdk/include/psdk/wininet.h include/winineti.h: sdk/include/psdk/winineti.h tags: - wine: 085f3738a86e6fa0e12b3f59fa4a9ca86826bb60 + wine: e88abf0dc4ae7ec6b2fd21130be09dadc478b9fc
3 years, 10 months
1
0
0
0
[reactos] 31/39: [WINESYNC] wininet: Use wide-char string literals in struct initialization.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cde08ff2b76cf79e8535a…
commit cde08ff2b76cf79e8535aec91a7496c71e1292ee Author: winesync <ros-dev(a)reactos.org> AuthorDate: Tue Dec 8 18:17:51 2020 +0100 Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com> CommitDate: Tue Jan 5 11:03:13 2021 +0100 [WINESYNC] wininet: Use wide-char string literals in struct initialization. Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 085f3738a86e6fa0e12b3f59fa4a9ca86826bb60 by Michael Stefaniuc <mstefani(a)winehq.org> --- dll/win32/wininet/http.c | 249 ++++++++++++++++------------------------- dll/win32/wininet/internet.c | 10 +- dll/win32/wininet/urlcache.c | 12 +- sdk/tools/winesync/wininet.cfg | 2 +- 4 files changed, 107 insertions(+), 166 deletions(-) diff --git a/dll/win32/wininet/http.c b/dll/win32/wininet/http.c index 52ed7cc730a..7e2de88783e 100644 --- a/dll/win32/wininet/http.c +++ b/dll/win32/wininet/http.c @@ -76,58 +76,16 @@ static const WCHAR szGET[] = { 'G','E','T', 0 }; static const WCHAR szHEAD[] = { 'H','E','A','D', 0 }; static const WCHAR szAccept[] = { 'A','c','c','e','p','t',0 }; -static const WCHAR szAccept_Charset[] = { 'A','c','c','e','p','t','-','C','h','a','r','s','e','t', 0 }; -static const WCHAR szAccept_Encoding[] = { 'A','c','c','e','p','t','-','E','n','c','o','d','i','n','g',0 }; -static const WCHAR szAccept_Language[] = { 'A','c','c','e','p','t','-','L','a','n','g','u','a','g','e',0 }; -static const WCHAR szAccept_Ranges[] = { 'A','c','c','e','p','t','-','R','a','n','g','e','s',0 }; -static const WCHAR szAge[] = { 'A','g','e',0 }; -static const WCHAR szAllow[] = { 'A','l','l','o','w',0 }; static const WCHAR szCache_Control[] = { 'C','a','c','h','e','-','C','o','n','t','r','o','l',0 }; static const WCHAR szConnection[] = { 'C','o','n','n','e','c','t','i','o','n',0 }; -static const WCHAR szContent_Base[] = { 'C','o','n','t','e','n','t','-','B','a','s','e',0 }; -static const WCHAR szContent_Disposition[] = { 'C','o','n','t','e','n','t','-','D','i','s','p','o','s','i','t','i','o','n',0 }; static const WCHAR szContent_Encoding[] = { 'C','o','n','t','e','n','t','-','E','n','c','o','d','i','n','g',0 }; -static const WCHAR szContent_ID[] = { 'C','o','n','t','e','n','t','-','I','D',0 }; -static const WCHAR szContent_Language[] = { 'C','o','n','t','e','n','t','-','L','a','n','g','u','a','g','e',0 }; static const WCHAR szContent_Length[] = { 'C','o','n','t','e','n','t','-','L','e','n','g','t','h',0 }; -static const WCHAR szContent_Location[] = { 'C','o','n','t','e','n','t','-','L','o','c','a','t','i','o','n',0 }; -static const WCHAR szContent_MD5[] = { 'C','o','n','t','e','n','t','-','M','D','5',0 }; -static const WCHAR szContent_Range[] = { 'C','o','n','t','e','n','t','-','R','a','n','g','e',0 }; -static const WCHAR szContent_Transfer_Encoding[] = { 'C','o','n','t','e','n','t','-','T','r','a','n','s','f','e','r','-','E','n','c','o','d','i','n','g',0 }; static const WCHAR szContent_Type[] = { 'C','o','n','t','e','n','t','-','T','y','p','e',0 }; -static const WCHAR szCookie[] = { 'C','o','o','k','i','e',0 }; -static const WCHAR szDate[] = { 'D','a','t','e',0 }; -static const WCHAR szFrom[] = { 'F','r','o','m',0 }; -static const WCHAR szETag[] = { 'E','T','a','g',0 }; -static const WCHAR szExpect[] = { 'E','x','p','e','c','t',0 }; static const WCHAR szExpires[] = { 'E','x','p','i','r','e','s',0 }; -static const WCHAR szIf_Match[] = { 'I','f','-','M','a','t','c','h',0 }; -static const WCHAR szIf_Modified_Since[] = { 'I','f','-','M','o','d','i','f','i','e','d','-','S','i','n','c','e',0 }; -static const WCHAR szIf_None_Match[] = { 'I','f','-','N','o','n','e','-','M','a','t','c','h',0 }; -static const WCHAR szIf_Range[] = { 'I','f','-','R','a','n','g','e',0 }; -static const WCHAR szIf_Unmodified_Since[] = { 'I','f','-','U','n','m','o','d','i','f','i','e','d','-','S','i','n','c','e',0 }; static const WCHAR szLast_Modified[] = { 'L','a','s','t','-','M','o','d','i','f','i','e','d',0 }; -static const WCHAR szLocation[] = { 'L','o','c','a','t','i','o','n',0 }; -static const WCHAR szMax_Forwards[] = { 'M','a','x','-','F','o','r','w','a','r','d','s',0 }; -static const WCHAR szMime_Version[] = { 'M','i','m','e','-','V','e','r','s','i','o','n',0 }; -static const WCHAR szPragma[] = { 'P','r','a','g','m','a',0 }; -static const WCHAR szProxy_Authenticate[] = { 'P','r','o','x','y','-','A','u','t','h','e','n','t','i','c','a','t','e',0 }; static const WCHAR szProxy_Connection[] = { 'P','r','o','x','y','-','C','o','n','n','e','c','t','i','o','n',0 }; -static const WCHAR szPublic[] = { 'P','u','b','l','i','c',0 }; -static const WCHAR szRange[] = { 'R','a','n','g','e',0 }; static const WCHAR szReferer[] = { 'R','e','f','e','r','e','r',0 }; -static const WCHAR szRetry_After[] = { 'R','e','t','r','y','-','A','f','t','e','r',0 }; -static const WCHAR szServer[] = { 'S','e','r','v','e','r',0 }; static const WCHAR szSet_Cookie[] = { 'S','e','t','-','C','o','o','k','i','e',0 }; -static const WCHAR szTransfer_Encoding[] = { 'T','r','a','n','s','f','e','r','-','E','n','c','o','d','i','n','g',0 }; -static const WCHAR szUnless_Modified_Since[] = { 'U','n','l','e','s','s','-','M','o','d','i','f','i','e','d','-','S','i','n','c','e',0 }; -static const WCHAR szUpgrade[] = { 'U','p','g','r','a','d','e',0 }; -static const WCHAR szURI[] = { 'U','R','I',0 }; -static const WCHAR szUser_Agent[] = { 'U','s','e','r','-','A','g','e','n','t',0 }; -static const WCHAR szVary[] = { 'V','a','r','y',0 }; -static const WCHAR szVia[] = { 'V','i','a',0 }; -static const WCHAR szWarning[] = { 'W','a','r','n','i','n','g',0 }; -static const WCHAR szWWW_Authenticate[] = { 'W','W','W','-','A','u','t','h','e','n','t','i','c','a','t','e',0 }; static const WCHAR emptyW[] = {0}; @@ -3607,77 +3565,77 @@ lend: } static const LPCWSTR header_lookup[] = { - szMime_Version, /* HTTP_QUERY_MIME_VERSION = 0 */ - szContent_Type, /* HTTP_QUERY_CONTENT_TYPE = 1 */ - szContent_Transfer_Encoding,/* HTTP_QUERY_CONTENT_TRANSFER_ENCODING = 2 */ - szContent_ID, /* HTTP_QUERY_CONTENT_ID = 3 */ - NULL, /* HTTP_QUERY_CONTENT_DESCRIPTION = 4 */ - szContent_Length, /* HTTP_QUERY_CONTENT_LENGTH = 5 */ - szContent_Language, /* HTTP_QUERY_CONTENT_LANGUAGE = 6 */ - szAllow, /* HTTP_QUERY_ALLOW = 7 */ - szPublic, /* HTTP_QUERY_PUBLIC = 8 */ - szDate, /* HTTP_QUERY_DATE = 9 */ - szExpires, /* HTTP_QUERY_EXPIRES = 10 */ - szLast_Modified, /* HTTP_QUERY_LAST_MODIFIED = 11 */ - NULL, /* HTTP_QUERY_MESSAGE_ID = 12 */ - szURI, /* HTTP_QUERY_URI = 13 */ - szFrom, /* HTTP_QUERY_DERIVED_FROM = 14 */ - NULL, /* HTTP_QUERY_COST = 15 */ - NULL, /* HTTP_QUERY_LINK = 16 */ - szPragma, /* HTTP_QUERY_PRAGMA = 17 */ - NULL, /* HTTP_QUERY_VERSION = 18 */ - szStatus, /* HTTP_QUERY_STATUS_CODE = 19 */ - NULL, /* HTTP_QUERY_STATUS_TEXT = 20 */ - NULL, /* HTTP_QUERY_RAW_HEADERS = 21 */ - NULL, /* HTTP_QUERY_RAW_HEADERS_CRLF = 22 */ - szConnection, /* HTTP_QUERY_CONNECTION = 23 */ - szAccept, /* HTTP_QUERY_ACCEPT = 24 */ - szAccept_Charset, /* HTTP_QUERY_ACCEPT_CHARSET = 25 */ - szAccept_Encoding, /* HTTP_QUERY_ACCEPT_ENCODING = 26 */ - szAccept_Language, /* HTTP_QUERY_ACCEPT_LANGUAGE = 27 */ - szAuthorization, /* HTTP_QUERY_AUTHORIZATION = 28 */ - szContent_Encoding, /* HTTP_QUERY_CONTENT_ENCODING = 29 */ - NULL, /* HTTP_QUERY_FORWARDED = 30 */ - NULL, /* HTTP_QUERY_FROM = 31 */ - szIf_Modified_Since, /* HTTP_QUERY_IF_MODIFIED_SINCE = 32 */ - szLocation, /* HTTP_QUERY_LOCATION = 33 */ - NULL, /* HTTP_QUERY_ORIG_URI = 34 */ - szReferer, /* HTTP_QUERY_REFERER = 35 */ - szRetry_After, /* HTTP_QUERY_RETRY_AFTER = 36 */ - szServer, /* HTTP_QUERY_SERVER = 37 */ - NULL, /* HTTP_TITLE = 38 */ - szUser_Agent, /* HTTP_QUERY_USER_AGENT = 39 */ - szWWW_Authenticate, /* HTTP_QUERY_WWW_AUTHENTICATE = 40 */ - szProxy_Authenticate, /* HTTP_QUERY_PROXY_AUTHENTICATE = 41 */ - szAccept_Ranges, /* HTTP_QUERY_ACCEPT_RANGES = 42 */ - szSet_Cookie, /* HTTP_QUERY_SET_COOKIE = 43 */ - szCookie, /* HTTP_QUERY_COOKIE = 44 */ - NULL, /* HTTP_QUERY_REQUEST_METHOD = 45 */ - NULL, /* HTTP_QUERY_REFRESH = 46 */ - szContent_Disposition, /* HTTP_QUERY_CONTENT_DISPOSITION = 47 */ - szAge, /* HTTP_QUERY_AGE = 48 */ - szCache_Control, /* HTTP_QUERY_CACHE_CONTROL = 49 */ - szContent_Base, /* HTTP_QUERY_CONTENT_BASE = 50 */ - szContent_Location, /* HTTP_QUERY_CONTENT_LOCATION = 51 */ - szContent_MD5, /* HTTP_QUERY_CONTENT_MD5 = 52 */ - szContent_Range, /* HTTP_QUERY_CONTENT_RANGE = 53 */ - szETag, /* HTTP_QUERY_ETAG = 54 */ - hostW, /* HTTP_QUERY_HOST = 55 */ - szIf_Match, /* HTTP_QUERY_IF_MATCH = 56 */ - szIf_None_Match, /* HTTP_QUERY_IF_NONE_MATCH = 57 */ - szIf_Range, /* HTTP_QUERY_IF_RANGE = 58 */ - szIf_Unmodified_Since, /* HTTP_QUERY_IF_UNMODIFIED_SINCE = 59 */ - szMax_Forwards, /* HTTP_QUERY_MAX_FORWARDS = 60 */ - szProxy_Authorization, /* HTTP_QUERY_PROXY_AUTHORIZATION = 61 */ - szRange, /* HTTP_QUERY_RANGE = 62 */ - szTransfer_Encoding, /* HTTP_QUERY_TRANSFER_ENCODING = 63 */ - szUpgrade, /* HTTP_QUERY_UPGRADE = 64 */ - szVary, /* HTTP_QUERY_VARY = 65 */ - szVia, /* HTTP_QUERY_VIA = 66 */ - szWarning, /* HTTP_QUERY_WARNING = 67 */ - szExpect, /* HTTP_QUERY_EXPECT = 68 */ - szProxy_Connection, /* HTTP_QUERY_PROXY_CONNECTION = 69 */ - szUnless_Modified_Since, /* HTTP_QUERY_UNLESS_MODIFIED_SINCE = 70 */ + L"Mime-Version", /* HTTP_QUERY_MIME_VERSION = 0 */ + L"Content-Type", /* HTTP_QUERY_CONTENT_TYPE = 1 */ + L"Content-Transfer-Encoding", /* HTTP_QUERY_CONTENT_TRANSFER_ENCODING = 2 */ + L"Content-ID", /* HTTP_QUERY_CONTENT_ID = 3 */ + NULL, /* HTTP_QUERY_CONTENT_DESCRIPTION = 4 */ + L"Content-Length", /* HTTP_QUERY_CONTENT_LENGTH = 5 */ + L"Content-Language", /* HTTP_QUERY_CONTENT_LANGUAGE = 6 */ + L"Allow", /* HTTP_QUERY_ALLOW = 7 */ + L"Public", /* HTTP_QUERY_PUBLIC = 8 */ + L"Date", /* HTTP_QUERY_DATE = 9 */ + L"Expires", /* HTTP_QUERY_EXPIRES = 10 */ + L"Last-Modified", /* HTTP_QUERY_LAST_MODIFIED = 11 */ + NULL, /* HTTP_QUERY_MESSAGE_ID = 12 */ + L"URI", /* HTTP_QUERY_URI = 13 */ + L"From", /* HTTP_QUERY_DERIVED_FROM = 14 */ + NULL, /* HTTP_QUERY_COST = 15 */ + NULL, /* HTTP_QUERY_LINK = 16 */ + L"Pragma", /* HTTP_QUERY_PRAGMA = 17 */ + NULL, /* HTTP_QUERY_VERSION = 18 */ + L"Status", /* HTTP_QUERY_STATUS_CODE = 19 */ + NULL, /* HTTP_QUERY_STATUS_TEXT = 20 */ + NULL, /* HTTP_QUERY_RAW_HEADERS = 21 */ + NULL, /* HTTP_QUERY_RAW_HEADERS_CRLF = 22 */ + L"Connection", /* HTTP_QUERY_CONNECTION = 23 */ + L"Accept", /* HTTP_QUERY_ACCEPT = 24 */ + L"Accept-Charset", /* HTTP_QUERY_ACCEPT_CHARSET = 25 */ + L"Accept-Encoding", /* HTTP_QUERY_ACCEPT_ENCODING = 26 */ + L"Accept-Language", /* HTTP_QUERY_ACCEPT_LANGUAGE = 27 */ + L"Authorization", /* HTTP_QUERY_AUTHORIZATION = 28 */ + L"Content-Encoding", /* HTTP_QUERY_CONTENT_ENCODING = 29 */ + NULL, /* HTTP_QUERY_FORWARDED = 30 */ + NULL, /* HTTP_QUERY_FROM = 31 */ + L"If-Modified-Since", /* HTTP_QUERY_IF_MODIFIED_SINCE = 32 */ + L"Location", /* HTTP_QUERY_LOCATION = 33 */ + NULL, /* HTTP_QUERY_ORIG_URI = 34 */ + L"Referer", /* HTTP_QUERY_REFERER = 35 */ + L"Retry-After", /* HTTP_QUERY_RETRY_AFTER = 36 */ + L"Server", /* HTTP_QUERY_SERVER = 37 */ + NULL, /* HTTP_TITLE = 38 */ + L"User-Agent", /* HTTP_QUERY_USER_AGENT = 39 */ + L"WWW-Authenticate", /* HTTP_QUERY_WWW_AUTHENTICATE = 40 */ + L"Proxy-Authenticate", /* HTTP_QUERY_PROXY_AUTHENTICATE = 41 */ + L"Accept-Ranges", /* HTTP_QUERY_ACCEPT_RANGES = 42 */ + L"Set-Cookie", /* HTTP_QUERY_SET_COOKIE = 43 */ + L"Cookie", /* HTTP_QUERY_COOKIE = 44 */ + NULL, /* HTTP_QUERY_REQUEST_METHOD = 45 */ + NULL, /* HTTP_QUERY_REFRESH = 46 */ + L"Content-Disposition", /* HTTP_QUERY_CONTENT_DISPOSITION = 47 */ + L"Age", /* HTTP_QUERY_AGE = 48 */ + L"Cache-Control", /* HTTP_QUERY_CACHE_CONTROL = 49 */ + L"Content-Base", /* HTTP_QUERY_CONTENT_BASE = 50 */ + L"Content-Location", /* HTTP_QUERY_CONTENT_LOCATION = 51 */ + L"Content-MD5", /* HTTP_QUERY_CONTENT_MD5 = 52 */ + L"Content-Range", /* HTTP_QUERY_CONTENT_RANGE = 53 */ + L"ETag", /* HTTP_QUERY_ETAG = 54 */ + L"Host", /* HTTP_QUERY_HOST = 55 */ + L"If-Match", /* HTTP_QUERY_IF_MATCH = 56 */ + L"If-None-Match", /* HTTP_QUERY_IF_NONE_MATCH = 57 */ + L"If-Range", /* HTTP_QUERY_IF_RANGE = 58 */ + L"If-Unmodified-Since", /* HTTP_QUERY_IF_UNMODIFIED_SINCE = 59 */ + L"Max-Forwards", /* HTTP_QUERY_MAX_FORWARDS = 60 */ + L"Proxy-Authorization", /* HTTP_QUERY_PROXY_AUTHORIZATION = 61 */ + L"Range", /* HTTP_QUERY_RANGE = 62 */ + L"Transfer-Encoding", /* HTTP_QUERY_TRANSFER_ENCODING = 63 */ + L"Upgrade", /* HTTP_QUERY_UPGRADE = 64 */ + L"Vary", /* HTTP_QUERY_VARY = 65 */ + L"Via", /* HTTP_QUERY_VIA = 66 */ + L"Warning", /* HTTP_QUERY_WARNING = 67 */ + L"Expect", /* HTTP_QUERY_EXPECT = 68 */ + L"Proxy-Connection", /* HTTP_QUERY_PROXY_CONNECTION = 69 */ + L"Unless-Modified-Since", /* HTTP_QUERY_UNLESS_MODIFIED_SINCE = 70 */ }; /*********************************************************************** @@ -4383,13 +4341,13 @@ static void HTTP_InsertCookies(http_request_t *request) static WORD HTTP_ParseWkday(LPCWSTR day) { - static const WCHAR days[7][4] = {{ 's','u','n',0 }, - { 'm','o','n',0 }, - { 't','u','e',0 }, - { 'w','e','d',0 }, - { 't','h','u',0 }, - { 'f','r','i',0 }, - { 's','a','t',0 }}; + static const WCHAR days[7][4] = {L"sun", + L"mon", + L"tue", + L"wed", + L"thu", + L"fri", + L"sat"}; unsigned int i; for (i = 0; i < ARRAY_SIZE(days); i++) if (!wcsicmp(day, days[i])) @@ -4401,31 +4359,18 @@ static WORD HTTP_ParseWkday(LPCWSTR day) static WORD HTTP_ParseMonth(LPCWSTR month) { - static const WCHAR jan[] = { 'j','a','n',0 }; - static const WCHAR feb[] = { 'f','e','b',0 }; - static const WCHAR mar[] = { 'm','a','r',0 }; - static const WCHAR apr[] = { 'a','p','r',0 }; - static const WCHAR may[] = { 'm','a','y',0 }; - static const WCHAR jun[] = { 'j','u','n',0 }; - static const WCHAR jul[] = { 'j','u','l',0 }; - static const WCHAR aug[] = { 'a','u','g',0 }; - static const WCHAR sep[] = { 's','e','p',0 }; - static const WCHAR oct[] = { 'o','c','t',0 }; - static const WCHAR nov[] = { 'n','o','v',0 }; - static const WCHAR dec[] = { 'd','e','c',0 }; - - if (!wcsicmp(month, jan)) return 1; - if (!wcsicmp(month, feb)) return 2; - if (!wcsicmp(month, mar)) return 3; - if (!wcsicmp(month, apr)) return 4; - if (!wcsicmp(month, may)) return 5; - if (!wcsicmp(month, jun)) return 6; - if (!wcsicmp(month, jul)) return 7; - if (!wcsicmp(month, aug)) return 8; - if (!wcsicmp(month, sep)) return 9; - if (!wcsicmp(month, oct)) return 10; - if (!wcsicmp(month, nov)) return 11; - if (!wcsicmp(month, dec)) return 12; + if (!wcsicmp(month, L"jan")) return 1; + if (!wcsicmp(month, L"feb")) return 2; + if (!wcsicmp(month, L"mar")) return 3; + if (!wcsicmp(month, L"apr")) return 4; + if (!wcsicmp(month, L"may")) return 5; + if (!wcsicmp(month, L"jun")) return 6; + if (!wcsicmp(month, L"jul")) return 7; + if (!wcsicmp(month, L"aug")) return 8; + if (!wcsicmp(month, L"sep")) return 9; + if (!wcsicmp(month, L"oct")) return 10; + if (!wcsicmp(month, L"nov")) return 11; + if (!wcsicmp(month, L"dec")) return 12; /* Invalid */ return 0; } @@ -4643,13 +4588,13 @@ static BOOL HTTP_ParseRfc1123Date(LPCWSTR value, FILETIME *ft) static WORD HTTP_ParseWeekday(LPCWSTR day) { - static const WCHAR days[7][10] = {{ 's','u','n','d','a','y',0 }, - { 'm','o','n','d','a','y',0 }, - { 't','u','e','s','d','a','y',0 }, - { 'w','e','d','n','e','s','d','a','y',0 }, - { 't','h','u','r','s','d','a','y',0 }, - { 'f','r','i','d','a','y',0 }, - { 's','a','t','u','r','d','a','y',0 }}; + static const WCHAR days[7][10] = {L"sunday", + L"monday", + L"tuesday", + L"wednesday", + L"thursday", + L"friday", + L"saturday"}; unsigned int i; for (i = 0; i < ARRAY_SIZE(days); i++) if (!wcsicmp(day, days[i])) diff --git a/dll/win32/wininet/internet.c b/dll/win32/wininet/internet.c index e70278ba045..baf939a0fa8 100644 --- a/dll/win32/wininet/internet.c +++ b/dll/win32/wininet/internet.c @@ -3296,12 +3296,12 @@ BOOL WINAPI InternetSetOptionExW(HINTERNET hInternet, DWORD dwOption, } static const WCHAR WININET_wkday[7][4] = - { { 'S','u','n', 0 }, { 'M','o','n', 0 }, { 'T','u','e', 0 }, { 'W','e','d', 0 }, - { 'T','h','u', 0 }, { 'F','r','i', 0 }, { 'S','a','t', 0 } }; + { L"Sun", L"Mon", L"Tue", L"Wed", + L"Thu", L"Fri", L"Sat"}; static const WCHAR WININET_month[12][4] = - { { 'J','a','n', 0 }, { 'F','e','b', 0 }, { 'M','a','r', 0 }, { 'A','p','r', 0 }, - { 'M','a','y', 0 }, { 'J','u','n', 0 }, { 'J','u','l', 0 }, { 'A','u','g', 0 }, - { 'S','e','p', 0 }, { 'O','c','t', 0 }, { 'N','o','v', 0 }, { 'D','e','c', 0 } }; + { L"Jan", L"Feb", L"Mar", L"Apr", + L"May", L"Jun", L"Jul", L"Aug", + L"Sep", L"Oct", L"Nov", L"Dec"}; /*********************************************************************** * InternetTimeFromSystemTimeA (WININET.@) diff --git a/dll/win32/wininet/urlcache.c b/dll/win32/wininet/urlcache.c index de0d21af24e..1a91d80d6a8 100644 --- a/dll/win32/wininet/urlcache.c +++ b/dll/win32/wininet/urlcache.c @@ -756,11 +756,7 @@ static void cache_container_delete_container(cache_container *pContainer) static void cache_containers_init(void) { - static const WCHAR UrlSuffix[] = {'C','o','n','t','e','n','t','.','I','E','5',0}; - static const WCHAR HistorySuffix[] = {'H','i','s','t','o','r','y','.','I','E','5',0}; - static const WCHAR CookieSuffix[] = {0}; /* ReactOS r50916 */ - static const WCHAR UserProfile[] = {'U','S','E','R','P','R','O','F','I','L','E',0}; static const struct { int nFolder; /* CSIDL_* constant */ @@ -769,14 +765,14 @@ static void cache_containers_init(void) DWORD default_entry_type; } DefaultContainerData[] = { - { CSIDL_INTERNET_CACHE, UrlSuffix, "", NORMAL_CACHE_ENTRY }, - { CSIDL_HISTORY, HistorySuffix, "Visited:", URLHISTORY_CACHE_ENTRY }, - { CSIDL_COOKIES, CookieSuffix, "Cookie:", COOKIE_CACHE_ENTRY }, + { CSIDL_INTERNET_CACHE, L"Content.IE5", "", NORMAL_CACHE_ENTRY }, + { CSIDL_HISTORY, L"History.IE5", "Visited:", URLHISTORY_CACHE_ENTRY }, + { CSIDL_COOKIES, L"", "Cookie:", COOKIE_CACHE_ENTRY }, }; DWORD i; /* ReactOS r50916 */ - if (GetEnvironmentVariableW(UserProfile, NULL, 0) == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND) + if (GetEnvironmentVariableW(L"USERPROFILE", NULL, 0) == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND) { ERR("Environment variable 'USERPROFILE' does not exist!\n"); return; diff --git a/sdk/tools/winesync/wininet.cfg b/sdk/tools/winesync/wininet.cfg index 70eed2c360e..0ddeaa60803 100644 --- a/sdk/tools/winesync/wininet.cfg +++ b/sdk/tools/winesync/wininet.cfg @@ -5,4 +5,4 @@ files: include/wininet.h: sdk/include/psdk/wininet.h include/winineti.h: sdk/include/psdk/winineti.h tags: - wine: 67295a7844b94ccbfce85dbee22a76f12c9f5b36 + wine: 085f3738a86e6fa0e12b3f59fa4a9ca86826bb60
3 years, 10 months
1
0
0
0
← Newer
1
...
6
7
8
9
10
11
12
...
15
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Results per page:
10
25
50
100
200