On Wed, Nov 15, 2017 at 08:15:15PM +0100, Sebastian Benoit wrote:
> Thanks, here is a diff on top of the last to check that.
> 
> If you manage to set the default headerlen on non http protocols, it does
> not catch that, but i dont want to add another variable for that corner
> case.

I think it is simpler to check when we parse the http options.

bluhm

Index: parse.y
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/relayd/parse.y,v
retrieving revision 1.217
diff -u -p -r1.217 parse.y
--- parse.y     15 Nov 2017 19:03:26 -0000      1.217
+++ parse.y     16 Nov 2017 12:57:46 -0000
@@ -1055,6 +1055,11 @@ httpflags_l      : httpflags comma httpflags_
                ;
 
 httpflags      : HEADERLEN NUMBER      {
+                       if (proto->type != RELAY_PROTO_HTTP) {
+                               yyerror("can set http options only for "
+                                   "http protocol");
+                               YYERROR;
+                       }
                        if ($2 < 0 || $2 > RELAY_MAXHEADERLENGTH) {
                                yyerror("invalid headerlen: %d", $2);
                                YYERROR;

Reply via email to