1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736
|
//------------------------------------------------------------------------------
// <copyright file="UrlPath.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
/*
* UrlPath class
*
* Copyright (c) 1999 Microsoft Corporation
*/
namespace System.Web.Util {
using System.Text;
using System.Runtime.Serialization.Formatters;
using System.Runtime.InteropServices;
using System.Collections;
using System.Globalization;
using System.IO;
using System.Web.Hosting;
/*
* Code to perform Url path combining
*/
internal static class UrlPath {
internal const char appRelativeCharacter = '~';
internal const string appRelativeCharacterString = "~/";
private static char[] s_slashChars = new char[] { '\\', '/' };
internal static bool IsRooted(String basepath) {
return (String.IsNullOrEmpty(basepath) || basepath[0] == '/' || basepath[0] == '\\');
}
// Checks if virtual path contains a protocol, which is referred to as a scheme in the
// URI spec.
private static bool HasScheme(string virtualPath) {
// URIs have the format <scheme>:<scheme-specific-path>, e.g. mailto:user@ms.com,
// http://server/, nettcp://server/, etc. The <scheme> cannot contain slashes.
// The virtualPath passed to this method may be absolute or relative. Although
// ':' is only allowed in the <scheme-specific-path> if it is encoded, the
// virtual path that we're receiving here may be decoded, so it is impossible
// for us to determine if virtualPath has a scheme. We will be conservative
// and err on the side of assuming it has a scheme when we cannot tell for certain.
// To do this, we first check for ':'. If not found, then it doesn't have a scheme.
// If ':' is found, then as long as we find a '/' before the ':', it cannot be
// a scheme because schemes don't contain '/'. Otherwise, we will assume it has a
// scheme.
int indexOfColon = virtualPath.IndexOf(':');
if (indexOfColon == -1)
return false;
int indexOfSlash = virtualPath.IndexOf('/');
return (indexOfSlash == -1 || indexOfColon < indexOfSlash);
}
// Returns whether the virtual path is relative. Note that this returns true for
// app relative paths (e.g. "~/sub/foo.aspx")
internal static bool IsRelativeUrl(string virtualPath) {
// If it has a protocol, it's not relative
if (HasScheme(virtualPath))
return false;
return !IsRooted(virtualPath);
}
internal static bool IsAppRelativePath(string path) {
if (path == null)
return false;
int len = path.Length;
// Empty string case
if (len == 0) return false;
// It must start with ~
if (path[0] != appRelativeCharacter)
return false;
// Single character case: "~"
if (len == 1)
return true;
// If it's longer, checks if it starts with "~/" or "~\"
return path[1] == '\\' || path[1] == '/';
}
internal static bool IsValidVirtualPathWithoutProtocol(string path) {
if (path == null)
return false;
return !HasScheme(path);
}
internal static String GetDirectory(String path) {
if (String.IsNullOrEmpty(path))
throw new ArgumentException(SR.GetString(SR.Empty_path_has_no_directory));
if (path[0] != '/' && path[0] != appRelativeCharacter)
throw new ArgumentException(SR.GetString(SR.Path_must_be_rooted, path));
// If it's just "~" or "/", return it unchanged
if (path.Length == 1)
return path;
int slashIndex = path.LastIndexOf('/');
// This could happen if the input looks like "~abc"
if (slashIndex < 0)
throw new ArgumentException(SR.GetString(SR.Path_must_be_rooted, path));
return path.Substring(0, slashIndex + 1);
}
private static bool IsDirectorySeparatorChar(char ch) {
return (ch == '\\' || ch == '/');
}
internal static bool IsAbsolutePhysicalPath(string path) {
if (path == null || path.Length < 3)
return false;
// e.g c:\foo
if (path[1] == ':' && IsDirectorySeparatorChar(path[2]))
return true;
// e.g \\server\share\foo or //server/share/foo
return IsUncSharePath(path);
}
internal static bool IsUncSharePath(string path) {
// e.g \\server\share\foo or //server/share/foo
if (path.Length > 2 && IsDirectorySeparatorChar(path[0]) && IsDirectorySeparatorChar(path[1]))
return true;
return false;
}
internal static void CheckValidVirtualPath(string path) {
// Check if it looks like a physical path (UNC shares and C:)
if (IsAbsolutePhysicalPath(path)) {
throw new HttpException(SR.GetString(SR.Physical_path_not_allowed, path));
}
// Virtual path can't have colons.
int iqs = path.IndexOf('?');
if (iqs >= 0) {
path = path.Substring(0, iqs);
}
if (HasScheme(path)) {
throw new HttpException(SR.GetString(SR.Invalid_vpath, path));
}
}
private static String Combine(String appPath, String basepath, String relative) {
String path;
if (String.IsNullOrEmpty(relative))
throw new ArgumentNullException("relative");
if (String.IsNullOrEmpty(basepath))
throw new ArgumentNullException("basepath");
if (basepath[0] == appRelativeCharacter && basepath.Length == 1) {
// If it's "~", change it to "~/"
basepath = appRelativeCharacterString;
}
else {
// If the base path includes a file name, get rid of it before combining
int lastSlashIndex = basepath.LastIndexOf('/');
Debug.Assert(lastSlashIndex >= 0);
if (lastSlashIndex < basepath.Length - 1) {
basepath = basepath.Substring(0, lastSlashIndex + 1);
}
}
// Make sure it's a virtual path (ASURT 73641)
CheckValidVirtualPath(relative);
if (IsRooted(relative)) {
path = relative;
}
else {
// If the path is exactly "~", just return the app root path
if (relative.Length == 1 && relative[0] == appRelativeCharacter)
return appPath;
// If the relative path starts with "~/" or "~\", treat it as app root
// relative (ASURT 68628)
if (IsAppRelativePath(relative)) {
if (appPath.Length > 1)
path = appPath + "/" + relative.Substring(2);
else
path = "/" + relative.Substring(2);
} else {
path = SimpleCombine(basepath, relative);
}
}
return Reduce(path);
}
internal static String Combine(String basepath, String relative) {
return Combine(HttpRuntime.AppDomainAppVirtualPathString, basepath, relative);
}
// This simple version of combine should only be used when the relative
// path is known to be relative. It's more efficient, but doesn't do any
// sanity checks.
internal static String SimpleCombine(String basepath, String relative) {
Debug.Assert(!String.IsNullOrEmpty(basepath));
Debug.Assert(!String.IsNullOrEmpty(relative));
Debug.Assert(relative[0] != '/');
if (HasTrailingSlash(basepath))
return basepath + relative;
else
return basepath + "/" + relative;
}
internal static String Reduce(String path) {
// ignore query string
String queryString = null;
if (path != null) {
int iqs = path.IndexOf('?');
if (iqs >= 0) {
queryString = path.Substring(iqs);
path = path.Substring(0, iqs);
}
}
// Take care of backslashes and duplicate slashes
path = FixVirtualPathSlashes(path);
path = ReduceVirtualPath(path);
return (queryString != null) ? (path + queryString) : path;
}
// Same as Reduce, but for a virtual path that is known to be well formed
internal static String ReduceVirtualPath(String path) {
int length = path.Length;
int examine;
// quickly rule out situations in which there are no . or ..
for (examine = 0; ; examine++) {
examine = path.IndexOf('.', examine);
if (examine < 0)
return path;
if ((examine == 0 || path[examine - 1] == '/')
&& (examine + 1 == length || path[examine + 1] == '/' ||
(path[examine + 1] == '.' && (examine + 2 == length || path[examine + 2] == '/'))))
break;
}
// OK, we found a . or .. so process it:
ArrayList list = new ArrayList();
StringBuilder sb = new StringBuilder();
int start;
examine = 0;
for (; ; ) {
start = examine;
examine = path.IndexOf('/', start + 1);
if (examine < 0)
examine = length;
if (examine - start <= 3 &&
(examine < 1 || path[examine - 1] == '.') &&
(start + 1 >= length || path[start + 1] == '.')) {
if (examine - start == 3) {
if (list.Count == 0)
throw new HttpException(SR.GetString(SR.Cannot_exit_up_top_directory));
// We're about to backtrack onto a starting '~', which would yield
// incorrect results. Instead, make the path App Absolute, and call
// Reduce on that.
if (list.Count == 1 && IsAppRelativePath(path)) {
Debug.Assert(sb.Length == 1);
return ReduceVirtualPath(MakeVirtualPathAppAbsolute(path));
}
sb.Length = (int)list[list.Count - 1];
list.RemoveRange(list.Count - 1, 1);
}
}
else {
list.Add(sb.Length);
sb.Append(path, start, examine - start);
}
if (examine == length)
break;
}
string result = sb.ToString();
// If we end up with en empty string, turn it into either "/" or "." (VSWhidbey 289175)
if (result.Length == 0) {
if (length > 0 && path[0] == '/')
result = @"/";
else
result = ".";
}
return result;
}
// Change backslashes to forward slashes, and remove duplicate slashes
internal static String FixVirtualPathSlashes(string virtualPath) {
// Make sure we don't have any back slashes
virtualPath = virtualPath.Replace('\\', '/');
// Replace any double forward slashes
for (;;) {
string newPath = virtualPath.Replace("//", "/");
// If it didn't do anything, we're done
if ((object)newPath == (object)virtualPath)
break;
// We need to loop again to take care of triple (or more) slashes (VSWhidbey 288782)
virtualPath = newPath;
}
return virtualPath;
}
// We use file: protocol instead of http:, so that Uri.MakeRelative behaves
// in a case insensitive way (VSWhidbey 80078)
private const string dummyProtocolAndServer = "file://foo";
// Return the relative vpath path from one rooted vpath to another
internal static string MakeRelative(string from, string to) {
// If either path is app relative (~/...), make it absolute, since the Uri
// class wouldn't know how to deal with it.
from = MakeVirtualPathAppAbsolute(from);
to = MakeVirtualPathAppAbsolute(to);
// Make sure both virtual paths are rooted
if (!IsRooted(from))
throw new ArgumentException(SR.GetString(SR.Path_must_be_rooted, from));
if (!IsRooted(to))
throw new ArgumentException(SR.GetString(SR.Path_must_be_rooted, to));
// Remove the query string, so that System.Uri doesn't corrupt it
string queryString = null;
if (to != null) {
int iqs = to.IndexOf('?');
if (iqs >= 0) {
queryString = to.Substring(iqs);
to = to.Substring(0, iqs);
}
}
// Uri's need full url's so, we use a dummy root
Uri fromUri = new Uri(dummyProtocolAndServer + from);
Uri toUri = new Uri(dummyProtocolAndServer + to);
string relativePath;
// VSWhidbey 144946: If to and from points to identical path (excluding query and fragment), just use them instead
// of returning an empty string.
if (fromUri.Equals(toUri)) {
int iPos = to.LastIndexOfAny(s_slashChars);
if (iPos >= 0) {
// If it's the same directory, simply return "./"
// Browsers should interpret "./" as the original directory.
if (iPos == to.Length - 1) {
relativePath = "./";
}
else {
relativePath = to.Substring(iPos + 1);
}
}
else {
relativePath = to;
}
}
else {
// To avoid deprecation warning. It says we should use MakeRelativeUri instead (which returns a Uri),
// but we wouldn't gain anything from it. The way we use MakeRelative is hacky anyway (fake protocol, ...),
// and I don't want to take the chance of breaking something with this change.
#pragma warning disable 0618
relativePath = fromUri.MakeRelative(toUri);
#pragma warning restore 0618
}
// Note that we need to re-append the query string and fragment (e.g. #anchor)
return relativePath + queryString + toUri.Fragment;
}
internal static string GetDirectoryOrRootName(string path) {
string dir;
dir = Path.GetDirectoryName(path);
if (dir == null) {
dir = Path.GetPathRoot(path);
}
return dir;
}
internal static string GetFileName(string virtualPath) {
// Code copied from CLR\BCL\System\IO\Path.cs
// - Check for invalid chars removed
// - Only '/' is used as separator (path.cs also used '\' and ':')
if (virtualPath != null) {
int length = virtualPath.Length;
for (int i = length; --i >= 0;) {
char ch = virtualPath[i];
if (ch == '/')
return virtualPath.Substring(i + 1, length - i - 1);
}
}
return virtualPath;
}
internal static string GetFileNameWithoutExtension(string virtualPath) {
// Code copied from CLR\BCL\System\IO\Path.cs
// - Check for invalid chars removed
virtualPath = GetFileName(virtualPath);
if (virtualPath != null) {
int i;
if ((i=virtualPath.LastIndexOf('.')) == -1)
return virtualPath; // No extension found
else
return virtualPath.Substring(0,i);
}
return null;
}
internal static string GetExtension(string virtualPath) {
if (virtualPath == null)
return null;
int length = virtualPath.Length;
for (int i = length; --i >= 0;) {
char ch = virtualPath[i];
if (ch == '.') {
if (i != length - 1)
return virtualPath.Substring(i, length - i);
else
return String.Empty;
}
if (ch == '/')
break;
}
return String.Empty;
}
internal static bool HasTrailingSlash(string virtualPath) {
return virtualPath[virtualPath.Length - 1] == '/';
}
internal static string AppendSlashToPathIfNeeded(string path) {
if (path == null) return null;
int l = path.Length;
if (l == 0) return path;
if (path[l-1] != '/')
path += '/';
return path;
}
//
// Remove the trailing forward slash ('/') except in the case of the root ("/").
// If the string is null or empty, return null, which represents a machine.config or root web.config.
//
internal static string RemoveSlashFromPathIfNeeded(string path) {
if (string.IsNullOrEmpty(path)) {
return null;
}
int l = path.Length;
if (l <= 1 || path[l-1] != '/') {
return path;
}
return path.Substring(0, l-1);
}
private static bool VirtualPathStartsWithVirtualPath(string virtualPath1, string virtualPath2) {
if (virtualPath1 == null) {
throw new ArgumentNullException("virtualPath1");
}
if (virtualPath2 == null) {
throw new ArgumentNullException("virtualPath2");
}
// if virtualPath1 as a string doesn't start with virtualPath2 as s string, then no for sure
if (!StringUtil.StringStartsWithIgnoreCase(virtualPath1, virtualPath2)) {
return false;
}
int virtualPath2Length = virtualPath2.Length;
// same length - same path
if (virtualPath1.Length == virtualPath2Length) {
return true;
}
// Special case for apps rooted at the root. VSWhidbey 286145
if (virtualPath2Length == 1) {
Debug.Assert(virtualPath2[0] == '/');
return true;
}
// If virtualPath2 ends with a '/', it's definitely a child
if (virtualPath2[virtualPath2Length - 1] == '/')
return true;
// If it doesn't, make sure the next char in virtualPath1 is a '/'.
// e.g. /app1 vs /app11 (VSWhidbey 285038)
if (virtualPath1[virtualPath2Length] != '/') {
return false;
}
// passed all checks
return true;
}
internal static bool VirtualPathStartsWithAppPath(string virtualPath) {
Debug.Assert(HttpRuntime.AppDomainAppVirtualPathObject != null);
return VirtualPathStartsWithVirtualPath(virtualPath,
HttpRuntime.AppDomainAppVirtualPathString);
}
internal static string MakeVirtualPathAppRelative(string virtualPath) {
Debug.Assert(HttpRuntime.AppDomainAppVirtualPathObject != null);
return MakeVirtualPathAppRelative(virtualPath,
HttpRuntime.AppDomainAppVirtualPathString, false /*nullIfNotInApp*/);
}
// Same as MakeVirtualPathAppRelative, but return null if app relative can't be obtained
internal static string MakeVirtualPathAppRelativeOrNull(string virtualPath) {
Debug.Assert(HttpRuntime.AppDomainAppVirtualPathObject != null);
return MakeVirtualPathAppRelative(virtualPath,
HttpRuntime.AppDomainAppVirtualPathString, true /*nullIfNotInApp*/);
}
// If a virtual path starts with the app path, make it start with
// ~ instead, so that it becomes application agnostic
// E.g. /MyApp/Sub/foo.aspx --> ~/Sub/foo.aspx
internal static string MakeVirtualPathAppRelative(string virtualPath,
string applicationPath, bool nullIfNotInApp) {
if (virtualPath == null)
throw new ArgumentNullException("virtualPath");
Debug.Assert(applicationPath[0] == '/');
Debug.Assert(HasTrailingSlash(applicationPath));
int appPathLength = applicationPath.Length;
int virtualPathLength = virtualPath.Length;
// If virtualPath is the same as the app path, but without the ending slash,
// treat it as if it were truly the app path (VSWhidbey 495949)
if (virtualPathLength == appPathLength - 1) {
if (StringUtil.StringStartsWithIgnoreCase(applicationPath, virtualPath))
return appRelativeCharacterString;
}
if (!VirtualPathStartsWithVirtualPath(virtualPath, applicationPath)) {
// If it doesn't start with the app path, return either null or the input path
if (nullIfNotInApp)
return null;
else
return virtualPath;
}
// If they are the same, just return "~/"
if (virtualPathLength == appPathLength)
return appRelativeCharacterString;
// Special case for apps rooted at the root:
if (appPathLength == 1) {
return appRelativeCharacter + virtualPath;
}
return appRelativeCharacter + virtualPath.Substring(appPathLength-1);
}
internal static string MakeVirtualPathAppAbsolute(string virtualPath) {
Debug.Assert(HttpRuntime.AppDomainAppVirtualPathObject != null);
return MakeVirtualPathAppAbsolute(virtualPath, HttpRuntime.AppDomainAppVirtualPathString);
}
// If a virtual path is app relative (i.e. starts with ~/), change it to
// start with the actuall app path.
// E.g. ~/Sub/foo.aspx --> /MyApp/Sub/foo.aspx
internal static string MakeVirtualPathAppAbsolute(string virtualPath, string applicationPath) {
// If the path is exactly "~", just return the app root path
if (virtualPath.Length == 1 && virtualPath[0] == appRelativeCharacter)
return applicationPath;
// If the virtual path starts with "~/" or "~\", replace with the app path
// relative (ASURT 68628)
if (virtualPath.Length >=2 && virtualPath[0] == appRelativeCharacter &&
(virtualPath[1] == '/' || virtualPath[1] == '\\')) {
if (applicationPath.Length > 1) {
Debug.Assert(HasTrailingSlash(applicationPath));
return applicationPath + virtualPath.Substring(2);
}
else
return "/" + virtualPath.Substring(2);
}
// Don't allow relative paths, since they cannot be made App Absolute
if (!IsRooted(virtualPath))
throw new ArgumentOutOfRangeException("virtualPath");
// Return it unchanged
return virtualPath;
}
// To be called by APIs accepting virtual path that is expectedto be within the app.
// returns reduced absolute virtual path or throws
internal static string MakeVirtualPathAppAbsoluteReduceAndCheck(string virtualPath) {
if (virtualPath == null) {
throw new ArgumentNullException("virtualPath");
}
string path = Reduce(MakeVirtualPathAppAbsolute(virtualPath));
if (!UrlPath.VirtualPathStartsWithAppPath(path)) {
throw new ArgumentException(SR.GetString(SR.Invalid_app_VirtualPath, virtualPath));
}
return path;
}
internal static bool PathEndsWithExtraSlash(String path) {
if (path == null)
return false;
int l = path.Length;
if (l == 0 || path[l-1] != '\\')
return false;
if (l == 3 && path[1] == ':') // c:\ case
return false;
return true;
}
internal static bool PathIsDriveRoot(string path) {
if (path != null) {
int l = path.Length;
if (l == 3 && path[1] == ':' && path[2] == '\\') {
return true;
}
}
return false;
}
//
// NOTE: This function is also present in fx\src\configuration\system\configuration\urlpath.cs
// Please propagate any changes to that file.
//
// Determine if subpath is a subpath of path.
// For example, /myapp/foo.aspx is a subpath of /myapp
// Account for optional trailing slashes.
//
internal static bool IsEqualOrSubpath(string path, string subpath) {
if (String.IsNullOrEmpty(path))
return true;
if (String.IsNullOrEmpty(subpath))
return false;
//
// Compare up to but not including trailing slash
//
int lPath = path.Length;
if (path[lPath - 1] == '/') {
lPath -= 1;
}
int lSubpath = subpath.Length;
if (subpath[lSubpath - 1] == '/') {
lSubpath -= 1;
}
if (lSubpath < lPath)
return false;
if (!StringUtil.EqualsIgnoreCase(path, 0, subpath, 0, lPath))
return false;
// Check subpath that character following length of path is a slash
if (lSubpath > lPath && subpath[lPath] != '/')
return false;
return true;
}
internal static bool IsPathOnSameServer(string absUriOrLocalPath, Uri currentRequestUri)
{
// Assuming
// (1) currentRequestUri does belong to the THIS host
// (2) absUriOrLocalPath is allowed to have different scheme like file:// or https://
// (3) absUriOrLocalPath is allowed to point "above" the currentRequestUri path
Uri absUri;
if (!Uri.TryCreate(absUriOrLocalPath, UriKind.Absolute, out absUri)) {
// MSRC 11063
// A failure to construct absolute url (by System.Uri) doesn't implictly mean the url is relative (on the same server)
// Make sure the url path can't be recognized as absolute
return AppSettings.AllowRelaxedRelativeUrl ||
((IsRooted(absUriOrLocalPath) || IsRelativeUrl(absUriOrLocalPath)) && !absUriOrLocalPath.TrimStart(' ').StartsWith("//", StringComparison.Ordinal));
}
return absUri.IsLoopback || string.Equals(currentRequestUri.Host, absUri.Host, StringComparison.OrdinalIgnoreCase);
}
}
}
|