yahns Ruby server user/dev discussion
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: yahns-public@yhbt.net
Cc: Eric Wong <e@80x24.org>
Subject: [PATCH 2/3] proxy_pass: avoid accessing logger in env after hijacking
Date: Tue,  5 Jul 2016 13:50:15 +0000	[thread overview]
Message-ID: <20160705135016.14274-3-e@80x24.org> (raw)
In-Reply-To: <20160705135016.14274-1-e@80x24.org>

The HTTP state (@hs) object could be replaced in proxy_wait_next
causing @hs.env['rack.logger'] to become inaccessible.
 lib/yahns/proxy_http_response.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/yahns/proxy_http_response.rb b/lib/yahns/proxy_http_response.rb
index a37b387..74f5ce5 100644
--- a/lib/yahns/proxy_http_response.rb
+++ b/lib/yahns/proxy_http_response.rb
@@ -46,7 +46,7 @@ def proxy_write(wbuf, buf, req_res)
   def proxy_err_response(code, req_res, exc)
-    logger = @hs.env['rack.logger']
+    logger = self.class.logger # Yahns::HttpContext#logger
     case exc
     when nil
       logger.error('premature upstream EOF')

  parent reply	other threads:[~2016-07-05 13:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-05 13:50 [PATCH 0/3] another round of proxy_pass fixes Eric Wong
2016-07-05 13:50 ` [PATCH 1/3] proxy_pass: avoid TOCTTOU race when unbuffering, too Eric Wong
2016-07-05 13:50 ` Eric Wong [this message]
2016-07-05 13:50 ` [PATCH 3/3] proxy_pass: avoid stuck responses in "proxy_buffering: false" Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://yhbt.net/yahns/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160705135016.14274-3-e@80x24.org \
    --to=e@80x24.org \
    --cc=yahns-public@yhbt.net \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).