Граф коммитов

722 Коммитов

Автор SHA1 Сообщение Дата
Andy McCalib e92f01eef1
Miscellaneous readme updates (#848) 2024-11-15 15:14:20 -08:00
Alonso Mondal 1344f2e9a8
Adding compiler and linker options to make LHC vulcan ready (#845)
* adding compiler and linker options to make lhc vulcan ready
2024-11-05 11:10:54 -06:00
John L a009d3d5ec
Allow multiple trace client callbacks (#844)
* Allow multiple trace client callbacks
2024-10-21 12:03:17 -07:00
Fernando C 9aa521a60c
Resolving Bin Skim Warning : BA2024 (#842)
* adding qspectre flag to release

* applying qspectre flag to all platforms
2024-09-11 10:40:47 -07:00
John L dd64f4c94c
Add missing sal definition (#840) 2024-07-24 12:38:24 -07:00
Alonso Mondal 8f99bdde2f
Updating WDK version for builds on Scarlett (#839)
* updating windows sdk to 10.0.26100.0
2024-07-16 15:44:31 -06:00
John L e048d58ba9
Fix possible crashes caused by CurlMulti::Perform running after cleanup (#834)
* Harden logic in CurlMulti::CleanupAsync to ensure that the CurlMulti::Perform XTaskQueue callback is never executed after the CurlMulti is destroyed.  Based on inspection, I've made two separate fixes that address two possible ways this could happen:
  1) Add synchronization between CurlMulti::CleanupAsync and CurlMulti::AddRequest.  Right now, thread A could call CleanupAsync, grab m_mutex, see that m_easyRequests is empty, and thus proceed with cleanup immediately.  At the same time, thread B could call AddRequest, which adds to m_easyRequests and schedules an asynchronous Perform callback.  That Perform callback could then execute after the CurlMulti is destroyed and cause a crash.
  2) The only other place CurlMulti::Perform is scheduled is in Perform itself - if the call to curl_multi_perform indicates there are still running handles, it will reschedule another Perform callback.  Before doing so however, it processes Curl messages with curl_multi_info_read and removes from m_easyHandles any requests that have completed. I haven't confirmed this is possible, but if curl_multi_perform indicated that there were running handles while m_easyRequests were empty, CurlMulti::Cleanup could destroy the CurlMulti while there is still a pending Perform callback.  To make this slightly more robust, I've changed CurlMulti::Cleanup to explicitly track and await pending Perform callbacks.
2024-07-10 12:32:27 -07:00
Sebastian Perez-Delgado d1792c00ce
Update httpcall.cpp (#837)
ensure encodingHeaderValue is initialized to not set off compiler warnings
2024-07-08 16:59:23 -07:00
Brian Pepin fa69a0363e
Remove magic statics for timerqueue (#836)
waittimer uses a global timerqueue object. But timerqueue's dtor destroys a thread, which has allocated resources. This can cause conflicts with other static / global destructors in the system. We should not be using "magic statics" to do complex things like freeing dynamic memory.

This changes the global timerqueue to a shared_ptr. In the destructor for waittimer, it checks the shared pointer usage count and is this is the last wait timer, it will free the global shared pointer. This causes the thread deallocation to happen when the last task queue is closed instead of happening post-main in crt cleanup.

Tested with a repro that exposed the magic static fragility (crash in custom global new operator). Verified all works and no leaks post change (thanks Sebastian Perez-Delgado).
2024-07-08 15:06:27 -07:00
Fernando C 180df387e4
Editing Decompression Comments (#835)
* Modify decompression check comments
2024-07-01 08:47:04 -07:00
Fernando C 2cdbb72af5
Add check to skip decompression for Mac+iOS responses with gzip (#833) 2024-06-27 15:36:19 -07:00
Sahil Ashar c1ef700a12
Optimize Linux Builds by Checking for Previously Generated Bins (#832) 2024-06-24 14:52:28 -07:00
Fernando C 205fa26d4b
Checking Content-Encoding Header (#828)
Adding logic to response decompression. Checking to see if  a received response has been encoding using gzip by examining Content-Encoding header (if response compression is set within HCCallHandle prior to sending a request and gzip compression is enabled). Response decompression has been tested within Win32-Http Sample.
2024-05-31 15:07:01 -07:00
Fernando C 3ca2c202ed
Increasing Compiler Warning Levels (#829)
* increasing compiler warning level + reverting 4244 and 4267 warning supression

* removing changes to libHttpClient.Win32.Shared.vcxitems
2024-05-31 09:25:13 -07:00
Raul Gomez Rodriguez 1489074274
Adding ZLIB source files to Linux CMakeLists (#827)
Co-authored-by: Raul Gomez <raulalbertog@microsoft.com>
2024-05-15 15:52:04 -06:00
Raul Gomez Rodriguez 93776efbd2
Adding missing ioapi.c to Android (#826)
Co-authored-by: Raul Gomez Rodriguez <raulalbertog@microsoft.com>
2024-05-14 17:46:38 -06:00
Raul Gomez Rodriguez 3e15e834f6
Updating toolset for DLLs (#824)
* Adding PlatformToolset

* Updating toolset like XAL

* Removing HCLibToolset from import props

* Updating toolset for VS2022

---------

Co-authored-by: Raul Gomez Rodriguez <raulalbertog@microsoft.com>
2024-05-07 11:36:22 -06:00
Nassos Terzakis e607b19f90
Enabling gzip on Sony (#823) 2024-05-06 11:54:42 -07:00
Raul Gomez Rodriguez 92f458e88b
Adding ZLIB source files to Android Workspace (#822)
* Adding ZLIB Source

* Building zlib inside libHttpClient main module

* Removing std=c++17 flag for C files

* Adding std=c++17 flag to Linux CMakelists.txt

---------

Co-authored-by: Raul Gomez Rodriguez <raulalbertog@microsoft.com>
2024-05-03 12:29:11 -06:00
Fernando C 7323b4e707
Enable Gzip Response Decompression (#815)
* decompression WIP

* comments...custom write functions

* adding test file

* attempting to push

* switch to main

* preparing to push

* wip

* Adding test json

* Revert "wip"

This reverts commit 723cebe905.

* Remove TestContent-2.json

* removing comments

* removing comments

* remove comments

* renaming HCHttpCallSetCompressedResponse

* attempting to fix build

* attempt to fix iOS build

* adding logic to handle custom write callbacks

* Minor Edits

* Minor Edits

* address nit

* removing Temporary callback apis, renaming callback holder fields

* moving new apis to bottom of .exp and .def files

* removing newlines

* removing spaces

* adding comment to httpcall.h

* invoking custom response callback

* adding newline brackets

* renaming api, fixing build

* removing secret key

* minor edit

* update custom callback reset comments

* added test for custom write flow

* removing my title secret key

* minor edit

* fixing build

* fixing build, adding custom write function wrapper

* minor edits
2024-05-01 16:29:11 -07:00
Raul Gomez Rodriguez 80b7da9edd
Updating props file for XSAPI GDK Migration to LHC dll (#820)
* Updating props and defs files for XSAPI Migration to LHC dll

* Reversing LHC changes and updating libHttpClient.import.props

* Reverting props file change

---------

Co-authored-by: Raul Gomez Rodriguez <raulalbertog@microsoft.com>
2024-04-29 16:03:34 -06:00
Sahil Ashar 565b98f779
Remove Linux Static Lib Prefix (#819) 2024-04-25 21:44:49 -07:00
Sebastian Perez-Delgado 75224f9fdd
add static option to libHC linux (#818)
* add static option to libHC linux

* Add static library build task
2024-04-24 10:25:05 -07:00
Brian Pepin fda5d4ecdb
Fix subtle race in task queue (#817)
The task queue has a narrow race: if a future callback is evaluated just when the task queue is terminated it may get skipped from termination processing. The result is that a call for the future won't be canceled immediately when the task queue terminates. Instead it will be canceled when its due time occurs.

There is a second possible race as well. If a new future callback is scheduled and the schedule code is interleaved with a terminate call on another thread, the same thing can occur.

This change fixes both cases. It also fixes up some incorrect macros in the test projects so they can build again.
2024-04-22 13:26:43 -07:00
jiwyoo 470d97cffe
Compression for linux and android (#812)
* Enabling compression for Linux and Android

* add zlib to lhc linux

---------

Co-authored-by: Raul Gomez Rodriguez <raulalbertog@microsoft.com>
2024-04-04 13:31:43 -04:00
Fernando Cisneros Trujillo 77675ec8ad
unsupress warnings 4267 and 4244 (#813)
* removed warning suppression and lowered WarningLevels

* removed unnecessary WarningLevel tags

* minor edit
2024-04-04 09:54:58 -07:00
John L ac24d559eb
Fix hc_settings.props build customizations (#811)
When projects were refactored to support building shared library versions of LHC, the import of libHttpClient.props was removed from many of the libHttpClient projects as it incorrectly pulls in project references to the static lib projects and causes linker errors. That props file historically served a weird dual purpose: its used by clients of LHC to add references to libHttpClient projects, but it was also imported by libHttpClient projects, defining several customizable properties used to build the libHttpClient lib (see readme for details). While most of libHttpClient.props is no longer needed by libHttpClient lib projects, we still should be pulling in the client's hc_settings.props customizations.

This PR does two things: 1) update libHttpClient.Common.vcxitems to pull in hc_settings.props and add any build customizations it specifies, and 2) remove libHttpClient.props from the remaining libHttpClient lib projects since several were missed previously.
2024-03-29 13:17:10 -07:00
David Westen e9c9037c42
Make ws proxy aware on apple platforms (#808) 2024-03-11 18:46:03 -07:00
Luca Beltrami 416350edb1
Include new header in apple frameworks (#810) 2024-03-07 13:07:17 -08:00
Luca Beltrami e169f59ef6
Use less `#if` to handle `HC_NOZLIB` also fix `HC_NOWEBSOCKET` (#809)
* Use less `#if` to handle `HC_NOZLIB` also fix `HC_NOWEBSOCKET`

* Cleanup handling of include overrides (win32)

* remove HC_PLATFORM_GRTS and fix android build

* CR feedback
2024-03-05 13:05:52 -08:00
jiwyoo 44bea21eea
remove "lib" prefix (#807) 2024-02-26 16:52:39 -05:00
jiwyoo fc7d658afe
Build option for shared and static + revert build flavors (#806)
* build option for shared and static + revert build flavors

* readme update

* keep log lib

* remove log lib
2024-02-23 19:52:20 -05:00
jiwyoo dedf0d7311
binskim changes for android (#805) 2024-02-22 15:36:04 -05:00
Jason Sandlin a834cde839
Adding BIND_NOW flag to linux binary as recommended by BinSkim (#804) 2024-02-21 15:58:04 -08:00
John L a6dbd70da3
Fix curl config linux (#803)
Build libcurl with --without-zlib flag on linux as its not needed and causes linking errors when linking LHC shared library into title.
2024-02-20 10:41:52 -08:00
Alonso Mondal 112ebe7ce1
adding missing fix to GDK 141 build tools props path (#802) 2024-02-16 17:25:32 -06:00
Alonso Mondal 78ff4345b4
added missing fix to path to vcxitems in 141 (#801) 2024-02-16 01:29:40 -06:00
John L efc1eb8f43
Switch to shared library for linux (#800)
* Change LHC to be a shared library on Linux, exposing only methods specified in libHttpClientExports.txt
* Updates lib name and output paths to be consistent with other platforms
2024-02-15 13:25:10 -08:00
John L d51b933e6c
Allocator fixes, sln build configuration fixes (#799)
* Fix some stray allocations that weren't properly using the custom allocators
* Fix .sln build configuration so that GDK projects aren't set to build when Platform=x86/x64 and vice versa
2024-02-12 21:05:17 -08:00
John L 19640c56ec
Update preprocessor macros for zlib files (#798) 2024-02-07 16:40:45 -08:00
Raul Gomez Rodriguez 72360809a9
Adding missing symbols (#797)
Co-authored-by: raulalbertog <raulalbertog@microsoft.com>
2024-02-07 16:41:42 -06:00
jiwyoo cd1cff4339
Change LHC android to shared object (#796)
* Change LHC to .so for android

* regen wrapper for 6.6
2024-02-07 13:35:57 -05:00
Raul Gomez Rodriguez b90da727b9
Fixing linking issues (#794)
Co-authored-by: raulalbertog <raulalbertog@microsoft.com>
2024-01-29 12:53:38 -06:00
John L 7d77de0a6e
Remove inline method from def file (#793) 2024-01-18 21:46:50 -08:00
John L da9c0b4933
Properly honor the subprotocol specificied in HCWebSocketConnect (#792)
WebSocket subprotocol parameter is ignored in WinHttp WebSocket stack. If specified, this should set the "Sec-WebSocket-Protocol" header during the connect.
2024-01-16 10:06:14 -08:00
John L da127510a1
Adding build material for windows dlls and updating samples (#791)
* Add project files for libHttpClient.GDK.dll and libHttpClient.Win32.dll
* Add props file libHttpClient.import.props which adds references to the appropriate lhc projects.  By default, it will add a reference to the dll project, but this can be overridden by specifying the build property HCStaticLib=true prior to importing the props file.  The existing libHttpClient.props file will continue to add references to the old static lib projects as to not break existing clients.
2024-01-12 16:08:12 -08:00
Jason Sandlin 515c5d1f02
Fixing OpenSSL build permission denied error (#790) 2023-12-05 10:35:59 -08:00
Jason Sandlin 1d08c9e939
Fixng OpenSSL build script so it creates and checks install folders (#789)
* Fixng OpenSSL build script so it creates and checks install folders

* PR

* Fixing build
2023-11-30 14:05:07 -08:00
John L 48a8cc3636
Fix crash caused by race condition in WinHttp teardown (#788)
Upon receiving a suspend event, the WinHttp provider will automatically tear down any active WebSocket connections. Depending on the current state of the connection, the suspend handler will either call WinHttpWebSocketClose followed by WinHttpCloseHandle, or just call WinHttpCloseHandle directly. If we receive a WinHttp disconnect callback at the same time, the disconnect handler will call WinHttpCloseHandle. This leads to race condition between the two handlers:

If the suspend handler runs first and determines that it needs to call WinHttpWebSocketClose (because at that point we believe the WebSocket is still connected) and then the disconnect handler runs and calls WinHttpCloseHandle BEFORE the suspend handler actually calls WinHttpWebSocketClose, the WinHttp handle may be in an invalid state when WebSocketClose finally gets called, leading to a crash.

The fix here involves a couple things. First, I updated the suspend handler to forego the call to WinHttpWebSocketClose altogether. This means that during suspend the WebSocket won't be torn down gracefully, but it greatly simplifies the LHC teardown process. Second, there is some additional logic needed to make sure that LHC still raises a disconnected event to clients during suspend, as the flow will change slightly with the removal of the WinHttpWebSocketClose call.

This change also contains a fix for a debug assert due to buffer size in FormatTrace
2023-11-14 15:35:00 -08:00
tculotta ffe0ee95aa
fix crash when large buffers are sent through HCTrace (#787) 2023-11-13 10:30:40 -08:00