diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2017-07-03 14:51:51 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2017-07-03 14:53:08 +0300 |
commit | fb63a0aa3388430545c7857e72251fc52eb85b1c (patch) | |
tree | 2109d831a56ea05eb02ea6eba730b85c0dbbb5f9 /src | |
parent | 5aa8db0148e7f59979122b34155a30885f4eb91e (diff) | |
download | postgresql-fb63a0aa3388430545c7857e72251fc52eb85b1c.tar.gz postgresql-fb63a0aa3388430545c7857e72251fc52eb85b1c.zip |
Treat clean shutdown of an SSL connection same as the non-SSL case.
If the client closes an SSL connection, treat it the same as EOF on a
non-SSL connection. In particular, don't write a message in the log about
that.
Michael Paquier.
Discussion: https://www.postgresql.org/message-id/CAB7nPqSfyVV42Q2acFo%3DvrvF2gxoZAMJLAPq3S3KkjhZAYi7aw@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/libpq/be-secure.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/backend/libpq/be-secure.c b/src/backend/libpq/be-secure.c index 8a435e28dfd..dc226f2fbca 100644 --- a/src/backend/libpq/be-secure.c +++ b/src/backend/libpq/be-secure.c @@ -298,11 +298,13 @@ rloop: ereport(COMMERROR, (errcode(ERRCODE_PROTOCOL_VIOLATION), errmsg("SSL error: %s", SSLerrmessage(ecode)))); - /* fall through */ - case SSL_ERROR_ZERO_RETURN: errno = ECONNRESET; n = -1; break; + case SSL_ERROR_ZERO_RETURN: + /* connection was cleanly shut down by peer */ + n = 0; + break; default: ereport(COMMERROR, (errcode(ERRCODE_PROTOCOL_VIOLATION), @@ -423,8 +425,14 @@ wloop: ereport(COMMERROR, (errcode(ERRCODE_PROTOCOL_VIOLATION), errmsg("SSL error: %s", SSLerrmessage(ecode)))); - /* fall through */ + errno = ECONNRESET; + n = -1; + break; case SSL_ERROR_ZERO_RETURN: + /* + * the SSL connnection was closed, leave it to the caller + * to ereport it + */ errno = ECONNRESET; n = -1; break; |