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

Improve handling of key environment variables (as they do not work on Windows systems) #251

Open
jmckenna opened this issue Apr 18, 2021 · 2 comments

Comments

@jmckenna
Copy link
Member

jmckenna commented Apr 18, 2021

  • this is a long reported issue (many tickets in MapServer codebase over a decade or more) where environment variables do not work on all Windows systems (no matter what the web server is)
  • an example key environment variable, that is relied upon by the MapCache codebase is CURL_CA_BUNDLE
  • MapCache in /mapcache/lib/http.c faces this same problem on Windows systems (MS4W has had to do various workarounds because of this, for years, for both MapCache and MapServer)
  • pull request WIP: Use CPLSetConfigOption/CPLGetConfigOption for some CGI/FastCGI-related env vars. MapServer#6304 enables use of that variable through the mapfile CONFIG parameter
  • update: I wonder if we could have a new section in mapcache.xml named <environment_variables>, and these would take precedence (use this value, otherwise use the one found at the system level).

Thoughts?

@geographika
Copy link
Member

@jmckenna - where wre you able to pass the file path in CURL_CA_BUNDLE to cURL?
In MapServer we have the following line at https://github.com/MapServer/MapServer/blob/c862b04cf690091995df40139a6be77a2ff72bce/maphttp.c#L579

      unchecked_curl_easy_setopt(http_handle, CURLOPT_CAINFO, pszCurlCABundle );

The XML approach sounds good. Alternatively the CPLGetConfigOption approach used in MapServer could be used.

@dafvid
Copy link

dafvid commented Nov 22, 2024

Old but still open issue. I can confirm this works fine. For the first request! Are there something somewhere inside mapcache that clears the environment between requests? It seems like it.

System
Windows server 2022
IIS 10 + mapcache fast cgi

Steps to reproduce:

  1. Set CURL_CA_BUNDLE
  2. Make first request
  3. Witness one single tile being fetched from a HTTPS-only WMS
  4. Make a second request
  5. Recieve a SSL certificate problem: unable to get local issuer certificate
  6. Restart/kill the fastcgi server
  7. Goto 2

If i set the fast cgi to reload after just one request everything works but obviously VERY slow. So my best guess is that the environment get reset between request and the part that sets environment variables only does so on startup.

I can create a new issue from this if that is more apropriate but it's related to this fix.

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

No branches or pull requests

3 participants