Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict between HTTPConnectionMode and the new attributes introduced by commit ea81ccc #92

Open
fabianonunes opened this issue Oct 13, 2022 · 0 comments

Comments

@fabianonunes
Copy link
Contributor

fabianonunes commented Oct 13, 2022

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 attribute

    backend 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.

@fabianonunes fabianonunes changed the title Conflict between HTTPConnectionMode and new attributes introduced by commit ea81ccc Conflict between HTTPConnectionMode and the new attributes introduced by commit ea81ccc Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant