uNetworking / uWebSockets

Simple, secure & standards compliant web server for the most demanding of applications
Apache License 2.0
17.21k stars 1.75k forks source link

getenv is deprecated #1764

Closed maldag closed 1 month ago

maldag commented 1 month ago

Refering to this code https://github.com/uNetworking/uWebSockets/blob/27848ed1bae7a51044dfb05047d192a869e01105/src/HttpParser.h#L51

compiling with llvm 18.1.8 from msvc for windows results in the following warning:

...\uWebSockets\HttpParser.h(51,68): warning : 'getenv' is deprecated: This function or variable may be unsafe. Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
     51 | static const size_t MAX_FALLBACK_SIZE = (size_t) atoi(optional_ptr(getenv("UWS_HTTP_MAX_HEADERS_SIZE")).value_or((char *) "4096"));
        |                                                                    ^
  C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdlib.h(1183,20): note: 'getenv' has been explicitly marked deprecated here
   1183 |     _Check_return_ _CRT_INSECURE_DEPRECATE(_dupenv_s)
        |                    ^
  C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.40.33807\include\vcruntime.h(356,55): note: expanded from macro '_CRT_INSECURE_DEPRECATE'
    356 |         #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
        |                                                       ^
  C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.40.33807\include\vcruntime.h(346,47): note: expanded from macro '_CRT_DEPRECATE_TEXT'
    346 | #define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
        |                                               ^
  1 warning generated.

Is there a chance to get this fixed?

uNetworkingAB commented 1 month ago

https://github.com/uNetworking/uWebSockets/commit/8028beb3b8f4fb0868dc2dfa2c7a4fe0f21843b5