flea icon indicating copy to clipboard operation
flea copied to clipboard

Allow any fcgi variable to be queried

Open abyxcos opened this issue 9 years ago • 6 comments

Allow all fcgi variables to be queried, not just the HTTP_ ones.

abyxcos avatar Jan 27 '16 23:01 abyxcos

I have a few objections to this:

  • I can't imagine any use cases for this
  • I don't think fcgi variables don't belong with the request headers
  • You can already require( "fcgi" ) and call getenv directly if you need it

mikejsavage avatar Jan 28 '16 19:01 mikejsavage

My two use cases both involve getting the IP address (REMOTE_ADDR). I don't have strong feelings on this one as getenv() can handle it. Having it available under request "feels" cleaner, but I'm not sure the change is worth a single field accessor.

abyxcos avatar Jan 28 '16 20:01 abyxcos

REMOTE_ADDR is a special case (right???) so I think handling it separately is the neatest solution. And now this means I need to look at X-Forwarded-For headers.

I'll have to put it off for a couple more weeks since I changed jobs recently, so apologies for not pulling my weight here. :)

mikejsavage avatar Jan 28 '16 21:01 mikejsavage

I'm really not sure about REMOTE_ADDR. Do proxies (and application servers?) blow this away? I haven't tested this one outside of localhost yet, so I don't know how fragile it is in the real world.

And no worries, these are all just minor nits. Easy enough to send pulls for.

abyxcos avatar Jan 28 '16 21:01 abyxcos

They do, and they('re supposed to) add REMOTE_ADDR to X-Forwarded-For at every hop.

mikejsavage avatar Jan 28 '16 21:01 mikejsavage

In that case, this PR just became rather complicated. I'll try and look at this, but I don't have any setup to test it in. I'm not in a rush for this one, and I'll have to go test what my server actually does.

abyxcos avatar Jan 28 '16 23:01 abyxcos