+ // Check for relative URL.
+ string stackresource;
+ if (resource && *resource == '/') {
+ // Compute a URL to the root of the site and point resource at constructed string.
+ int port = getPort();
+ const char* scheme = getScheme();
+ stackresource = string(scheme) + "://" + getHostname();
+ if (!isDefaultPort())
+ stackresource += ":" + boost::lexical_cast<string>(port);
+ stackresource += resource;
+ resource = stackresource.c_str();
+ }
+