Repository navigation
Conversation
Convert gai_strerrorW diagnostics to UTF-8 before passing them to the narrow HTTP error-reporting function. Guard both conversion calls and allocate space for the terminating NUL. Preserve gai_strerror on other platforms. Exercise the address-resolution error path with a loopback address and invalid service name in webready unit tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
UNICODEis defined on Windows,gai_strerrorresolves togai_strerrorW, which returnsWCHAR*. Passing that result to the HTTPerror-reporting function, which takes
const char*, does not compile.Add a file-local helper that converts the Windows error text to UTF-8 and
returns the existing narrow error text on other platforms. Use the helper
at the
getaddrinfofailure call site.The Windows conversion checks both sizing and conversion failures,
allocates room for the terminating NUL, and removes that terminator from
the returned string. It needs no additional Windows header or macro
definition.
Add a unit test for the HTTP address-resolution error path using a
loopback address and an invalid service name. It does not require an
external HTTP server and is enabled only in webready builds.
Testing
base_macpreset, includingwebready support, samples, unit tests, and warnings-as-errors: passed.
ctest --test-dir build-pr --output-on-failure: all 8 test suites passed.http.reportsAddressResolutionError: passed when run separately.clang-format --dry-run --Werroron the changed files andgit diff --check:passed.
Native Windows/MSVC validation with
UNICODEremains to be run; the Macbuild does not execute the Windows conversion branch.