I have an asynchronous pluggable protocol handler for an application that mostly mimics the file:// protocol but restricts requests to a sandbox configured in the application.
The application hosts an AngularJS webapp using the WebBrowser control in C#. When Angular's router requests a view template file using the protocol, I get a request to my implementation of IInternetProtocolInfo::CombineUrl() with the following baseUrl and relativeUrl:
pwzBaseUrl: myProtocol:///webApp/app/index.html#/start
pwzRelativeUrl: views/start.html
for which my code is:
wchar_t buf[2048] = { 0 };
DWORD ret = 2048;
UrlCombine(pwzBaseUrl, pwzRelativeUrl, buf, &ret, 0);
// pwzResult is myProtocol:///webApp/app/views/start.html here
StringCchCopy(pwzResult, ret + 1, buf);
*pcchResult = ret + 1;
return S_OK;
This results in IInternetProtocol::Start() being called with the following url:
szUrl: myProtocol:///webApp/app/views/start.html/webApp/app/views/start.html
As we can see, the path to the file has been duplicated and I have no idea why. It seems to only be view template files for AngularJS that suffer this issue; other relative paths work absolutely fine (such as pulling in other script files from bower_components/node_modules).
I would like to avoid having to hack at this to split the path in half if it is a duplicate. There must be a reason why urlmon is calling my protocol with this weird url...