// Token: 0x060000F6 RID: 246 RVA: 0x00004394 File Offset: 0x00002594 internal ConnectResponse Execute(ConnectRequest connectRequest, IServerCapabilities requiredCapabilities) { ConnectResponse connectResponse = this.Execute(connectRequest); connectResponse.UserSmtpAddressString = base.EasConnectionSettings.EasEndpointSettings.UserSmtpAddressString; if (connectResponse.ConnectStatus != ConnectStatus.Success || requiredCapabilities == null) { return(connectResponse); } OptionsCommand optionsCommand = new OptionsCommand(base.EasConnectionSettings); OptionsResponse optionsResponse = optionsCommand.Execute(new OptionsRequest()); connectResponse.OptionsResponse = optionsResponse; EasServerCapabilities easServerCapabilities = optionsResponse.EasServerCapabilities; if (easServerCapabilities.Supports(requiredCapabilities)) { base.EasConnectionSettings.ExtensionCapabilities = optionsResponse.EasExtensionCapabilities; return(connectResponse); } IEnumerable <string> values = requiredCapabilities.NotIn(easServerCapabilities); string text = string.Join(", ", values); base.EasConnectionSettings.Log.Debug("ConnectCommand, missing capabilities: '{0}'.", new object[] { text }); throw new MissingCapabilitiesException(text); }
public void MSASHTTP_S04_TC01_HTTPOPTIONS() { #region Call HTTP OPTIONS command. OptionsResponse optionsResponse = this.HTTPAdapter.HTTPOPTIONS(); Site.Assert.AreEqual <HttpStatusCode>(HttpStatusCode.OK, optionsResponse.StatusCode, "The StatusCode of HTTP OPTIONS command response should be OK, actual {0}.", optionsResponse.StatusCode); #endregion }
/// <summary> /// Send HTTP OPTIONS request to the server and get the response. /// </summary> /// <returns>The HTTP OPTIONS response.</returns> public OptionsResponse HTTPOPTIONS() { OptionsResponse optionsResponse = this.activeSyncClient.Options(); Site.Assert.IsNotNull(optionsResponse, "The HTTP OPTIONS response returned from server should not be null."); this.VerifyHTTPOPTIONSResponse(optionsResponse); this.VerifyTransportType(); return(optionsResponse); }
public OptionsResponse GetOptionsByProfile([FromBody] OptionsRequest request) { OptionsResponse response = new OptionsResponse(); MOptions option = new MOptions(); List <MOptions> options = new List <MOptions>(); try { /*METODO QUE VALIDA EL TOKEN DE APLICACIÓN*/ if (!BAplication.ValidateAplicationToken(request.ApplicationToken)) { response.Code = "2"; response.Message = Messages.ApplicationTokenNoAutorize; return(response); } /*************FIN DEL METODO*************/ option.ProfileId = request.Options.ProfileId; int Val = 0; options = BOptions.Sel(option, ref Val); if (Val.Equals(0)) { response.Code = "0"; //0=> Ëxito | 1=> Validación de Sistema | 2 => Error de Excepción response.Message = Messages.Success; } else if (Val.Equals(2)) { response.Code = "2"; //0=> Ëxito | 1=> Validación de Sistema | 2 => Error de Excepción response.Message = String.Format(Messages.ErrorObtainingReults, "options"); } else { response.Code = "1"; //0=> Ëxito | 1=> Validación de Sistema | 2 => Error de Excepción response.Message = String.Format(Messages.NotReults, "options"); } } catch (Exception ex) { response.Code = "2"; //0=> Ëxito | 1=> Validación de Sistema | 2 => Error de Excepción response.Message = ex.Message; } response.Options = options.ToArray(); return(response); }
/// <summary> /// Verify requirements about HTTP OPTIONS response headers. /// </summary> /// <param name="optionsResponse">The HTTP OPTIONS response.</param> private void VerifyHTTPOPTIONSHeaders(OptionsResponse optionsResponse) { string commandHeaders = optionsResponse.Headers["MS-ASProtocolCommands"]; string versionHeaders = optionsResponse.Headers["MS-ASProtocolVersions"]; Site.Log.Add(LogEntryKind.Debug, "The MS-ASProtocolCommands header in response is: {0}.", commandHeaders); Site.Log.Add(LogEntryKind.Debug, "The MS-ASProtocolVersions header in response is: {0}.", versionHeaders); if (Common.IsRequirementEnabled(459, Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R459"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R459 // There is "12.1" in MS-ASProtocolVersions header, so this requirement can be captured. Site.CaptureRequirementIfIsTrue( versionHeaders.Contains("12.1"), 459, @"[In Appendix A: Product Behavior] Implementation does return the MS-ASProtocolVersions value of 12.1. (Exchange 2007 SP1 and above follow this behavior.)"); } if (Common.IsRequirementEnabled(460, Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R460"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R460 // There is "14.0" in MS-ASProtocolVersions header, so this requirement can be captured. Site.CaptureRequirementIfIsTrue( versionHeaders.Contains("14.0"), 460, @"[In Appendix A: Product Behavior] Implementation does return the MS-ASProtocolVersions value of 14.0. (Exchange 2010 and above follow this behavior.)"); } if (Common.IsRequirementEnabled(461, Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R461"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R461 // There is "14.1" in MS-ASProtocolVersions header, so this requirement can be captured. Site.CaptureRequirementIfIsTrue( versionHeaders.Contains("14.1"), 461, @"[In Appendix A: Product Behavior] Implementation does return the MS-ASProtocolVersions value of 14.1. (Exchange 2013 and above follow this behavior.)"); } if (Common.IsRequirementEnabled(1201, Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R1201"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R1201 // There is "16.0" in MS-ASProtocolVersions header, so this requirement can be captured. Site.CaptureRequirementIfIsTrue( versionHeaders.Contains("16.0"), 1201, @"[In Appendix A: Product Behavior] Implementation does return the MS-ASProtocolVersions value of 16.0. (Exchange 2016 Preview and above follow this behavior.)"); } if (Common.IsRequirementEnabled(12011, Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R12011"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R12011 // There is "16.1" in MS-ASProtocolVersions header, so this requirement can be captured. Site.CaptureRequirementIfIsTrue( versionHeaders.Contains("16.1"), 12011, @"[In Appendix A: Product Behavior] Implementation does return the MS-ASProtocolVersions value of 16.1. (Exchange 2016 Preview and above follow this behavior.)"); } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R249"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R249 // R459, R460 and R461 are captured which means implementation returns MS-ASProtocolVersions value of 12.1, 14.0, 14.1,16.0 or 16.1, so this requirement can be captured directly. Site.CaptureRequirement( 249, @"[In MS-ASProtocolVersions] The following values [MS-ASProtocolVersions] correspond to the ActiveSync protocol versions that are specified by [MS-ASCMD]:""16.1"", ""16.0"", ""14.1"", ""14.0"", ""12.1"", ""12.0"" and ""2.5""."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R1107"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R1107 Site.CaptureRequirementIfIsTrue( !string.IsNullOrEmpty(commandHeaders) && !string.IsNullOrEmpty(versionHeaders), 1107, @"[In Handling HTTP OPTIONS Command] The server's response MUST contain both the MS-ASProtocolCommands header, as specified in section 2.2.4.1.2.1, and the MS-ASProtocolVersions header, as specified in section 2.2.4.1.2.2."); string[] splitCommand = commandHeaders.Split(','); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R247"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R247 // The MS-ASProtocolCommands header is split by ",", so this requirement can be captured. Site.CaptureRequirementIfIsTrue( splitCommand.Length > 1, 247, @"[In MS-ASProtocolCommands] The MS-ASProtocolCommands header contains a comma-delimited list of the ActiveSync commands supported by the server."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R238"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R238 // R291 is captured, so this requirement can be captured. Site.CaptureRequirement( 238, @"[In HTTP OPTIONS Response] After receiving an HTTP OPTIONS request, a server responds with an HTTP OPTIONS response that specifies the protocol versions it supports."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R296"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R296 // After R459, R460 and R461 are captured which means implementation returns MS-ASProtocolVersions value of 12.1, 14.0 or 14.1, so this requirement can be captured. Site.CaptureRequirement( 296, @"[In Handling HTTP OPTIONS Command] A protocol server can support multiple versions of the ActiveSync protocol."); if (Common.IsRequirementEnabled(298, Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R298"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R298 // When the server version is ExchangeServer2007, 14.0, 14.1,16.0 and 16.1 are not returned, this requirement can be captured. Site.CaptureRequirementIfIsTrue( !versionHeaders.Contains("14.0") && !versionHeaders.Contains("14.1") && !versionHeaders.Contains("16.0") && !versionHeaders.Contains("16.1"), 298, @"[In Appendix A: Product Behavior] Implementation does not return MS-ASProtocolVersions values of 16.1,16.0, 14.1 or 14.0. (<11> Section 3.2.5.2: Exchange 2007 SP1 does not return the value ""16.1"",""16.0"", ""14.1"", or ""14.0"" in the MS-ASProtocolVersions header.)"); } }
/// <summary> /// Verify requirements about HTTP OPTIONS response. /// </summary> /// <param name="optionsResponse">The HTTP OPTIONS response.</param> private void VerifyHTTPOPTIONSResponse(OptionsResponse optionsResponse) { this.VerifyHTTPResponse(); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R319"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R319 // The HTTP OPTIONS command executes successfully, so this requirement can be captured. Site.CaptureRequirement( 319, @"[In Transport] Messages are transported by using HTTP OPTIONS, as specified in [RFC2616]."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R239"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R239 // The HTTP OPTIONS command executes successfully, so this requirement can be captured. Site.CaptureRequirement( 239, @"[In Response Format] Each response is sent from the server to the client as an HTTP OPTIONS response."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R240"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R240 // The HTTP OPTIONS command executes successfully, so this requirement can be captured. Site.CaptureRequirement( 240, @"[In Response Format] Note that these [sent from the server to the client as an HTTP OPTIONS] responses are UTF-8 encoded."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R241"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R241 // The HTTP OPTIONS command executes successfully and raw http response is converted successfully, so this requirement can be captured. Site.CaptureRequirement( 241, @"[In Response Format] As specified by [RFC2616], the format is the same as for the following requests: Status-line Response-headers"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R244"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R244 // The HTTP OPTIONS command executes successfully and raw http response is converted successfully, so this requirement can be captured. Site.CaptureRequirement( 244, @"[In Response Headers] The headers [MS-ASProtocolCommands,MS-ASProtocolVersions] follow the status line in the HTTP part of a response."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R450"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R450 // The HTTP OPTIONS command executes successfully, so this requirement can be captured. Site.CaptureRequirement( 450, @"[In Message Processing Events and Sequencing Rules] The server can receive [HTTP POST requests (section 2.2.1) or] HTTP OPTIONS requests (section 2.2.3) from the client."); this.VerifyHTTPOPTIONSHeaders(optionsResponse); }
/// <summary> /// Verify requirements about HTTP OPTIONS response headers. /// </summary> /// <param name="optionsResponse">The HTTP OPTIONS response.</param> private void VerifyHTTPOPTIONSHeaders(OptionsResponse optionsResponse) { string commandHeaders = optionsResponse.Headers["MS-ASProtocolCommands"]; string versionHeaders = optionsResponse.Headers["MS-ASProtocolVersions"]; Site.Log.Add(LogEntryKind.Debug, "The MS-ASProtocolCommands header in response is: {0}.", commandHeaders); Site.Log.Add(LogEntryKind.Debug, "The MS-ASProtocolVersions header in response is: {0}.", versionHeaders); if (Common.IsRequirementEnabled(459, Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R459"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R459 // There is "12.1" in MS-ASProtocolVersions header, so this requirement can be captured. Site.CaptureRequirementIfIsTrue( versionHeaders.Contains("12.1"), 459, @"[In Appendix A: Product Behavior] Implementation does return the MS-ASProtocolVersions value of 12.1. (Exchange 2007 SP1 and above follow this behavior.)"); } if (Common.IsRequirementEnabled(460, Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R460"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R460 // There is "14.0" in MS-ASProtocolVersions header, so this requirement can be captured. Site.CaptureRequirementIfIsTrue( versionHeaders.Contains("14.0"), 460, @"[In Appendix A: Product Behavior] Implementation does return the MS-ASProtocolVersions value of 14.0. (Exchange 2010 and above follow this behavior.)"); } if (Common.IsRequirementEnabled(461, Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R461"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R461 // There is "14.1" in MS-ASProtocolVersions header, so this requirement can be captured. Site.CaptureRequirementIfIsTrue( versionHeaders.Contains("14.1"), 461, @"[In Appendix A: Product Behavior] Implementation does return the MS-ASProtocolVersions value of 14.1. (Exchange 2013 and above follow this behavior.)"); } if (Common.IsRequirementEnabled(1201, Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R1201"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R1201 // There is "16.0" in MS-ASProtocolVersions header, so this requirement can be captured. Site.CaptureRequirementIfIsTrue( versionHeaders.Contains("16.0"), 1201, @"[In Appendix A: Product Behavior] Implementation does return the MS-ASProtocolVersions value of 16.0. (Exchange 2016 Preview and above follow this behavior.)"); } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R249"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R249 // R459, R460 and R461 are captured which means implementation returns MS-ASProtocolVersions value of 12.1, 14.0, 14.1 or 16.0, so this requirement can be captured directly. Site.CaptureRequirement( 249, @"[In MS-ASProtocolVersions] The following values [MS-ASProtocolVersions] correspond to the ActiveSync protocol versions that are specified by [MS-ASCMD]: ""16.0"", ""14.1"", ""14.0"", ""12.1"", ""12.0"" and ""2.5""."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R1107"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R1107 Site.CaptureRequirementIfIsTrue( !string.IsNullOrEmpty(commandHeaders) && !string.IsNullOrEmpty(versionHeaders), 1107, @"[In Handling HTTP OPTIONS Command] The server's response MUST contain both the MS-ASProtocolCommands header, as specified in section 2.2.4.1.2.1, and the MS-ASProtocolVersions header, as specified in section 2.2.2.1.2.8."); string[] splitCommand = commandHeaders.Split(','); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R247"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R247 // The MS-ASProtocolCommands header is split by ",", so this requirement can be captured. Site.CaptureRequirementIfIsTrue( splitCommand.Length > 1, 247, @"[In MS-ASProtocolCommands] The MS-ASProtocolCommands header contains a comma-delimited list of the ActiveSync commands supported by the server."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R238"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R238 // R291 is captured, so this requirement can be captured. Site.CaptureRequirement( 238, @"[In HTTP OPTIONS Response] After receiving an HTTP OPTIONS request, a server responds with an HTTP OPTIONS response that specifies the protocol versions it supports."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R296"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R296 // After R459, R460 and R461 are captured which means implementation returns MS-ASProtocolVersions value of 12.1, 14.0 or 14.1, so this requirement can be captured. Site.CaptureRequirement( 296, @"[In Handling HTTP OPTIONS Command] A protocol server can support multiple versions of the ActiveSync protocol."); if (Common.IsRequirementEnabled(298, Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASHTTP_R298"); // Verify MS-ASHTTP requirement: MS-ASHTTP_R298 // When the server version is ExchangeServer2007, 14.0, 14.1 and 16.0 are not returned, this requirement can be captured. Site.CaptureRequirementIfIsTrue( !versionHeaders.Contains("14.0") && !versionHeaders.Contains("14.1") && !versionHeaders.Contains("16.0"), 298, @"[In Appendix A: Product Behavior] Implementation does not return MS-ASProtocolVersions values of 16.0, 14.1 or 14.0. (<10> Section 3.2.5.2: Exchange 2007 SP1 does not return the value ""16.0"", ""14.1"", or ""14.0"" in the MS-ASProtocolVersions header.)"); } }