-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Hi. Recently I was looking into your module and have couple of suggestions that may help a bit in the future (or not).
Actually, I'm more interested in merging your module with my distribution than anything else. I think it would benefit everyone.
So it would be nice to have everything restructured and put together into a single file so we can merge. As time permits of course. We can discuss this privately.
And other thing. I've noticed you aren't using internal variables for PSGI ENV. It can help a bit to make things less complex and less dependent on internals in the future. Basically you can just map every internal variable into PSGI ENV.
Here's a simple example on using variables (you probably can take it out of nginx.xs, but just in case; and don't take it as something important, it isn't):
HV *hv;
ngx_str_t var;
ngx_http_variable_value_t *vv;
ngx_uint_t hash;
...
hv = newHV (); /* PSGI ENV */
...
hash = ngx_hash_key ((u_char *) "scheme", sizeof ("scheme") - 1);
var.len = sizeof ("scheme") - 1;
var.data = (u_char *) "scheme";
vv = ngx_http_get_variable(r, &var, hash);
if (vv != NULL && !vv->not_found) {
hv_store (hv, "psgi.url_scheme", sizeof("psgi.url_scheme") - 1,
newSVpvn ((char *) vv->data, vv->len), 0);
}