Skip to content

Commit 4129f29

Browse files
committed
BUG/MINOR: add h1-accept-payload-with-any-method and h1-do-not-close-on-insecure-transfer-encoding to global
1 parent 784a622 commit 4129f29

File tree

8 files changed

+149
-105
lines changed

8 files changed

+149
-105
lines changed

configuration/configuration_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ global
4343
h1-case-adjust-file /etc/headers.adjust
4444
h1-case-adjust host Host
4545
h1-case-adjust content-type Content-Type
46+
h1-accept-payload-with-any-method
47+
h1-do-not-close-on-insecure-transfer-encoding
4648
uid 1
4749
gid 1
4850
profiling.memory on

configuration/global.go

Lines changed: 124 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,18 @@ func ParseGlobalSection(p parser.Parser) (*models.Global, error) { //nolint:goco
658658
h1CaseAdjustFile = caseFileParser.Value
659659
}
660660

661+
var h1AcceptPayloadWithAnyMethod bool
662+
h1AcceptPayloadWithAnyMethod, err = parseBoolOption(p, "h1-accept-payload-with-any-method")
663+
if err != nil {
664+
return nil, err
665+
}
666+
667+
var h1DoNotCloseOnInsecureTransferEncoding bool
668+
h1DoNotCloseOnInsecureTransferEncoding, err = parseBoolOption(p, "h1-do-not-close-on-insecure-transfer-encoding")
669+
if err != nil {
670+
return nil, err
671+
}
672+
661673
var busyPolling bool
662674
_, err = p.Get(parser.Global, parser.GlobalSectionName, "busy-polling")
663675
if !errors.Is(err, parser_errors.ErrFetch) {
@@ -1082,108 +1094,110 @@ func ParseGlobalSection(p parser.Parser) (*models.Global, error) { //nolint:goco
10821094
}
10831095

10841096
global := &models.Global{
1085-
Anonkey: anonkey,
1086-
PresetEnvs: presetEnvs,
1087-
SetEnvs: setEnvs,
1088-
Resetenv: resetEnv,
1089-
Unsetenv: unsetEnv,
1090-
UID: uid,
1091-
User: user,
1092-
Gid: gid,
1093-
Group: group,
1094-
ClusterSecret: clusterSecret,
1095-
Chroot: chroot,
1096-
Localpeer: localPeer,
1097-
CaBase: caBase,
1098-
CrtBase: crtBase,
1099-
ServerStateBase: srvStateBase,
1100-
ServerStateFile: srvStateFile,
1101-
HardStopAfter: hardStop,
1102-
Daemon: daemon,
1103-
DefaultPath: defaultPath,
1104-
MasterWorker: masterWorker,
1105-
Maxconn: mConn,
1106-
Nbproc: nbproc,
1107-
Nbthread: nbthread,
1108-
Pidfile: pidfile,
1109-
RuntimeAPIs: rAPIs,
1110-
StatsTimeout: statsTimeout,
1111-
CPUMaps: cpuMaps,
1112-
HttpclientResolversDisabled: httpClientResolversDisabled,
1113-
HttpclientResolversID: httpClientResolversID,
1114-
HttpclientResolversPrefer: httpClientResolversPrefer,
1115-
HttpclientSslCaFile: httpClientSSLCaFile,
1116-
HttpclientSslVerify: httpClientSSLVerify,
1117-
PreallocFd: preallocFD,
1118-
SslDefaultBindCiphers: sslBindCiphers,
1119-
SslDefaultBindCiphersuites: sslBindCiphersuites,
1120-
SslDefaultBindCurves: sslDefaultBindCurves,
1121-
SslDefaultBindOptions: sslBindOptions,
1122-
SslDefaultServerCiphers: sslDefaultServerCiphers,
1123-
SslDefaultServerCiphersuites: sslServerCiphersuites,
1124-
SslDefaultServerOptions: sslServerOptions,
1125-
SslModeAsync: sslModeAsync,
1126-
SslSkipSelfIssuedCa: sslSkipSelfIssuedCa,
1127-
TuneOptions: tuneOptions,
1128-
TuneSslDefaultDhParam: dhParam,
1129-
ExternalCheck: externalCheck,
1130-
LuaLoads: luaLoads,
1131-
LuaPrependPath: luaPrependPath,
1132-
LogSendHostname: globalLogSendHostName,
1133-
H1CaseAdjusts: h1CaseAdjusts,
1134-
H1CaseAdjustFile: h1CaseAdjustFile,
1135-
BusyPolling: busyPolling,
1136-
MaxSpreadChecks: maxSpreadChecks,
1137-
CloseSpreadTime: closeSpreadTime,
1138-
Maxconnrate: maxconnrate,
1139-
Maxcomprate: maxcomprate,
1140-
Maxcompcpuusage: maxcompcpuusage,
1141-
Maxpipes: maxpipes,
1142-
Maxsessrate: maxsessrate,
1143-
Maxsslconn: maxsslconn,
1144-
Maxsslrate: maxsslrate,
1145-
Maxzlibmem: maxzlibmem,
1146-
NoQuic: noQuic,
1147-
Noepoll: noepoll,
1148-
Nokqueue: nokqueue,
1149-
Noevports: noevports,
1150-
Nopoll: nopoll,
1151-
Nosplice: nosplice,
1152-
Nogetaddrinfo: nogetaddrinfo,
1153-
Noreuseport: noreuseport,
1154-
ProfilingTasks: profilingTasks,
1155-
SpreadChecks: spreadChecks,
1156-
ThreadGroups: threadGroups,
1157-
StatsMaxconn: statsMaxconn,
1158-
SslLoadExtraFiles: SSLLoadExtraFiles,
1159-
ThreadGroupLines: threadGroupLines,
1160-
Node: node,
1161-
Description: description,
1162-
ExposeExperimentalDirectives: exposeExperimentalDirectives,
1163-
Grace: grace,
1164-
InsecureForkWanted: insecureForkWanted,
1165-
InsecureSetuidWanted: insecureSetuidWanted,
1166-
IssuersChainPath: issuersChainPath,
1167-
H2WorkaroundBogusWebsocketClients: h2WorkaroundBogusWebsocketClients,
1168-
LuaLoadPerThread: luaLoadPerThread,
1169-
MworkerMaxReloads: mworkerMaxReloads,
1170-
NumaCPUMapping: numaCPUMapping,
1171-
Pp2NeverSendLocal: pp2NeverSendLocal,
1172-
Ulimitn: ulimitn,
1173-
SetDumpable: setDumpable,
1174-
StrictLimits: strictLimits,
1175-
WurflOptions: &wurflOptions,
1176-
DeviceAtlasOptions: deviceAtlasOptions,
1177-
FiftyOneDegreesOptions: fiftyOneDegreesOptions,
1178-
Quiet: quiet,
1179-
ZeroWarning: zeroWarning,
1180-
SslEngines: sslEngines,
1181-
SslDhParamFile: sslDhParamFile,
1182-
SslServerVerify: sslServerVerify,
1183-
SetVars: setVars,
1184-
SetVarFmts: setVarFormats,
1185-
SslDefaultBindSigalgs: sslBindSigalgs,
1186-
SslDefaultBindClientSigalgs: sslBindClientSigalgs,
1097+
Anonkey: anonkey,
1098+
PresetEnvs: presetEnvs,
1099+
SetEnvs: setEnvs,
1100+
Resetenv: resetEnv,
1101+
Unsetenv: unsetEnv,
1102+
UID: uid,
1103+
User: user,
1104+
Gid: gid,
1105+
Group: group,
1106+
ClusterSecret: clusterSecret,
1107+
Chroot: chroot,
1108+
Localpeer: localPeer,
1109+
CaBase: caBase,
1110+
CrtBase: crtBase,
1111+
ServerStateBase: srvStateBase,
1112+
ServerStateFile: srvStateFile,
1113+
HardStopAfter: hardStop,
1114+
Daemon: daemon,
1115+
DefaultPath: defaultPath,
1116+
MasterWorker: masterWorker,
1117+
Maxconn: mConn,
1118+
Nbproc: nbproc,
1119+
Nbthread: nbthread,
1120+
Pidfile: pidfile,
1121+
RuntimeAPIs: rAPIs,
1122+
StatsTimeout: statsTimeout,
1123+
CPUMaps: cpuMaps,
1124+
HttpclientResolversDisabled: httpClientResolversDisabled,
1125+
HttpclientResolversID: httpClientResolversID,
1126+
HttpclientResolversPrefer: httpClientResolversPrefer,
1127+
HttpclientSslCaFile: httpClientSSLCaFile,
1128+
HttpclientSslVerify: httpClientSSLVerify,
1129+
PreallocFd: preallocFD,
1130+
SslDefaultBindCiphers: sslBindCiphers,
1131+
SslDefaultBindCiphersuites: sslBindCiphersuites,
1132+
SslDefaultBindCurves: sslDefaultBindCurves,
1133+
SslDefaultBindOptions: sslBindOptions,
1134+
SslDefaultServerCiphers: sslDefaultServerCiphers,
1135+
SslDefaultServerCiphersuites: sslServerCiphersuites,
1136+
SslDefaultServerOptions: sslServerOptions,
1137+
SslModeAsync: sslModeAsync,
1138+
SslSkipSelfIssuedCa: sslSkipSelfIssuedCa,
1139+
TuneOptions: tuneOptions,
1140+
TuneSslDefaultDhParam: dhParam,
1141+
ExternalCheck: externalCheck,
1142+
LuaLoads: luaLoads,
1143+
LuaPrependPath: luaPrependPath,
1144+
LogSendHostname: globalLogSendHostName,
1145+
H1CaseAdjusts: h1CaseAdjusts,
1146+
H1CaseAdjustFile: h1CaseAdjustFile,
1147+
H1AcceptPayloadWithAnyMethod: h1AcceptPayloadWithAnyMethod,
1148+
H1DoNotCloseOnInsecureTransferEncoding: h1DoNotCloseOnInsecureTransferEncoding,
1149+
BusyPolling: busyPolling,
1150+
MaxSpreadChecks: maxSpreadChecks,
1151+
CloseSpreadTime: closeSpreadTime,
1152+
Maxconnrate: maxconnrate,
1153+
Maxcomprate: maxcomprate,
1154+
Maxcompcpuusage: maxcompcpuusage,
1155+
Maxpipes: maxpipes,
1156+
Maxsessrate: maxsessrate,
1157+
Maxsslconn: maxsslconn,
1158+
Maxsslrate: maxsslrate,
1159+
Maxzlibmem: maxzlibmem,
1160+
NoQuic: noQuic,
1161+
Noepoll: noepoll,
1162+
Nokqueue: nokqueue,
1163+
Noevports: noevports,
1164+
Nopoll: nopoll,
1165+
Nosplice: nosplice,
1166+
Nogetaddrinfo: nogetaddrinfo,
1167+
Noreuseport: noreuseport,
1168+
ProfilingTasks: profilingTasks,
1169+
SpreadChecks: spreadChecks,
1170+
ThreadGroups: threadGroups,
1171+
StatsMaxconn: statsMaxconn,
1172+
SslLoadExtraFiles: SSLLoadExtraFiles,
1173+
ThreadGroupLines: threadGroupLines,
1174+
Node: node,
1175+
Description: description,
1176+
ExposeExperimentalDirectives: exposeExperimentalDirectives,
1177+
Grace: grace,
1178+
InsecureForkWanted: insecureForkWanted,
1179+
InsecureSetuidWanted: insecureSetuidWanted,
1180+
IssuersChainPath: issuersChainPath,
1181+
H2WorkaroundBogusWebsocketClients: h2WorkaroundBogusWebsocketClients,
1182+
LuaLoadPerThread: luaLoadPerThread,
1183+
MworkerMaxReloads: mworkerMaxReloads,
1184+
NumaCPUMapping: numaCPUMapping,
1185+
Pp2NeverSendLocal: pp2NeverSendLocal,
1186+
Ulimitn: ulimitn,
1187+
SetDumpable: setDumpable,
1188+
StrictLimits: strictLimits,
1189+
WurflOptions: &wurflOptions,
1190+
DeviceAtlasOptions: deviceAtlasOptions,
1191+
FiftyOneDegreesOptions: fiftyOneDegreesOptions,
1192+
Quiet: quiet,
1193+
ZeroWarning: zeroWarning,
1194+
SslEngines: sslEngines,
1195+
SslDhParamFile: sslDhParamFile,
1196+
SslServerVerify: sslServerVerify,
1197+
SetVars: setVars,
1198+
SetVarFmts: setVarFormats,
1199+
SslDefaultBindSigalgs: sslBindSigalgs,
1200+
SslDefaultBindClientSigalgs: sslBindClientSigalgs,
11871201
}
11881202

11891203
return global, nil
@@ -1814,6 +1828,14 @@ func SerializeGlobalSection(p parser.Parser, data *models.Global) error { //noli
18141828
return err
18151829
}
18161830

1831+
if err := serializeBoolOption(p, "h1-accept-payload-with-any-method", data.H1AcceptPayloadWithAnyMethod); err != nil {
1832+
return err
1833+
}
1834+
1835+
if err := serializeBoolOption(p, "h1-do-not-close-on-insecure-transfer-encoding", data.H1DoNotCloseOnInsecureTransferEncoding); err != nil {
1836+
return err
1837+
}
1838+
18171839
node := &types.StringC{Value: data.Node}
18181840
if data.Node == "" {
18191841
node = nil

configuration/global_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ func TestGetGlobal(t *testing.T) {
111111
if global.H1CaseAdjustFile != "/etc/headers.adjust" {
112112
t.Errorf("H1CaseAdjustFile is %v, expected /etc/headers.adjust", global.H1CaseAdjustFile)
113113
}
114+
if !global.H1AcceptPayloadWithAnyMethod {
115+
t.Errorf("H1AcceptPayloadWithAnyMethod is false, expected true")
116+
}
117+
if !global.H1DoNotCloseOnInsecureTransferEncoding {
118+
t.Errorf("H1DoNotCloseOnInsecureTransferEncoding is false, expected true")
119+
}
114120
if global.UID != 1 {
115121
t.Errorf("UID is %v, expected 1", global.UID)
116122
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/google/go-cmp v0.6.0
1111
github.com/google/renameio v1.0.1
1212
github.com/google/uuid v1.6.0
13-
github.com/haproxytech/config-parser/v5 v5.1.4
13+
github.com/haproxytech/config-parser/v5 v5.1.5
1414
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
1515
github.com/mitchellh/mapstructure v1.5.0
1616
github.com/pkg/errors v0.9.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ github.com/google/renameio v1.0.1 h1:Lh/jXZmvZxb0BBeSY5VKEfidcbcbenKjZFzM/q0fSeU
2828
github.com/google/renameio v1.0.1/go.mod h1:t/HQoYBZSsWSNK35C6CO/TpPLDVWvxOHboWUAweKUpk=
2929
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
3030
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
31-
github.com/haproxytech/config-parser/v5 v5.1.4 h1:TArFSuRpYlmTanZjt3nVe7lNcPw+pXmth8tLW72ENeM=
32-
github.com/haproxytech/config-parser/v5 v5.1.4/go.mod h1:16+1AbS+AvMZkDScIhergz2dqecQuEmjwV4Xt5ncS9s=
31+
github.com/haproxytech/config-parser/v5 v5.1.5 h1:wZZ7z62Q5xbRQCoyEejli3unj0/Eo+ixJrwe9ZBdzvI=
32+
github.com/haproxytech/config-parser/v5 v5.1.5/go.mod h1:16+1AbS+AvMZkDScIhergz2dqecQuEmjwV4Xt5ncS9s=
3333
github.com/haproxytech/go-logger v1.1.0 h1:HgGtYaI1ApkvbQdsm7f9AzQQoxTB7w37criTflh7IQE=
3434
github.com/haproxytech/go-logger v1.1.0/go.mod h1:OekUd8HCb7ubxMplzHUPBTHNxZmddOWfOjWclZsqIeM=
3535
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=

models/global.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/build/haproxy_spec.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,8 @@ definitions:
11121112
pattern: ^[^\s]+$
11131113
type: string
11141114
x-display-name: Group
1115+
h1_accept_payload_with_any_method:
1116+
type: boolean
11151117
h1_case_adjust:
11161118
items:
11171119
properties:
@@ -1129,6 +1131,8 @@ definitions:
11291131
x-omitempty: true
11301132
h1_case_adjust_file:
11311133
type: string
1134+
h1_do_not_close_on_insecure_transfer_encoding:
1135+
type: boolean
11321136
h2_workaround_bogus_websocket_clients:
11331137
type: boolean
11341138
hard_stop_after:

specification/models/configuration/global.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,10 @@ global:
659659
type: string
660660
h1_case_adjust_file:
661661
type: string
662+
h1_accept_payload_with_any_method:
663+
type: boolean
664+
h1_do_not_close_on_insecure_transfer_encoding:
665+
type: boolean
662666
quiet:
663667
type: boolean
664668
zero_warning:

0 commit comments

Comments
 (0)