Bug 61284

Summary: proxy_wstunnel can't send BAD_GATEWAY after removing HTTP filters
Product: Apache httpd-2 Reporter: Jacob Champion <jchampion>
Component: mod_proxy_wstunnelAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: 2.4.26   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: Restore output filters before sending an error response (2.4.x)
Restore output filters before sending an error response (trunk)
Restore output filters before sending an error response (trunk)

Description Jacob Champion 2017-07-12 19:14:27 UTC
Related to bug 61283.

r1669299 attempts to add Bad Gateway handling in the case that the backend hangs up before sending anything. Unfortunately, at this point we've already removed the HTTP output filters, so the response is broken (it's just literally the Bad Gateway document text, without HTTP status line or headers).
Comment 1 Yann Ylavic 2017-07-13 19:56:47 UTC
Created attachment 35129 [details]
Restore output filters before sending an error response (2.4.x)

(untested yet)

Patch for 2.4.x looks quite simple, I think we should be able to restore the filters if nothing was sent out.
Comment 2 Yann Ylavic 2017-07-13 20:04:14 UTC
Created attachment 35130 [details]
Restore output filters before sending an error response (trunk)

(untested still)

Quite the same for trunk, but here the patch is incomplete (does not address the proxy_wstunnel_callback() case).
For this, we'd need more "state" in the baton, and use an error bucket when we end there with !replied.
Something like the patch from https://www.mail-archive.com/dev@httpd.apache.org/msg66204.html (larger scope, but anyway I think we need things from there to correctly address upgraded (or not) reponses...).
Comment 3 Yann Ylavic 2017-07-13 20:28:12 UTC
Created attachment 35131 [details]
Restore output filters before sending an error response (trunk)

Better error handling/reporting than previous (trunk) patch.