]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: spoe: Properly abort processing on client abort
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 16 Mar 2026 06:59:24 +0000 (07:59 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 17 Mar 2026 06:48:01 +0000 (07:48 +0100)
Client abort when abortonclose is configured was ignored when messges were
sent on event while it works properly when messages are sent via an
"send-spoe-group" action.

To fix the issue, when the SPOE filter is waiting for the SPOE applet
response, it must check if a client abort was reported and if so, must
interrupt its processing.

This patch should be backported as far as 3.1.

src/flt_spoe.c

index cac572287b333cf66243fcc97d947338222db8f9..5d8f23dba2d868029bdd786275d20020944f943b 100644 (file)
@@ -1112,6 +1112,19 @@ static int spoe_process_event(struct stream *s, struct spoe_context *ctx,
                                 agent->id, spoe_event_str[ev], s->uniq_id, ctx->status_code, ctx->stats.t_process,
                                 agent->counters.nb_errors, agent->counters.nb_processed);
        }
+       else if (ret == 0) {
+               struct channel *chn = (dir == SMP_OPT_DIR_REQ) ? &s->req : &s->res;
+
+               if ((s->scf->flags & SC_FL_ERROR) ||
+                   ((s->scf->flags & (SC_FL_EOS|SC_FL_ABRT_DONE)) && proxy_abrt_close_def(s->be, 1)) ||
+                   (chn_prod(chn)->flags & (SC_FL_ERROR|SC_FL_EOS|SC_FL_ABRT_DONE))) {
+                       ctx->status_code = SPOE_CTX_ERR_INTERRUPT;
+                       spoe_stop_processing(agent, ctx);
+                       spoe_handle_processing_error(s, agent, ctx, dir);
+                       ret = 1;
+               }
+       }
+
        return ret;
 }