Skip to content

Commit

Permalink
BUG/MINOR: add h1-accept-payload-with-any-method and h1-do-not-close-…
Browse files Browse the repository at this point in the history
…on-insecure-transfer-encoding to global
  • Loading branch information
hdurand0710 committed Aug 27, 2024
1 parent 8f203ea commit ee1c078
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 2 deletions.
2 changes: 2 additions & 0 deletions config-parser/section-parsers.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,8 @@ func (p *configParser) getGlobalParser() *Parsers { //nolint: maintidx
addParser(parser, &sequence, &simple.Number{Name: "ocsp-update.mindelay"})
addParser(parser, &sequence, &simple.Number{Name: "ocsp-update.maxdelay"})
addParser(parser, &sequence, &simple.OnOff{Name: "ocsp-update.mode"})
addParser(parser, &sequence, &simple.Enabled{Name: "h1-accept-payload-with-any-method"})
addParser(parser, &sequence, &simple.Enabled{Name: "h1-do-not-close-on-insecure-transfer-encoding"})
// the ConfigSnippet must be at the end to parsers load order to ensure
// the overloading of any option has been declared previously
addParser(parser, &sequence, &parsers.ConfigSnippet{})
Expand Down
20 changes: 20 additions & 0 deletions configuration/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -2164,6 +2164,18 @@ func ParseGlobalSection(p parser.Parser) (*models.Global, error) { //nolint:goco
}
global.H1CaseAdjustFile = h1CaseAdjustFile

h1AcceptPayloadWithAnyMethod, err := parseBoolOption(p, "h1-accept-payload-with-any-method")
if err != nil {
return nil, err
}
global.H1AcceptPayloadWithAnyMethod = h1AcceptPayloadWithAnyMethod

h1DoNotCloseOnInsecureTransferEncoding, err := parseBoolOption(p, "h1-do-not-close-on-insecure-transfer-encoding")
if err != nil {
return nil, err
}
global.H1DoNotCloseOnInsecureTransferEncoding = h1DoNotCloseOnInsecureTransferEncoding

h2WorkaroundBogusWebsocketClients, err := parseBoolOption(p, "h2-workaround-bogus-websocket-clients")
if err != nil {
return nil, err
Expand Down Expand Up @@ -3015,6 +3027,14 @@ func SerializeGlobalSection(p parser.Parser, data *models.Global, opt *options.C
return err
}

if err := serializeBoolOption(p, "h1-accept-payload-with-any-method", data.H1AcceptPayloadWithAnyMethod); err != nil {
return err
}

if err := serializeBoolOption(p, "h1-do-not-close-on-insecure-transfer-encoding", data.H1DoNotCloseOnInsecureTransferEncoding); err != nil {
return err
}

if err := serializeTimeoutOption(p, "hard-stop-after", data.HardStopAfter, opt); err != nil {
return err
}
Expand Down
6 changes: 6 additions & 0 deletions models/global_base.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions models/global_base_compare.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions models/global_base_compare_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions specification/build/haproxy_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1992,6 +1992,8 @@ definitions:
pattern: ^[^\s]+$
type: string
x-display-name: Group
h1_accept_payload_with_any_method:
type: boolean
h1_case_adjust:
items:
properties:
Expand All @@ -2009,6 +2011,8 @@ definitions:
x-omitempty: true
h1_case_adjust_file:
type: string
h1_do_not_close_on_insecure_transfer_encoding:
type: boolean
h2_workaround_bogus_websocket_clients:
type: boolean
hard_stop_after:
Expand Down
4 changes: 4 additions & 0 deletions specification/models/configuration/global.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ global_base:
type: string
h1_case_adjust_file:
type: string
h1_accept_payload_with_any_method:
type: boolean
h1_do_not_close_on_insecure_transfer_encoding:
type: boolean
http_err_codes:
type: array
x-display-name: Replace, reduce or extend the list of status codes that define an error
Expand Down
2 changes: 2 additions & 0 deletions test/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ global
insecure-setuid-wanted
issuers-chain-path issuers-chain-path
h2-workaround-bogus-websocket-clients
h1-accept-payload-with-any-method
h1-do-not-close-on-insecure-transfer-encoding
lua-load-per-thread file.ext
mworker-max-reloads 5
numa-cpu-mapping
Expand Down
2 changes: 2 additions & 0 deletions test/expected/structured.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@
"grace": 10000,
"group": "anderson",
"h1_case_adjust_file": "/etc/headers.adjust",
"h1_accept_payload_with_any_method": true,
"h1_do_not_close_on_insecure_transfer_encoding": true,
"h2_workaround_bogus_websocket_clients": true,
"hard_stop_after": 2000,
"http_client_options": {
Expand Down

0 comments on commit ee1c078

Please sign in to comment.