コード例 #1
0
 // Token: 0x060011C4 RID: 4548 RVA: 0x0004AA84 File Offset: 0x00048C84
 public Uri CreateUri(Uri ewsUri, string emailAddress)
 {
     ArgumentValidator.ThrowIfNull("ewsUri", ewsUri);
     return(new UriBuilder(ewsUri)
     {
         Path = HttpPhotoRequestBuilder.RemoveTrailingSlash(ewsUri.AbsolutePath) + this.configuration.PhotoServiceEndpointRelativeToEwsWithLeadingSlash,
         Query = "email=" + emailAddress
     }.Uri);
 }
コード例 #2
0
 // Token: 0x060011C5 RID: 4549 RVA: 0x0004AADC File Offset: 0x00048CDC
 private Uri CreateUri(Uri ewsUri, PhotoRequest request)
 {
     return(new UriBuilder(ewsUri)
     {
         Path = HttpPhotoRequestBuilder.RemoveTrailingSlash(ewsUri.AbsolutePath) + this.configuration.PhotoServiceEndpointRelativeToEwsWithLeadingSlash,
         Query = string.Concat(new string[]
         {
             PhotoSizeArgumentStrings.Get(request.Size),
             "&email=",
             HttpPhotoRequestBuilder.GetTargetEmailAddress(request),
             HttpPhotoRequestBuilder.GetPreviewQueryStringParameter(request),
             HttpPhotoRequestBuilder.GetHandlersToSkipQueryStringParametersWithLeadingAmpersand(request)
         })
     }.Uri);
 }
