client-native
client-native copied to clipboard
Conflict between HTTPConnectionMode and the new attributes introduced by commit ea81ccc
The commit ea81ccc (which intended to add support for options http-no-delay
and http_proxy
) introduced three new model.Backend
attributes that clash with HTTPConnectionMode
.
These new attributes override whatever value HTTPConnectionMode
has previously set, even when they are undefined. Due to the order in which they were inserted into the Backend, sometimes the HTTPConnectionMode
is overridden and sometimes it overrides the others.
For example:
var b []models.Backend
// via attributes created by commit ea81ccc
b = append(b, models.Backend{Name: "1_http-keep-alive", HTTPKeepAlive: "enabled"})
b = append(b, models.Backend{Name: "2_http-server-close", HTTPServerClose: "enabled"})
b = append(b, models.Backend{Name: "3_httpclose", Httpclose: "enabled"})
// via HTTPConnectionMode
b = append(b, models.Backend{Name: "4_conmode_http-keep-alive", HTTPConnectionMode: "http-keep-alive"})
b = append(b, models.Backend{Name: "5_conmode_http-server-close", HTTPConnectionMode: "http-server-close"})
b = append(b, models.Backend{Name: "6_conmode_httpclose", HTTPConnectionMode: "httpclose"})
for i, backend := range b {
config.CreateBackend(&backend, "", int64(i+1))
}
The resulting config will be:
-
Backends defined using new attributes created by commit ea81ccc
backend 1_http-keep-alive # This section should contain `option http-keep-alive`, # but is blank because `HTTPConnectionMode` (which is undefined) overwrote # the attribute `HTTPKeepAlive` backend 2_http-server-close # This section should contain `option http-server-close`, # but is blank because `HTTPConnectionMode` (which is undefined) overwrote # the attribute `HTTPServerClose` backend 3_httpclose # This section is ok. It wasn't overwritten because the attribute `Httpclose` is # evaluated after `HTTPConnectionMode` on model.Backend option httpclose
-
Backends defined using
HTTPConnectionMode
attributebackend 4_conmode_http-keep-alive # This section is ok. It wasn't overwritten because `HTTPKeepAlive` is # evaluated before `HTTPConnectionMode` option http-keep-alive backend 5_conmode_http-server-close # This section is ok. It wasn't overwritten because `HTTPServerClose` is # evaluated before `HTTPConnectionMode` option http-server-close backend 6_conmode_httpclose # This section should contain `option httpclose`, # but is blank because the `Httpclose `(which is undefined) overwrote # the attribute `HTTPConnectionMode`.
Since these new attributes are mutually exclusive, perhaps it might be better to remove them and use only HTTPConnectionMode
.