aboutsummaryrefslogtreecommitdiff
path: root/src/os/win32
Commit message (Collapse)AuthorAge
* Win32: fixed unique file index calculations.Piotr Sikora2024-02-26
| | | | | | The old code was breaking strict aliasing rules. Signed-off-by: Piotr Sikora <piotr@aviatrix.com>
* Silenced complaints about socket leaks on forced termination.Maxim Dounin2024-01-29
| | | | | | | | | | | When graceful shutdown was requested, and then nginx was forced to do fast shutdown, it used to (incorrectly) complain about open sockets left in connections which weren't yet closed when fast shutdown was requested. Fix is to avoid complaining about open sockets when fast shutdown was requested after graceful one. Abnormal termination, if requested with the WINCH signal, can still happen though.
* Win32: extended ngx_random() range to 0x7fffffff.J Carter2023-12-09
| | | | | | | | rand() is used on win32. RAND_MAX is implementation defined. win32's is 0x7fff. Existing uses of ngx_random() rely upon 0x7fffffff range provided by POSIX implementations of random().
* QUIC: path MTU discovery.Roman Arutyunyan2023-08-14
| | | | | MTU selection starts by doubling the initial MTU until the first failure. Then binary search is used to find the path MTU.
* Merged with the default branch.Sergey Kandaurov2023-03-29
|\
| * Win32: non-ASCII names in ngx_fs_bsize(), ngx_fs_available().Maxim Dounin2023-02-23
| | | | | | | | | | This fixes potentially incorrect cache size calculations and non-working "min_free" when using cache in directories with non-ASCII names.
| * Win32: removed attempt to use a drive letter in ngx_fs_bsize().Maxim Dounin2023-02-23
| | | | | | | | | | | | | | | | | | | | Just a drive letter might not correctly represent file system being used, notably when using symlinks (as created by "mklink /d"). As such, instead of trying to call GetDiskFreeSpace() with just a drive letter, we now always use GetDiskFreeSpace() with full path. Further, it looks like the code to use just a drive letter never worked, since it tried to test name[2] instead of name[1] to be ':'.
| * Win32: non-ASCII names support in ngx_open_tempfile().Maxim Dounin2023-02-23
| | | | | | | | | | This makes it possible to use temporary directories with non-ASCII characters, either explicitly or via a prefix with non-ASCII characters in it.
| * Win32: non-ASCII names support in ngx_rename_file().Maxim Dounin2023-02-23
| | | | | | | | | | This makes it possible to upload files with non-ASCII characters when using the dav module (ticket #1433).
| * Win32: non-ASCII names support in ngx_delete_file().Maxim Dounin2023-02-23
| | | | | | | | | | This makes it possible to delete files with non-ASCII characters when using the dav module (ticket #1433).
| * Win32: reworked ngx_win32_rename_file() to use nginx wrappers.Maxim Dounin2023-02-23
| | | | | | | | | | | | | | | | This ensures that ngx_win32_rename_file() will support non-ASCII names when supported by the wrappers. Notably, this is used by PUT requests in the dav module when overwriting existing files with non-ASCII names (ticket #1433).
| * Win32: reworked ngx_win32_rename_file() to check errors.Maxim Dounin2023-02-23
| | | | | | | | | | | | | | | | Previously, ngx_win32_rename_file() retried on all errors returned by MoveFile() to a temporary name. It only make sense, however, to retry when the destination file already exists, similarly to the condition when ngx_win32_rename_file() is called. Retrying on other errors is meaningless and might result in an infinite loop.
| * Win32: non-ASCII directory names support in ngx_delete_dir().Maxim Dounin2023-02-23
| | | | | | | | | | This makes it possible to delete directories with non-ASCII characters when using the dav module (ticket #1433).
| * Win32: non-ASCII directory names support in ngx_create_dir().Maxim Dounin2023-02-23
| | | | | | | | | | | | | | | | | | | | | | | | This makes it possible to create directories under prefix with non-ASCII characters, as well as makes it possible to create directories with non-ASCII characters when using the dav module (ticket #1433). To ensure that the dav module operations are restricted similarly to other file operations (in particular, short names are not allowed), the ngx_win32_check_filename() function is used. It improved to support checking of just dirname, and now can be used to check paths when creating files or directories.
| * Win32: non-ASCII directory names support in ngx_getcwd().Maxim Dounin2023-02-23
| | | | | | | | | | This makes it possible to start nginx without a prefix explicitly set in a directory with non-ASCII characters in it.
| * Win32: non-ASCII names support in "include" with wildcards.Maxim Dounin2023-02-23
| | | | | | | | | | Notably, ngx_open_glob() now supports opening directories with non-ASCII characters, and pathnames returned by ngx_read_glob() are converted to UTF-8.
| * Win32: non-ASCII names support in autoindex (ticket #458).Maxim Dounin2023-02-23
| | | | | | | | | | | | Notably, ngx_open_dir() now supports opening directories with non-ASCII characters, and directory entries returned by ngx_read_dir() are properly converted to UTF-8.
* | Merged with the default branch.Sergey Kandaurov2022-12-15
|\|
| * Win32: event flags handling edge cases in ngx_wsarecv().Maxim Dounin2022-12-01
| | | | | | | | | | | | | | Fixed event flags handling edge cases in ngx_wsarecv() and ngx_wsarecv_chain(), notably to always reset rev->ready in case of errors (which wasn't the case after ngx_socket_nread() errors), and after EOF (rev->ready was not cleared if due to a misconfiguration a zero-sized buffer was used for reading).
| * Process events posted by ngx_close_idle_connections() immediately.Roman Arutyunyan2022-11-18
| | | | | | | | | | | | Previously, if an event was posted by a read event handler, called by ngx_close_idle_connections(), that event was not processed until the next event loop iteration, which could happen after a timeout.
* | Added shutdown macros for win32 required for QUIC.Sergey Kandaurov2022-11-22
|/
* Win32: disabled C4306 warnings with MSVC.Maxim Dounin2022-09-07
| | | | | | | | | Multiple C4306 warnings (conversion from 'type1' to 'type2' of greater size) appear during 64-bit compilation with MSVC 2010 (and older) due to extensively used constructs like "(void *) -1", so they were disabled. In newer MSVC versions C4306 warnings were replaced with C4312 ones, and these are not generated for such trivial type casts.
* Win32: removed misleading comment about warnings being disabled.Maxim Dounin2022-09-07
| | | | Warnings being disabled are not only from the "-W4" level since e4590dfd97ff.
* Win32: use only preallocated memory in send/recv chain functions.Ruslan Ermilov2021-07-05
| | | | | | The ngx_wsasend_chain() and ngx_wsarecv_chain() functions were modified to use only preallocated memory, and the number of preallocated wsabufs was increased to 64.
* Fixed format strings for ngx_win32_version.Maxim Dounin2021-06-18
|
* Cache: introduced min_free cache clearing.Maxim Dounin2020-06-22
| | | | | | | | | | | Clearing cache based on free space left on a file system is expected to allow better disk utilization in some cases, notably when disk space might be also used for something other than nginx cache (including nginx own temporary files) and while loading cache (when cache size might be inaccurate for a while, effectively disabling max_size cache clearing). Based on a patch by Adam Bambuch.
* Win32: silenced -Wcast-function-type GCC warning (ticket #1865).Maxim Dounin2019-10-21
| | | | | | | With MinGW-w64, building 64-bit nginx binary with GCC 8 and above results in warning due to cast of GetProcAddress() result to ngx_wsapoll_pt, which GCC thinks is incorrect. Added intermediate cast to "void *" to silence the warning.
* Win32: improved fallback on FormatMessage() errors.Maxim Dounin2019-10-21
| | | | | | | | | | | | FormatMessage() seems to return many errors which essentially indicate that the language in question is not available. At least the following were observed in the wild and during testing: ERROR_MUI_FILE_NOT_FOUND (15100) (ticket #1868), ERROR_RESOURCE_TYPE_NOT_FOUND (1813). While documentation says it should be ERROR_RESOURCE_LANG_NOT_FOUND (1815), this doesn't seem to be the case. As such, checking error code was removed, and as long as FormatMessage() returns an error, we now always try the default language.
* Events: available bytes calculation via ioctl(FIONREAD).Maxim Dounin2019-10-17
| | | | | | | | | | | | | | | | | | | | | This makes it possible to avoid looping for a long time while working with a fast enough peer when data are added to the socket buffer faster than we are able to read and process them (ticket #1431). This is basically what we already do on FreeBSD with kqueue, where information about the number of bytes in the socket buffer is returned by the kevent() call. With other event methods rev->available is now set to -1 when the socket is ready for reading. Later in ngx_recv() and ngx_recv_chain(), if full buffer is received, real number of bytes in the socket buffer is retrieved using ioctl(FIONREAD). Reading more than this number of bytes ensures that even with edge-triggered event methods the event will be triggered again, so it is safe to stop processing of the socket and switch to other connections. Using ioctl(FIONREAD) only after reading a full buffer is an optimization. With this approach we only call ioctl(FIONREAD) when there are at least two recv()/readv() calls.
* Win32: added WSAPoll() support.Maxim Dounin2019-01-24
| | | | | | | | | | | | WSAPoll() is only available with Windows Vista and newer (and only available during compilation if _WIN32_WINNT >= 0x0600). To make sure the code works with Windows XP, we do not redefine _WIN32_WINNT, but instead load WSAPoll() dynamically if it is not available during compilation. Also, sockets are not guaranteed to be small integers on Windows. So an index array is used instead of NGX_USE_FD_EVENT to map events to connections.
* Win32: removed NGX_DIR_MASK concept.Maxim Dounin2018-12-24
| | | | | | | | | | | | Previous interface of ngx_open_dir() assumed that passed directory name has a room for NGX_DIR_MASK at the end (NGX_DIR_MASK_LEN bytes). While all direct users of ngx_dir_open() followed this interface, this also implied similar requirements for indirect uses - in particular, via ngx_walk_tree(). Currently none of ngx_walk_tree() uses provides appropriate space, and fixing this does not look like a right way to go. Instead, ngx_dir_open() interface was changed to not require any additional space and use appropriate allocations instead.
* Win32: fixed comment in ngx_gettimeofday() calculations.Ruslan Ermilov2018-05-29
|
* Fixed "changing binary" when reaper is not init.Ruslan Ermilov2017-11-28
| | | | | | | | | On some systems, it's possible that reaper of orphaned processes is set to something other than "init" process. On such systems, the changing binary procedure did not work. The fix is to check if PPID has changed, instead of assuming it's always 1 for orphaned processes.
* Style.Sergey Kandaurov2017-08-09
|
* Introduced worker_shutdown_timeout.Maxim Dounin2017-03-07
| | | | | | The directive configures a timeout to be used when gracefully shutting down worker processes. When the timer expires, nginx will try to close all the connections currently open to facilitate shutdown.
* Cancelable timers are now preserved if there are other timers.Maxim Dounin2017-03-07
| | | | | | | | | There is no need to cancel timers early if there are other timers blocking shutdown anyway. Preserving such timers allows nginx to continue some periodic work till the shutdown is actually possible. With the new approach, timers with ev->cancelable are simply ignored when checking if there are any timers left during shutdown.
* Win32: compatiblity with OpenSSL 1.1.0.Maxim Dounin2016-12-24
| | | | | | | | | | | | | OpenSSL 1.1.0 now uses normal "nmake; nmake install" instead of using custom "ms\do_ms.bat" script and "ms\nt.mak" makefile. And Configure now requires --prefix to be absolute, and no longer derives --openssldir from prefix (so it's specified explicitly). Generated libraries are now called "libcrypto.lib" and "libssl.lib" instead of "libeay32.lib" and "ssleay32.lib". Appropriate tests added to support both old and new variants. Additionally, openssl/lhash.h now triggers warning C4090 ('function' : different 'const' qualifiers), so the warning was disabled.
* Win32: support 64-bit compilation with MSVC.Maxim Dounin2016-12-24
| | | | | | | | | | | | | | | | | | | | | | | There are lots of C4244 warnings (conversion from 'type1' to 'type2', possible loss of data), so they were disabled. The same applies to C4267 warnings (conversion from 'size_t' to 'type', possible loss of data), most notably - conversion from ngx_str_t.len to ngx_variable_value_t.len (which is unsigned:28). Additionally, there is at least one case when it is not possible to fix the warning properly without introducing win32-specific code: recv() on win32 uses "int len", while POSIX defines "size_t len". The ssize_t type now properly defined for 64-bit compilation with MSVC. Caught by warning C4305 (truncation from '__int64' to 'ssize_t'), on "cutoff = NGX_MAX_SIZE_T_VALUE / 10" in ngx_atosz()). Several C4334 warnings (result of 32-bit shift implicitly converted to 64 bits) were fixed by adding explicit conversions. Several C4214 warnings (nonstandard extension used: bit field types other than int) in ngx_http_script.h fixed by changing bit field types from uintptr_t to unsigned.
* Win32: fixed some warnings reported by Borland C.Maxim Dounin2016-12-24
| | | | | | | | | Most notably, warning W8012 (comparing signed and unsigned values) reported in multiple places where an unsigned value of small type (e.g., u_short) is promoted to an int and compared to an unsigned value. Warning W8072 (suspicious pointer arithmetic) disabled, it is reported when we increment base pointer in ngx_shm_alloc().
* Win32: minimized redefinition of ssize_t.Maxim Dounin2016-12-24
| | | | | All variants of GCC have ssize_t available, there is no need to redefine it.
* Win32: minimized redefinition of intptr_t/uintptr_t.Maxim Dounin2016-12-24
| | | | | | These types are available with MSVC (at least since 2003, in stddef.h), all variants of GCC (in stdint.h) and Watcom C. We need to define them only for Borland C.
* Win32: stdint.h used for MinGW GCC.Maxim Dounin2016-12-24
| | | | | There is no need to restrict stdint.h only to MinGW-w64 GCC, it is available with MinGW GCC as well.
* Win32: fixed building with newer versions of MinGW GCC.Maxim Dounin2016-12-24
| | | | | Macro to indicate that off_t was defined has been changed, so we now additionally define the new one.
* Cache: cache manager limits.Dmitry Volyntsev2016-10-05
| | | | | | | | | The new parameters "manager_files", "manager_sleep" and "manager_threshold" were added to proxy_cache_path and friends. Note that ngx_path_manager_pt was changed to return ngx_msec_t instead of time_t (API change).
* Stream: filters.Roman Arutyunyan2016-09-15
|
* Always seed PRNG with PID, seconds, and milliseconds.Ruslan Ermilov2016-08-04
|
* Win32: added per-thread random seeding.Ruslan Ermilov2016-08-04
| | | | | | | | | The change in b91bcba29351 was not enough to fix random() seeding. On Windows, the srand() seeds the PRNG only in the current thread, and worse, is not inherited from the calling thread. Due to this, worker threads were not properly seeded. Reported by Marc Bevand.
* Removed redundant "u" format specifier.Ruslan Ermilov2016-04-08
| | | | It is implied for "x" and "X".
* Fixed spelling.Josh Soref2016-04-07
|
* Fixed ngx_os_signal_process() prototype.Ruslan Ermilov2016-03-31
|