-
-
Notifications
You must be signed in to change notification settings - Fork 100
Add HTTP headers to ctx object in FastCGI executable #258
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
Conversation
|
Thanks for the review @jbo-ads.
This was more by trial and error so let me know if there is a better way. I've tested in IIS, and with server variables with multiple underscored e.g. The code does copy all |
|
Thanks @geographika for this enhancement! |
|
Thanks again for taking the time to review @jbo-ads |
Initial attempt at resolving #256 and providing the same HTTP header forwarding functionality as the Apache module.
Tested and working on IIS as a FastCGI module.
For each request the environ is looped through (note this is the FastCGI environment rather than the system environment (see MapServer discussions here.
There seems to be no way to know which server variables are HTTP headers and what are other variables.
HTTP headers are saved as server variables in the format "HTTP_MY_HEADER", but are expected to be available as "MY-HEADER". The code attempts to set this. I took a copy of the
str_replace_allfunction from:mapcache/contrib/mapcache_detail/mapcache_detail.c
Line 387 in 447c0c6
util.cfile?).This was an attempt to replace all instances of "_" with "-". However it seemed to send the server into an infinite loop.
I tried to stay with the approach used in the rest of MapCache, mainly by searching and copying, so code reviews very welcome..!