Issue #132: Middleware composition regression causes contant 406 Not Acceptable with push_ssl on (conservancy/kallithea)

saaj issues-reply at bitbucket.org
Thu May 7 12:55:29 EDT 2015


New issue 132: Middleware composition regression causes contant 406 Not Acceptable with push_ssl on
https://bitbucket.org/conservancy/kallithea/issue/132/middleware-composition-regression-causes

saaj:

[This commit](https://bitbucket.org/conservancy/kallithea/commits/6a0964373a3089e5a813389921c3d3e31685f14e) by @kiilerix breaks the composition. I know nothing about Pylons' middleware but through wasting half a day in a WTF mode, I know that this is broken (`HttpsFixup` is never called on VCS opertaions):

```
#!python


# Enable https redirects based on HTTP_X_URL_SCHEME set by proxy
if any(asbool(config.get(x)) for x in ['https_fixup', 'force_https', 'use_htsts']):
  app = HttpsFixup(app, config)

# we want our low level middleware to get to the request ASAP. We don't
# need any pylons stack middleware in them - especially no StatusCodeRedirect buffering
app = SimpleHg(app, config)
app = SimpleGit(app, config)
```
And this does work (the order it was in RhodeCode):

```
#!python

# we want our low level middleware to get to the request ASAP. We don't
# need any pylons stack middleware in them - especially no StatusCodeRedirect buffering
app = SimpleHg(app, config)
app = SimpleGit(app, config)

# Enable https redirects based on HTTP_X_URL_SCHEME set by proxy
if any(asbool(config.get(x)) for x in ['https_fixup', 'force_https', 'use_htsts']):
  app = HttpsFixup(app, config)
```

What's really alerting about it is that this regression important in functionality has infiltrated though the test suite. Either tests are not good enough or the commiters don't examine them.




More information about the kallithea-general mailing list