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

fix(dao) select NULL fields as nil from the proxy #3714

Merged
merged 2 commits into from
Aug 20, 2018

Conversation

thibaultcha
Copy link
Member

When reading from the proxy, we do not wish to retrieve unset columns as
ngx.null for backwards-compatibility reasons. That is now the default
for all plugins since 735314c (parent commit), for plugins, and it is
now for the runloop as well.

Context: retrieving unset columns as nil instead of ngx.null allows
for backwards-compatibility with existing plugins. An example of this is
authentication plugins retrieving the authenticated Consumer, and
injecting its fields as headers into the upstream request (e.g.
X-Consumer-Username). When such fields are unset, the following
headers were sent upstream: X-Consumer-Username: userdata: NULL
instead of no header at all (or worse, producing HTTP 500 errors).

This replaces parts of (but not all) #3710.

hishamhm and others added 2 commits August 17, 2018 11:46
Minimal changes to add a { nulls = true } options argument to the new
DAO, so that by default it returns Lua `nil` on null values, but can
also return explicit `ngx.null` upon request. Adjusts the Admin API
endpoint generator to pass this option, and also the router (so that
code changes to the router at this point are minimal).

Fix #3609
Fix #3617
When reading from the proxy, we do not wish to retrieve unset columns as
`ngx.null` for backwards-compatibility reasons. That is now the default
for all plugins since 735314c (parent commit), for plugins, and it is
now for the runloop as well.

Context: retrieving unset columns as `nil` instead of `ngx.null` allows
for backwards-compatibility with existing plugins. An example of this is
authentication plugins retrieving the authenticated Consumer, and
injecting its fields as headers into the upstream request (e.g.
`X-Consumer-Username`). When such fields are unset, the following
headers were sent upstream: `X-Consumer-Username: userdata: NULL`
instead of no header at all (or worse, producing HTTP 500 errors).
Copy link
Member

@bungle bungle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hishamhm hishamhm merged commit 6aa3a7e into master Aug 20, 2018
@hishamhm hishamhm deleted the fix/dao-nulls-vs-nil branch August 20, 2018 15:23
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

Successfully merging this pull request may close these issues.

3 participants