/// <summary> /// Parse the HTTP payload to FSSHTTPB Response message. /// </summary> /// <param name="Responses">Array of Response element that is part of a cell storage service response.</param> /// <param name="bytesFromHTTP">The raw data from HTTP layer.</param> public void TryParseFSSHTTPBResponseMessage(Response[] Responses, byte[] bytesFromHTTP) { if (Responses == null) { return; } byte[][] includeTexts = GetOctetsBinaryForXOP(bytesFromHTTP, false).ToArray(); int index = 0; foreach (Response res in Responses) { // If response is for ONESTORE,set FSSHTTPandWOPIInspector.IsOneStore ture. if (res.Url != null) { if (res.Url.EndsWith(".one") || res.Url.EndsWith(".onetoc2")) { FSSHTTPandWOPIInspector.IsOneStore = true; } else { FSSHTTPandWOPIInspector.IsOneStore = false; } } if (res.SubResponse != null && res.SubResponse.Length > 0) { foreach (SubResponseElementGenericType subres in res.SubResponse) { if (subres.SubResponseData == null) { continue; } if (subres.SubResponseData.Text != null && subres.SubResponseData.Text.Length > 0) { string textValue = subres.SubResponseData.Text[0]; byte[] FSSHTTPBTextBytes = Convert.FromBase64String(textValue); FsshttpbResponse Fsshttpbres = (FsshttpbResponse)ParseFSSHTTPBBytes(FSSHTTPBTextBytes, TrafficDirection.Out); subres.SubResponseData.TextObject = Fsshttpbres; FSSHTTPBBytes.Add(FSSHTTPBTextBytes); } if (subres.SubResponseData.Include != null) { byte[] FSSHTTPBIncludeBytes = includeTexts[index++]; FsshttpbResponse Fsshttpbres = (FsshttpbResponse)ParseFSSHTTPBBytes(FSSHTTPBIncludeBytes, TrafficDirection.Out); subres.SubResponseData.IncludeObject = Fsshttpbres; FSSHTTPBBytes.Add(FSSHTTPBIncludeBytes); } } } } }
/// <summary> /// Parse the HTTP payload to FSSHTTPB Request message. /// </summary> /// <param name="Requests">Array of Request that is part of a cell storage service request.</param> /// <param name="bytesFromHTTP">The raw data from HTTP layer.</param> public void TryParseFSSHTTPBRequestMessage(Request[] Requests, byte[] bytesFromHTTP) { if (Requests == null) { return; } byte[][] includeTexts = GetOctetsBinaryForXOP(bytesFromHTTP, true).ToArray(); int index = 0; foreach (Request req in Requests) { if (req.SubRequest != null && req.SubRequest.Length > 0) { foreach (SubRequestElementGenericType subreq in req.SubRequest) { if (subreq.SubRequestData != null) { if (subreq.SubRequestData.Text != null && subreq.SubRequestData.Text.Length > 0) { string textValue = subreq.SubRequestData.Text[0]; byte[] FSSHTTPBTextBytes = Convert.FromBase64String(textValue); if (!IsFSSHTTPBStart(FSSHTTPBTextBytes)) { return; } FsshttpbRequest Fsshttpbreq = (FsshttpbRequest)ParseFSSHTTPBBytes(FSSHTTPBTextBytes, TrafficDirection.In); subreq.SubRequestData.TextObject = Fsshttpbreq; FSSHTTPBBytes.Add(FSSHTTPBTextBytes); } if (subreq.SubRequestData.Include != null) { byte[] FSSHTTPBIncludeBytes = includeTexts[index++]; FsshttpbRequest Fsshttpbreq = (FsshttpbRequest)ParseFSSHTTPBBytes(FSSHTTPBIncludeBytes, TrafficDirection.In); subreq.SubRequestData.IncludeObject = Fsshttpbreq; FSSHTTPBBytes.Add(FSSHTTPBIncludeBytes); } } } } } }
/// <summary> /// Parse the HTTP payload to FSSHTTPB Response message. /// </summary> /// <param name="Responses">Array of Response element that is part of a cell storage service response.</param> /// <param name="bytesFromHTTP">The raw data from HTTP layer.</param> public void TryParseFSSHTTPBResponseMessage(Response[] Responses, byte[] bytesFromHTTP) { if (Responses == null) { return; } byte[][] includeTexts = GetOctetsBinaryForXOP(bytesFromHTTP, false).ToArray(); int index = 0; foreach (Response res in Responses) { if (res.SubResponse != null && res.SubResponse.Length > 0) { foreach (SubResponseElementGenericType subres in res.SubResponse) { if (subres.SubResponseData == null) { continue; } if (subres.SubResponseData.Text != null && subres.SubResponseData.Text.Length > 0) { string textValue = subres.SubResponseData.Text[0]; byte[] FSSHTTPBTextBytes = Convert.FromBase64String(textValue); FsshttpbResponse Fsshttpbres = (FsshttpbResponse)ParseFSSHTTPBBytes(FSSHTTPBTextBytes, TrafficDirection.Out); subres.SubResponseData.TextObject = Fsshttpbres; FSSHTTPBBytes.Add(FSSHTTPBTextBytes); } if (subres.SubResponseData.Include != null) { byte[] FSSHTTPBIncludeBytes = includeTexts[index++]; FsshttpbResponse Fsshttpbres = (FsshttpbResponse)ParseFSSHTTPBBytes(FSSHTTPBIncludeBytes, TrafficDirection.Out); subres.SubResponseData.IncludeObject = Fsshttpbres; FSSHTTPBBytes.Add(FSSHTTPBIncludeBytes); } } } } }