0

I'm writing a web server app in C++ using httpPlatformHandler and Winsock. After some issues I have it working well.

My question is: How can I determine the full path name of the file that triggered the request?

The only clue I see is the first line of the headers:

GET /httpserver.pbh HTTP/1.1

I want to be able to read the contents of the file so I need to come up with:

C:\inetpub\wwwroot\httpserver.pbh

ISAPI and FastCGI provide this value.

Lex Li
  • 60,503
  • 9
  • 116
  • 147
Roland Smith
  • 957
  • 4
  • 7
  • You need to refresh your mind set. httpPlatformHandler works as a reverse proxy here, so it has no idea what's the actual physical path. It would be your web server app to determine for a request on `/httpserver.pbh`, how the response should be generated (from `C:\inetpub\wwwroot\httpserver.pbh` or from somewhere else). For example, when I host a Node.js web app via httpPlatformHandler, the Node.js web app itself generates the response, https://halfblood.pro/running-nodejs-web-apps-on-iis-with-httpplatformhandler/ – Lex Li Jun 27 '22 at 15:29
  • Thanks for the explanation. While I have your attention, I have some quick questions. I am currently passing HTTP_PLATFORM_PORT on the command line, would it be better to call GetEnvironmentString? Do any of the Application Pool settings have an effect on how the app runs? – Roland Smith Jun 27 '22 at 16:59
  • If you take a quick look at this https://stackoverflow.com/tags/httpplatformhandler/info you can see that for different programming languages and their application/web servers, the ways to pass `HTTP_PLATFORM_PORT` vary. So your current option of passing via command line arguments is alright and no need to move to environment variables. – Lex Li Jun 27 '22 at 17:34
  • For application pool settings, they control how `w3wp` process(es) is created, and some in turn matters to your web server process(es) because yours are created by `w3wp` as children. Such settings are pool identity, idle shutdown timeout and so on. – Lex Li Jun 27 '22 at 17:37

0 Answers0