简体   繁体   中英

Httpd's ScriptMap for extensionless URLs

There is a way to configure the Windows CE HTTPD server, so that it will load some defined ISAPI Extension (eg, asp.dll) for a defined file extension (eg, ".asp").

What is the easiest way to make it load some ISAPI Extension for extensionless file names in URLs?

At the end I have not found another way to accomplish my goal, but to create a special ISAPI filter just for this. This is a simple ISAPI filter, that handles the SF_NOTIFY_URL_MAP server event and changes the pszPhysicalPath variable according to extension mapping settings. To make it a little more general, I made it to support not only mapping from extension-less paths, but to map from any to any extension. The mappings are set in Windows Registry.

How it works, basically:

  1. A request gets to the HTTPD server, say to URL /vroot/file
  2. The server maps /vroot/file to some physical path, say \\disc\\vroot\\file
  3. The server calls the filter with the physical path, and the filter maps it to, say, \\disc\\vroot\\file.asp, according to it's settings.
  4. The server then handles the file correctly with the asp.dll, according to the ScriptMap registry settings.

In case someone needs it, I've published the source code on GitHub.

Did you try to use "." as file estension? Never tried myself, it's just an idea. Or you may use an ISAPI extension and re-define a whole virtual root, but this applies to all requests under that root, not just file names with no extension.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM