Upstream: flush low-level buffers on write retry.

If the data to write is bigger than what the socket can send and the
reminder is smaller than NGX_SSL_BUFSIZE, then SSL_write() fails with
SSL_ERROR_WANT_WRITE. The reminder of payload however is successfully
copied to the low-level buffer and all the output chain buffers are
flushed. This means that retry logic doesn't work because
ngx_http_upstream_process_non_buffered_request() checks only if there's
anything in the output chain buffers and ignores the fact that something
may be buffered in low-level parts of the stack.

Change-Id: I7ae8279dd3f95e69853e83ab14a707e30efe66a8
Signed-off-by: Patryk Lesiewicz <patryk@google.com>
Reviewed-on: https://nginx-review.googlesource.com/3260
Reviewed-by: Piotr Sikora <piotrsikora@google.com>
1 file changed
tree: 6d37cf1cc0a22f841ef3799ed8d1b44588832745
  1. auto/
  2. conf/
  3. contrib/
  4. docs/
  5. misc/
  6. src/
  7. .hgtags
  8. BUILD
  9. build.bzl
  10. LICENSE
  11. README.md
  12. WORKSPACE
README.md

About

NGINX + BoringSSL + Brotli.

Building

To build nginx binary with Bazel:

$ bazel build :nginx

To build Debian package:

$ bazel build :nginx-google.deb

Contributing

This repository is currently maintained by Google developers.

Any code changes should be submitted to upstream NGINX.

License

Copyright (C) 2002-2017 Igor Sysoev
Copyright (C) 2011-2017 Nginx, Inc.
Copyright (C) 2015-2017 Google Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.

Disclaimer

This is not an official Google product.