]> git.kaiwu.me - nginx.git/commitdiff
fix SSL connection issues on platforms with 32-bit off_t
authorIgor Sysoev <igor@sysoev.ru>
Fri, 22 Jul 2011 12:53:04 +0000 (12:53 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Fri, 22 Jul 2011 12:53:04 +0000 (12:53 +0000)
patch by Maxim Dounin

src/core/ngx_config.h
src/event/ngx_event_openssl.c

index ab73079a6ab0ab3a5daeac257d1f499d4d62a0ac..9762b18ca066ec918ba19f796bf795a2a3e2025e 100644 (file)
@@ -127,5 +127,7 @@ typedef intptr_t        ngx_flag_t;
 #define NGX_MAX_UINT32_VALUE  (uint32_t) 0xffffffff
 #endif
 
+#define NGX_MAX_INT32_VALUE   (uint32_t) 0x7fffffff
+
 
 #endif /* _NGX_CONFIG_H_INCLUDED_ */
index 29718174299fcc961811e08d166e9fc13f4bae71..692f50639992fb222b46b15cf965afe279e79633 100644 (file)
@@ -986,10 +986,10 @@ ngx_ssl_send_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
     }
 
 
-    /* the maximum limit size is the maximum uint32_t value - the page size */
+    /* the maximum limit size is the maximum int32_t value - the page size */
 
-    if (limit == 0 || limit > (off_t) (NGX_MAX_UINT32_VALUE - ngx_pagesize)) {
-        limit = NGX_MAX_UINT32_VALUE - ngx_pagesize;
+    if (limit == 0 || limit > (off_t) (NGX_MAX_INT32_VALUE - ngx_pagesize)) {
+        limit = NGX_MAX_INT32_VALUE - ngx_pagesize;
     }
 
     buf = c->ssl->buf;