コード例 #3
0
        // Token: 0x060011A6 RID: 4518 RVA: 0x0004A028 File Offset: 0x00048228
        public PhotoResponse Retrieve(PhotoRequest request, PhotoResponse response)
        {
            ArgumentValidator.ThrowIfNull("request", request);
            ArgumentValidator.ThrowIfNull("response", response);
            PhotoResponse result;

            using (new StopwatchPerformanceTracker("HttpHandlerTotal", request.PerformanceLogger))
            {
                using (new ADPerformanceTracker("HttpHandlerTotal", request.PerformanceLogger))
                {
                    if (request.ShouldSkipHandlers(PhotoHandlers.Http))
                    {
                        this.tracer.TraceDebug((long)this.GetHashCode(), "HTTP HANDLER: skipped by request.");
                        result = response;
                    }
                    else if (response.Served)
                    {
                        this.tracer.TraceDebug((long)this.GetHashCode(), "HTTP HANDLER: skipped because photo has already been served by an upstream handler.");
                        result = response;
                    }
                    else if (request.TargetRecipient == null || !(request.TargetRecipient is ADUser))
                    {
                        this.tracer.TraceDebug((long)this.GetHashCode(), "HTTP HANDLER: skipped because target recipient has not been initialized OR is of unexpected type.");
                        result = response;
                    }
                    else
                    {
                        response.HttpHandlerProcessed = true;
                        request.PerformanceLogger.Log("HttpHandlerProcessed", string.Empty, 1U);
                        try
                        {
                            HttpWebRequest httpRequestToConfigure = new HttpPhotoRequestBuilder(this.configuration, this.tracer).Build(this.LocatePhotoService(request), request, this.outgoingRequestProxyProvider, request.Trace);
                            using (HttpWebResponse httpWebResponse = this.ConfigureAndSendRequest(request, httpRequestToConfigure))
                            {
                                result = this.ProcessResponseFromRemoteServer(request, response, httpWebResponse);
                            }
                        }
                        catch (WebException ex)
                        {
                            this.WriteTracesCollectedByRemoteServerOntoLocalTracer(ex.Response);
                            HttpStatusCode httpStatusCodeFromWebException = HttpPhotoHandler.GetHttpStatusCodeFromWebException(ex);
                            this.tracer.TraceDebug <HttpStatusCode, WebExceptionStatus>((long)this.GetHashCode(), "HTTP HANDLER: caught WebException and translated it to HTTP {0}.  Web exception status: {1}", httpStatusCodeFromWebException, ex.Status);
                            HttpStatusCode httpStatusCode = httpStatusCodeFromWebException;
                            if (httpStatusCode <= HttpStatusCode.Unauthorized)
                            {
                                if (httpStatusCode == HttpStatusCode.NotModified)
                                {
                                    response.Served            = true;
                                    response.Status            = HttpStatusCode.NotModified;
                                    response.HttpExpiresHeader = HttpPhotoHandler.GetHeaderValueFromWebException(ex, HttpResponseHeader.Expires);
                                    response.ETag = HttpPhotoHandler.GetHeaderValueFromWebException(ex, HttpResponseHeader.ETag);
                                    return(response);
                                }
                                if (httpStatusCode == HttpStatusCode.Unauthorized)
                                {
                                    response.Status = HttpStatusCode.Unauthorized;
                                    request.PerformanceLogger.Log("HttpHandlerError", string.Empty, 1U);
                                    return(response);
                                }
                            }
                            else
                            {
                                if (httpStatusCode == HttpStatusCode.NotFound)
                                {
                                    response.Served            = true;
                                    response.Status            = HttpStatusCode.NotFound;
                                    response.HttpExpiresHeader = HttpPhotoHandler.GetHeaderValueFromWebException(ex, HttpResponseHeader.Expires);
                                    return(response);
                                }
                                if (httpStatusCode != HttpStatusCode.InternalServerError)
                                {
                                }
                            }
                            response.Status = HttpStatusCode.InternalServerError;
                            request.PerformanceLogger.Log("HttpHandlerError", string.Empty, 1U);
                            result = response;
                        }
                        catch (BackEndLocatorException arg)
                        {
                            this.tracer.TraceError <BackEndLocatorException>((long)this.GetHashCode(), "HTTP HANDLER: failed to locate service.  Exception: {0}", arg);
                            request.PerformanceLogger.Log("HttpHandlerError", string.Empty, 1U);
                            result = response;
                        }
                        catch (IOException arg2)
                        {
                            this.tracer.TraceError <IOException>((long)this.GetHashCode(), "HTTP HANDLER: request to remote server failed with I/O exception: {0}", arg2);
                            request.PerformanceLogger.Log("HttpHandlerError", string.Empty, 1U);
                            result = response;
                        }
                        catch (ProtocolViolationException arg3)
                        {
                            this.tracer.TraceError <ProtocolViolationException>((long)this.GetHashCode(), "HTTP HANDLER: request to remote server failed with a protocol violation.  Exception: {0}", arg3);
                            request.PerformanceLogger.Log("HttpHandlerError", string.Empty, 1U);
                            result = response;
                        }
                        catch (InvalidOperationException arg4)
                        {
                            this.tracer.TraceError <InvalidOperationException>((long)this.GetHashCode(), "HTTP HANDLER: request to remote server failed with invalid operation.  Exception: {0}", arg4);
                            request.PerformanceLogger.Log("HttpHandlerError", string.Empty, 1U);
                            result = response;
                        }
                        catch (NotSupportedException arg5)
                        {
                            this.tracer.TraceError <NotSupportedException>((long)this.GetHashCode(), "HTTP HANDLER: request to remote server with an unsupported operation.  Exception: {0}", arg5);
                            request.PerformanceLogger.Log("HttpHandlerError", string.Empty, 1U);
                            result = response;
                        }
                        catch (TimeoutException arg6)
                        {
                            this.tracer.TraceError <TimeoutException>((long)this.GetHashCode(), "HTTP HANDLER: timed out.  Exception: {0}", arg6);
                            request.PerformanceLogger.Log("HttpHandlerError", string.Empty, 1U);
                            result = response;
                        }
                        catch (TransientException arg7)
                        {
                            this.tracer.TraceError <TransientException>((long)this.GetHashCode(), "HTTP HANDLER: failed with a transient error.  Exception: {0}", arg7);
                            request.PerformanceLogger.Log("HttpHandlerError", string.Empty, 1U);
                            result = response;
                        }
                    }
                }
            }
            return(result);
        }