本文整理汇总了C#中MindTouch.Dream.XUri.WithoutCredentialsPathQueryFragment方法的典型用法代码示例。如果您正苦于以下问题:C# XUri.WithoutCredentialsPathQueryFragment方法的具体用法?C# XUri.WithoutCredentialsPathQueryFragment怎么用?C# XUri.WithoutCredentialsPathQueryFragment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MindTouch.Dream.XUri
的用法示例。
在下文中一共展示了XUri.WithoutCredentialsPathQueryFragment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SubmitRequestAsync
private Result<DreamMessage> SubmitRequestAsync(string verb, XUri uri, IPrincipal user, DreamMessage request, Result<DreamMessage> response, Action completion)
{
if(string.IsNullOrEmpty(verb)) {
if(completion != null) {
completion();
}
throw new ArgumentNullException("verb");
}
if(uri == null) {
if(completion != null) {
completion();
}
throw new ArgumentNullException("uri");
}
if(request == null) {
if(completion != null) {
completion();
}
throw new ArgumentNullException("request");
}
if(response == null) {
if(completion != null) {
completion();
}
throw new ArgumentNullException("response");
}
// ensure environment is still running
if(!IsRunning) {
response.Return(DreamMessage.InternalError("host not running"));
if(completion != null) {
completion();
}
return response;
}
try {
Interlocked.Increment(ref _requestCounter);
// check if we were not able to begin processing the request
DreamMessage failed = BeginRequest(completion, uri, request);
if(failed != null) {
response.Return(failed);
EndRequest(completion, uri, request);
return response;
}
// check if 'verb' is overwritten by a processing parameter
verb = verb.ToUpperInvariant();
string requestedVerb = (uri.GetParam(DreamInParam.VERB, null) ?? request.Headers.MethodOverride ?? verb).ToUpperInvariant();
if(
verb.EqualsInvariant(Verb.POST) || (
verb.EqualsInvariant(Verb.GET) && (
requestedVerb.EqualsInvariant(Verb.OPTIONS) ||
requestedVerb.EqualsInvariant(Verb.HEAD)
)
)
) {
verb = requestedVerb;
}
// check if an origin was specified
request.Headers.DreamOrigin = uri.GetParam(DreamInParam.ORIGIN, request.Headers.DreamOrigin);
// check if a public uri is supplied
XUri publicUri = XUri.TryParse(uri.GetParam(DreamInParam.URI, null) ?? request.Headers.DreamPublicUri);
XUri transport = XUri.TryParse(request.Headers.DreamTransport) ?? uri.WithoutCredentialsPathQueryFragment();
if(publicUri == null) {
// check if request is local
if(transport.Scheme.EqualsInvariantIgnoreCase("local")) {
// local:// uris with no public-uri specifier default to the configured public-uri
publicUri = _publicUri;
} else {
// check if the request was forwarded through Apache mod_proxy
string proxyOverride = uri.GetParam(DreamInParam.HOST, null);
if(string.IsNullOrEmpty(proxyOverride)) {
proxyOverride = request.Headers.ForwardedHost;
}
string serverPath = string.Join("/", transport.Segments);
if(proxyOverride != null) {
// request used an override, append path of public-uri
serverPath = string.Join("/", _publicUri.Segments);
}
// set the uri scheme based-on the incoming scheme and the override header
string scheme = transport.Scheme;
if("On".EqualsInvariantIgnoreCase(request.Headers.FrontEndHttps ?? "")) {
scheme = Scheme.HTTPS;
}
scheme = uri.GetParam(DreamInParam.SCHEME, scheme);
// set the host port
string hostPort = proxyOverride ?? request.Headers.Host ?? uri.HostPort;
publicUri = new XUri(string.Format("{0}://{1}", scheme, hostPort)).AtPath(serverPath);
}
request.Headers.DreamPublicUri = publicUri.ToString();
//.........这里部分代码省略.........