* Uri.cs: Fix some issues found with Moonlight (see new unit
tests)
svn path=/trunk/mcs/; revision=132239
+2009-04-21 Sebastien Pouliot <sebastien@ximian.com>
+
+ * Uri.cs: Fix some issues found with Moonlight (see new unit
+ tests)
+
2009-04-14 Sebastien Pouliot <sebastien@ximian.com>
* Uri.cs: Fix processing of %2f and %5c in paths. Avoid a few
2009-04-14 Sebastien Pouliot <sebastien@ximian.com>
* Uri.cs: Fix processing of %2f and %5c in paths. Avoid a few
+#if NET_2_1
+ public Uri (string uriString) : this (uriString, UriKind.Absolute)
+ {
+ }
+#else
public Uri (string uriString) : this (uriString, false)
{
}
public Uri (string uriString) : this (uriString, false)
{
}
protected Uri (SerializationInfo serializationInfo,
StreamingContext streamingContext) :
this (serializationInfo.GetString ("AbsoluteUri"), true)
protected Uri (SerializationInfo serializationInfo,
StreamingContext streamingContext) :
this (serializationInfo.GetString ("AbsoluteUri"), true)
}
public Uri (Uri baseUri, Uri relativeUri)
}
public Uri (Uri baseUri, Uri relativeUri)
- : this (baseUri, relativeUri.OriginalString, false)
+ Merge (baseUri, relativeUri == null ? String.Empty : relativeUri.OriginalString);
// FIXME: this should call UriParser.Resolve
}
// FIXME: this should call UriParser.Resolve
}
#endif
public Uri (Uri baseUri, string relativeUri)
#endif
public Uri (Uri baseUri, string relativeUri)
- : this (baseUri, relativeUri, false)
+ Merge (baseUri, relativeUri);
// FIXME: this should call UriParser.Resolve
}
// FIXME: this should call UriParser.Resolve
}
#endif
public Uri (Uri baseUri, string relativeUri, bool dontEscape)
{
#endif
public Uri (Uri baseUri, string relativeUri, bool dontEscape)
{
+ userEscaped = dontEscape;
+ Merge (baseUri, relativeUri);
+ }
+
+ private void Merge (Uri baseUri, string relativeUri)
+ {
#if NET_2_0
if (baseUri == null)
throw new ArgumentNullException ("baseUri");
#if NET_2_0
if (baseUri == null)
throw new ArgumentNullException ("baseUri");
+ if (!baseUri.IsAbsoluteUri)
+ throw new ArgumentOutOfRangeException ("baseUri");
if (relativeUri == null)
relativeUri = String.Empty;
#else
if (relativeUri == null)
relativeUri = String.Empty;
#else
#endif
// See RFC 2396 Par 5.2 and Appendix C
#endif
// See RFC 2396 Par 5.2 and Appendix C
- userEscaped = dontEscape;
-
// Check Windows UNC (for // it is scheme/host separator)
if (relativeUri.Length >= 2 && relativeUri [0] == '\\' && relativeUri [1] == '\\') {
source = relativeUri;
// Check Windows UNC (for // it is scheme/host separator)
if (relativeUri.Length >= 2 && relativeUri [0] == '\\' && relativeUri [1] == '\\') {
source = relativeUri;
// It must be Unix file path or Windows UNC
if (uriString [0] == '/' && Path.DirectorySeparatorChar == '/'){
ParseAsUnixAbsoluteFilePath (uriString);
// It must be Unix file path or Windows UNC
if (uriString [0] == '/' && Path.DirectorySeparatorChar == '/'){
ParseAsUnixAbsoluteFilePath (uriString);
+#if NET_2_1
+ isAbsoluteUri = false;
+#else
if (kind == UriKind.Relative)
isAbsoluteUri = false;
if (kind == UriKind.Relative)
isAbsoluteUri = false;
} else if (uriString.Length >= 2 && uriString [0] == '\\' && uriString [1] == '\\')
ParseAsWindowsUNC (uriString);
} else if (uriString.Length >= 2 && uriString [0] == '\\' && uriString [1] == '\\')
ParseAsWindowsUNC (uriString);