libHttpClient provides a platform abstraction layer for HTTP and WebSocket, and is designed for use by the Microsoft Xbox Live Service API (XSAPI) [https://github.com/Microsoft/xbox-live-api] and game devs. If you want to contribute to the project, please talk to us to avoid overlap.
Перейти к файлу
Sebastian Perez-Delgado 44aa6f5d47
Fix for XcURL and cURL behavior differences. (#733)
* Add Linux build files and configure files to support LibHttpClient Linux

* resolving comments

Removed extern structs in .h file and moved them up where they were in pch_common to ensure they are defined properly

* added templates

* Update x509_cert_utilities.hpp

* Update x509_cert_utilities.hpp

change check to something defined by us

* Update x509_cert_utilities.hpp

fix error in pipeline where there are errors of an unused function.

* Update x509_cert_utilities.hpp

use elif and corrected to use else

* Update CurlEasyRequest.cpp

Fix to handle behavioral differences with cURL and XcURL

* Update CurlEasyRequest.cpp

have this be a fix/workaround for xCurl

---------

Co-authored-by: SebastianPD-XB <sebastianp@microsoft.com>
2023-03-16 12:56:53 -07:00
Build LibHttpClient Linux: Add Linux build files and configure files to support LibHC Linux. (#732) 2023-03-10 16:45:35 -08:00
External LibHttpClient Linux: Add Linux build files and configure files to support LibHC Linux. (#732) 2023-03-10 16:45:35 -08:00
Include LibHttpClient Linux: Add Linux build files and configure files to support LibHC Linux. (#732) 2023-03-10 16:45:35 -08:00
Samples Update WebSocket Sample to demonstrate proper WebSocket cleanup without using globals (#681) 2022-04-08 11:54:02 -07:00
Source Fix for XcURL and cURL behavior differences. (#733) 2023-03-16 12:56:53 -07:00
Tests Sync bug fixes from Microsoft OS repo (#673) 2022-03-09 14:57:34 -08:00
Utilities LibHttpClient Linux: Add Linux build files and configure files to support LibHC Linux. (#732) 2023-03-10 16:45:35 -08:00
.gitattributes Init 2017-06-12 00:31:32 -07:00
.gitignore Update OpenSSL and support M1 Macs (#602) 2021-08-23 15:31:08 -07:00
.gitmodules LibHttpClient Linux: Add Linux build files and configure files to support LibHC Linux. (#732) 2023-03-10 16:45:35 -08:00
CONTRIBUTING.md Init 2017-06-12 00:31:32 -07:00
LICENSE.md Init 2017-06-12 00:31:32 -07:00
NOTICE.txt adding NOTICE.txt to be in compliance (#666) 2022-02-10 15:19:22 -06:00
README.md Minor readme updates (#664) 2022-02-04 12:33:19 -08:00
SECURITY.md Microsoft mandatory file (#688) 2022-05-16 15:11:23 -07:00
ThirdPartyNotices.txt Adding 3pp notice file (#309) 2018-10-17 14:35:36 -07:00
build.root Add packagesRoot variable so that package properties are imported bas… (#207) 2018-07-24 15:20:42 -07:00
cgmanifest.json Add `$schema` to `cgmanifest.json` (#713) 2022-10-28 15:47:49 -07:00
custom.props Make libhttpclient.props and openssl.props provide MSBuild references to their projects (#248) 2018-08-16 14:09:34 -07:00
libHttpClient.props Add missing deps to props file for GDK (#646) 2021-12-09 12:22:45 -08:00
libHttpClient.vs2015.sln Adding support for VS toolset v143 (#644) 2021-12-03 15:04:19 -08:00
libHttpClient.vs2017.sln Adding support for VS toolset v143 (#644) 2021-12-03 15:04:19 -08:00
libHttpClient.vs2019.sln Proper handling of large incoming messages for WinHttp WebSockets (#653) 2022-01-18 12:04:21 -08:00
libHttpClient.vs2022.sln Adding support for VS toolset v143 (#644) 2021-12-03 15:04:19 -08:00
platform_select.props Remove Visual Studio Android builds (#591) 2021-07-14 14:15:16 -07:00

README.md

Welcome!

libHttpClient provides a platform abstraction layer for HTTP and WebSocket, and is designed for use by the Microsoft Xbox Live Service API (XSAPI), PlayFab SDKs, and game devs. If you want to contribute to the project, please talk to us to avoid overlap.

Goals

  • libHttpClient provides a platform abstraction layer for HTTP and WebSocket
  • Stock implementations that call native platform HTTP / WebSocket APIs on GDK, XDK ERA, Win32 Win7+, UWP, iOS, Android
  • Caller can add support for other platforms via callback API
  • Sample showing off an HTTP implementation via Curl via this callback
  • Designed around the needs of professional game developers that use Xbox Live and PlayFab
  • used by the Microsoft Xbox Live Service API (XSAPI) and PlayFab SDKs
  • Builds for GDK, XDK ERA, UWP, Win32 Win7+, iOS, and Android
  • Public API is a flat C API
  • Asynchronous API
  • Public API supports simple P/Invoke without needing to use the "C#/.NET P/Invoke Interop SDK" or C++/CLI
  • Public APIs to manage async tasks
  • Async data can be returned to a specific game thread so the game doesn't need to marshal the data between threads
  • No dependencies on PPL or Boost
  • Does not throw exceptions as a means of non-fatal error reporting
  • Caller controlled memory allocation via callback API (similar to GDK's XMemAlloc)
  • Built-in logging support to either debug output and/or callback
  • Built in retry support according to Xbox Live best practices (obey Retry-After header, jitter wait, etc) according to https://docs.microsoft.com/en-us/windows/uwp/xbox-live/using-xbox-live/best-practices/best-practices-for-calling-xbox-live#retry-logic-best-practices
  • Xbox Live throttle handling logic
  • Built-in API support to switch to mock layer
  • Open source project on GitHub
  • Unit tests via TAEF
  • End to end samples for UWP C++, XDK ERA, Win32, iOS, and Android

HTTP API Usage

See public header

  1. Optionally call HCMemSetFunctions() to control memory allocations
  2. Call HCInitialize()
  3. Optionally call HCSettingsSet*()
  4. Call HCHttpCallCreate() to create a new HCCallHandle
  5. Call HCHttpCallRequestSet*() to prepare the HCCallHandle
  6. Call HCHttpCallPerform() to perform an HTTP call using the HCCallHandle.
  7. The perform call is asynchronous, so the work will be done on a background thread which calls DispatchAsyncQueue( ..., AsyncQueueCallbackType_Work ). The results will return to the callback on the thread that calls DispatchAsyncQueue( ..., AsyncQueueCallbackType_Completion ).
  8. Call HCHttpCallResponseGet*() to get the HTTP response of the HCCallHandle
  9. Call HCHttpCallCloseHandle() to cleanup the HCCallHandle
  10. Repeat 4-8 for each new HTTP call
  11. Call HCCleanup() at shutdown before your memory manager set in step 1 is shutdown

Behavior control

  • On GDK, XDK ERA, UWP, iOS, and Android, HCHttpCallPerform() will call native platform APIs
  • Optionally call HCSetHttpCallPerformFunction() to do your own HTTP handling using HCHttpCallRequestGet*(), HCHttpCallResponseSet*(), and HCSettingsGet*()
  • See sample CustomHttpImplWithCurl for an example of how to use this callback to make your own HTTP implementation.

How to clone repo

This repo contains submodules. There are two ways to make sure you get submodules.

When initially cloning, make sure you use the "--recursive" option. i.e.:

git clone --recursive https://github.com/Microsoft/libHttpClient.git

If you already cloned the repo, you can initialize submodules with:

git submodule sync
git submodule update --init --recursive

Note that using GitHub's feature to "Download Zip" does not contain the submodules and will not properly build. Please clone recursively instead.

Contribute Back!

Is there a feature missing that you'd like to see, or have you found a bug that you have a fix for? Or do you have an idea or just interest in helping out in building the library? Let us know and we'd love to work with you. For a good starting point on where we are headed and feature ideas, take a look at our requested features and bugs.

Big or small we'd like to take your contributions back to help improve the libHttpClient for game devs.

Having Trouble?

We'd love to get your review score, whether good or bad, but even more than that, we want to fix your problem. If you submit your issue as a Review, we won't be able to respond to your problem and ask any follow-up questions that may be necessary. The most efficient way to do that is to open a an issue in our issue tracker.

Xbox Live GitHub projects

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.