You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cli-dev@httpd.apache.org by wr...@apache.org on 2004/11/26 21:15:52 UTC
svn commit: r106658 - /httpd/mod_aspdotnet/trunk/mod/mod_aspdotnet.cpp
Author: wrowe
Date: Fri Nov 26 12:15:49 2004
New Revision: 106658
URL: http://svn.apache.org/viewcvs?view=rev&rev=106658
Log:
Close an xxx: note - convert our uri / physical path from utf-8 to
unicode before passing as BSTR's to CreateHost.
Since questions have been raised; 'how many times do we map the very
same vhost to an asp application directory?' record all successes at
LogLevel Debug.
Also fix some awkward wording in failure messages.
Modified:
httpd/mod_aspdotnet/trunk/mod/mod_aspdotnet.cpp
Modified: httpd/mod_aspdotnet/trunk/mod/mod_aspdotnet.cpp
Url: http://svn.apache.org/viewcvs/httpd/mod_aspdotnet/trunk/mod/mod_aspdotnet.cpp?view=diff&rev=106658&p1=httpd/mod_aspdotnet/trunk/mod/mod_aspdotnet.cpp&r1=106657&p2=httpd/mod_aspdotnet/trunk/mod/mod_aspdotnet.cpp&r2=106658
==============================================================================
--- httpd/mod_aspdotnet/trunk/mod/mod_aspdotnet.cpp (original)
+++ httpd/mod_aspdotnet/trunk/mod/mod_aspdotnet.cpp Fri Nov 26 12:15:49 2004
@@ -586,19 +586,46 @@
for (item = apr_hash_first(ptemp, global_conf->hosts); item;
item = apr_hash_next(item))
{
+ wchar_t *path;
+ apr_size_t inlen, outlen;
+ _bstr_t virtual_path, physical_path;
asp_net_host_conf_t *host;
apr_hash_this(item, NULL, NULL, (void**)&host);
-
+
+ // Initialize each host mapping, only once.
if (host->host_key != -1) {
continue;
}
+ // Treat AspNetMount paths as utf-8 strings, fail over to
+ // default _bstr_t multibyte conversion if unconvertable.
+ // Relies on simple utf-8 -> unicode rule, that output will
+ // never be more wchar's than the number of input chars.
+ inlen = strlen(host->virtual_path) + 1;
+ path = (wchar_t*)apr_palloc(ptemp, inlen * 2);
+ outlen = MultiByteToWideChar(CP_UTF8, 0, host->virtual_path,
+ inlen, path, inlen);
+ if (outlen) {
+ virtual_path = path;
+ }
+ else {
+ virtual_path = host->virtual_path;
+ }
+
+ inlen = strlen(host->physical_path) + 1;
+ path = (wchar_t*)apr_palloc(ptemp, inlen * 2);
+ outlen = MultiByteToWideChar(CP_UTF8, 0, host->physical_path,
+ inlen, path, inlen);
+ if (outlen) {
+ physical_path = path;
+ }
+ else {
+ physical_path = host->physical_path;
+ }
+
try {
- // XXX: i18n these paths by treating them as UTF-8 -> Unicode!!!
host->host_key = global_conf->pHostFactory->CreateHost(
- _bstr_t(host->virtual_path),
- _bstr_t(host->physical_path),
- (int) gs);
+ virtual_path, physical_path, (int) gs);
if (host->host_key == -1)
_com_raise_error(E_NOINTERFACE);
}
@@ -615,16 +642,19 @@
}
catch (HRESULT hr) {
ap_log_error(APLOG_MARK, APLOG_ERR, APR_FROM_OS_ERROR(hr), gs,
- "mod_aspdotnet: Failed to create Host of for %s mapped "
+ "mod_aspdotnet: Failed to create Host for %s mapped "
"to %s", host->virtual_path, host->physical_path);
return 1;
}
catch (...) {
ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, gs,
- "mod_aspdotnet: Failed to create Host of for %s mapped "
+ "mod_aspdotnet: Failed to create Host for %s mapped "
"to %s", host->virtual_path, host->physical_path);
return 1;
}
+ ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, gs,
+ "mod_aspdotnet: Sucessfully created Host for %s mapped "
+ "to %s", host->virtual_path, host->physical_path);
}
return OK;
Re: svn commit: r106658 - /httpd/mod_aspdotnet/trunk/mod/mod_aspdotnet.cpp
Posted by Jeff White <jl...@earthlink.net>.
> Author: wrowe
> Date: Fri Nov 26 12:15:49 2004
> New Revision: 106658
>
> URL: http://svn.apache.org/viewcvs?view=rev&rev=106658
> Log:
>
> Close an xxx: note - convert our uri / physical path from utf-8 to
> unicode before passing as BSTR's to CreateHost.
>
> Since questions have been raised; 'how many times do we map the
> very
> same vhost to an asp application directory?' record all successes
> at
> LogLevel Debug.
>
> Also fix some awkward wording in failure messages.
>
You keep adding to the CPP file,
where as between turkey activities
yesterday, and my mod_aspdotnet
source code files reviews, I think,
maybe less and less should be done
in the CPP file (not counting the Apache
tracking/pools actions) and more moved
over into the .NET world.
I also did something thinking, on asking
the free tool users for help.
For example, a NAnt build would have
compiled, tested and run your latests
changes. And then the NAnt build would
have put out a zip file, for others to download
and use right away, at the same time or just
after putting it all into svn for you!
An interesting book:
OpenSource .NET Development
Programming with NAnt, NUnit, NDoc and more
By Brain Nantz
http://www.awprofessional.com/title/0321228103
http://www.amazon.com/exec/obidos/tg/detail/-/0321228103/103-5911790-0207037?v=glance
Somewhere out there, a NAnt user or
some WiX user or ASP.NET behind
the scenes user might jump on using
their "new tool" to write mod_aspdotnet's
usage version of this same free tool
they use!
Just gotta let'em know!
Jeff