Commit cf925122 authored by Wandenberg Peixoto's avatar Wandenberg Peixoto

adding patch to test reading under https, to detect when subscriber goes off

parent 126108e9
--- src/http/ngx_http_request.c 2010-07-05 10:35:20.000000000 -0300
+++ src/http/ngx_http_request.c 2011-09-25 23:44:21.053529001 -0300
@@ -2323,7 +2323,15 @@
#endif
+#if (NGX_HTTP_SSL)
+ if (c->ssl != NULL) {
+ n = SSL_peek(c->ssl->connection, buf, 1);
+ } else {
+ n = recv(c->fd, buf, 1, MSG_PEEK);
+ }
+#else
n = recv(c->fd, buf, 1, MSG_PEEK);
+#endif
if (n == 0) {
rev->eof = 1;
@@ -2333,9 +2341,19 @@
goto closed;
} else if (n == -1) {
- err = ngx_socket_errno;
+#if (NGX_HTTP_SSL)
+ if (c->ssl != NULL) {
+ err = SSL_get_error(c->ssl->connection, n);
+ } else {
+ err = ngx_socket_errno;
+ }
+
+ if ((err != NGX_EAGAIN) && (err != SSL_ERROR_WANT_READ) && (err != SSL_ERROR_WANT_WRITE)) {
+#else
+ err = ngx_socket_errno;
- if (err != NGX_EAGAIN) {
+ if (err != NGX_EAGAIN) {
+#endif
rev->eof = 1;
c->error = 1;
--- src/http/ngx_http_request.c 2010-12-06 09:11:05.000000000 -0200
+++ src/http/ngx_http_request.c 2011-09-30 22:44:39.395845002 -0300
@@ -2327,7 +2327,15 @@
#endif
+#if (NGX_HTTP_SSL)
+ if (c->ssl != NULL) {
+ n = SSL_peek(c->ssl->connection, buf, 1);
+ } else {
+ n = recv(c->fd, buf, 1, MSG_PEEK);
+ }
+#else
n = recv(c->fd, buf, 1, MSG_PEEK);
+#endif
if (n == 0) {
rev->eof = 1;
@@ -2337,9 +2345,19 @@
goto closed;
} else if (n == -1) {
- err = ngx_socket_errno;
+#if (NGX_HTTP_SSL)
+ if (c->ssl != NULL) {
+ err = SSL_get_error(c->ssl->connection, n);
+ } else {
+ err = ngx_socket_errno;
+ }
+
+ if ((err != NGX_EAGAIN) && (err != SSL_ERROR_WANT_READ) && (err != SSL_ERROR_WANT_WRITE)) {
+#else
+ err = ngx_socket_errno;
- if (err != NGX_EAGAIN) {
+ if (err != NGX_EAGAIN) {
+#endif
rev->eof = 1;
c->error = 1;
--- src/http/ngx_http_request.c 2011-01-20 08:37:58.000000000 -0200
+++ src/http/ngx_http_request.c 2011-09-30 22:55:09.935845001 -0300
@@ -2332,7 +2332,15 @@
#endif
+#if (NGX_HTTP_SSL)
+ if (c->ssl != NULL) {
+ n = SSL_peek(c->ssl->connection, buf, 1);
+ } else {
+ n = recv(c->fd, buf, 1, MSG_PEEK);
+ }
+#else
n = recv(c->fd, buf, 1, MSG_PEEK);
+#endif
if (n == 0) {
rev->eof = 1;
@@ -2342,9 +2350,19 @@
goto closed;
} else if (n == -1) {
- err = ngx_socket_errno;
+#if (NGX_HTTP_SSL)
+ if (c->ssl != NULL) {
+ err = SSL_get_error(c->ssl->connection, n);
+ } else {
+ err = ngx_socket_errno;
+ }
+
+ if ((err != NGX_EAGAIN) && (err != SSL_ERROR_WANT_READ) && (err != SSL_ERROR_WANT_WRITE)) {
+#else
+ err = ngx_socket_errno;
- if (err != NGX_EAGAIN) {
+ if (err != NGX_EAGAIN) {
+#endif
rev->eof = 1;
c->error = 1;
--- src/http/ngx_http_request.c 2011-08-29 09:45:03.000000000 -0300
+++ src/http/ngx_http_request.c 2011-09-30 23:59:43.265845001 -0300
@@ -2335,7 +2335,15 @@
#endif
+#if (NGX_HTTP_SSL)
+ if (c->ssl != NULL) {
+ n = SSL_peek(c->ssl->connection, buf, 1);
+ } else {
+ n = recv(c->fd, buf, 1, MSG_PEEK);
+ }
+#else
n = recv(c->fd, buf, 1, MSG_PEEK);
+#endif
if (n == 0) {
rev->eof = 1;
@@ -2345,9 +2353,19 @@
goto closed;
} else if (n == -1) {
- err = ngx_socket_errno;
+#if (NGX_HTTP_SSL)
+ if (c->ssl != NULL) {
+ err = SSL_get_error(c->ssl->connection, n);
+ } else {
+ err = ngx_socket_errno;
+ }
+
+ if ((err != NGX_EAGAIN) && (err != SSL_ERROR_WANT_READ) && (err != SSL_ERROR_WANT_WRITE)) {
+#else
+ err = ngx_socket_errno;
- if (err != NGX_EAGAIN) {
+ if (err != NGX_EAGAIN) {
+#endif
rev->eof = 1;
c->error = 1;
--- src/http/ngx_http_request.c 2011-10-01 00:27:17.895845001 -0300
+++ src/http/ngx_http_request.c 2011-10-01 00:15:46.055845002 -0300
@@ -2353,7 +2353,15 @@
#endif
+#if (NGX_HTTP_SSL)
+ if (c->ssl != NULL) {
+ n = SSL_peek(c->ssl->connection, buf, 1);
+ } else {
+ n = recv(c->fd, buf, 1, MSG_PEEK);
+ }
+#else
n = recv(c->fd, buf, 1, MSG_PEEK);
+#endif
if (n == 0) {
rev->eof = 1;
@@ -2363,9 +2371,19 @@
goto closed;
} else if (n == -1) {
- err = ngx_socket_errno;
+#if (NGX_HTTP_SSL)
+ if (c->ssl != NULL) {
+ err = SSL_get_error(c->ssl->connection, n);
+ } else {
+ err = ngx_socket_errno;
+ }
+
+ if ((err != NGX_EAGAIN) && (err != SSL_ERROR_WANT_READ) && (err != SSL_ERROR_WANT_WRITE)) {
+#else
+ err = ngx_socket_errno;
- if (err != NGX_EAGAIN) {
+ if (err != NGX_EAGAIN) {
+#endif
rev->eof = 1;
c->error = 1;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment