Beispiel #1
0
 public string GetRequestBody()
 {
     ////m_SessHandler.LuaLogger.Logger.Info("Getting RequestBody Value");
     if (m_SessHandler.RequestRawData != null)
     {
         return(MessagesDecoder.DecodeMessage(m_SessHandler, false));
     }
     return(string.Empty);
 }
Beispiel #2
0
        public static void ExportToXML(string xmlFilePath, List <SessionHandler> lstSessions)
        {
            try
            {
                if (xmlFilePath != string.Empty)
                {
                    var elementsGroupByLevel = from element in lstSessions
                                               group element by element.ClientID into newgroup
                                               select newgroup;


                    XElement xmlFileForInterDetails = new XElement(ConstantVariables.PACKETDETAILS, from a in elementsGroupByLevel
                                                                   select
                                                                   new XElement(ConstantVariables.CLIENT,
                                                                                from b in a
                                                                                select new XElement(ConstantVariables.PACKETDETAIL,
                                                                                                    new XElement(ConstantVariables.CLIENTID, a.Key),
                                                                                                    new XElement(ConstantVariables.THREADINDEX, b.ThreadIndex),
                                                                                                    new XElement(ConstantVariables.FIRSTHEADERLINE, b.FirstHeaderLine),
                                                                                                    new XElement("URL", b.RequestURL),
                                                                                                    new XElement(ConstantVariables.REQUEST,
                                                                                                                 new XElement(ConstantVariables.HEADERS, from str in b.RequestLines
                                                                                                                              select
                                                                                                                              new XElement(CleanInvalidXmlChars(str.Key, true), CleanInvalidXmlChars(str.Value, false))),
                                                                                                                 new XElement(ConstantVariables.REQUESTBODY, CleanInvalidXmlChars(MessagesDecoder.DecodeMessage(b, false), false))

                                                                                                                 ),
                                                                                                    new XElement(ConstantVariables.RESPONSE,
                                                                                                                 new XElement(ConstantVariables.HEADERS, from str in b.ResponseLines
                                                                                                                              select
                                                                                                                              new XElement(CleanInvalidXmlChars(str.Key, true), CleanInvalidXmlChars(str.Value, false))),
                                                                                                                 new XElement(ConstantVariables.RESPONSEBODY, CleanInvalidXmlChars(MessagesDecoder.DecodeMessage(b, true), false))
                                                                                                                 ))));

                    xmlFileForInterDetails.Save(xmlFilePath, System.Xml.Linq.SaveOptions.DisableFormatting);
                }
            }
            catch (Exception ex)
            {
                ////TCPClientProcessor.Proxylog.Logger.Error(ex);
            }
        }