Hi Ryan,

On Wed, Sep 10, 2014 at 04:36:24PM -0500, Ryan Brock wrote:
> Here is the change I made on the very latest 1.6 master dev. It is only in
> the one spot. There was discussion of changing it in a few other spots were
> status was checked for less than 200, but I wouldn't know how to test that
> correctly so I didn't feel it was a good idea to change it.
> 
> This change works for the tests I did with just WebSocket connections.

I've looked at the surrounding code a bit, and am seeing a few other changes
to be applied for this patch to avoid possible side effects :
  1) we need to allow rspadd to work there.
  2) we want to prevent cache controls from being performed on 101
  3) we want to avoid Connection header mangling on 101

Please could you check if the attached patch still works fine for you ? It
includes your change plus the other ones above. If that's OK, we can merge
it after checking if the doc needs to be updated or not (since we could
already delete/deny headers in 101, I think the doc is already OK).

Thanks,
Willy

diff --git a/src/proto_http.c b/src/proto_http.c
index 2494850..11177cb 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -6282,7 +6282,7 @@ int http_process_res_common(struct session *s, struct 
channel *rep, int an_bit,
 
                /* add response headers from the rule sets in the same order */
                list_for_each_entry(wl, &rule_set->rsp_add, list) {
-                       if (txn->status < 200)
+                       if (txn->status < 200 && txn->status != 101)
                                break;
                        if (wl->cond) {
                                int ret = acl_exec_cond(wl->cond, px, s, txn, 
SMP_OPT_DIR_RES|SMP_OPT_FINAL);
@@ -6303,7 +6303,7 @@ int http_process_res_common(struct session *s, struct 
channel *rep, int an_bit,
        }
 
        /* OK that's all we can do for 1xx responses */
-       if (unlikely(txn->status < 200))
+       if (unlikely(txn->status < 200 && txn->status != 101))
                goto skip_header_mangling;
 
        /*
@@ -6316,7 +6316,7 @@ int http_process_res_common(struct session *s, struct 
channel *rep, int an_bit,
        /*
         * Check for cache-control or pragma headers if required.
         */
-       if ((s->be->options & PR_O_CHK_CACHE) || (s->be->ck_opts & PR_CK_NOC))
+       if (((s->be->options & PR_O_CHK_CACHE) || (s->be->ck_opts & PR_CK_NOC)) 
&& txn->status != 101)
                check_response_for_cacheability(s, rep);
 
        /*
@@ -6432,9 +6432,11 @@ int http_process_res_common(struct session *s, struct 
channel *rep, int an_bit,
         * Adjust "Connection: close" or "Connection: keep-alive" if needed.
         * If an "Upgrade" token is found, the header is left untouched in order
         * not to have to deal with some client bugs : some of them fail an 
upgrade
-        * if anything but "Upgrade" is present in the Connection header.
+        * if anything but "Upgrade" is present in the Connection header. We 
don't
+        * want to touch any 101 response either since it's switching to another
+        * protocol.
         */
-       if (!(txn->flags & TX_HDR_CONN_UPG) &&
+       if ((txn->status != 101) && !(txn->flags & TX_HDR_CONN_UPG) &&
            (((txn->flags & TX_CON_WANT_MSK) != TX_CON_WANT_TUN) ||
             ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||
              (s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL))) {

Reply via email to