Example #1
0
 public static void BeginInsertRequest(SessionHandler oSessionHndlr)
 {
     try
     {
         if (oSessionHndlr == null || ProxyServiceManager.Proxydb == null)
         {
             return;
         }
         MIMETypeIdentifier.GetStreamMIMEType(oSessionHndlr, oSessionHndlr.RequestRawData, true);
         oSessionHndlr.RequestID = ProxyServiceManager.Proxydb.InsertRequestDetails(oSessionHndlr.RequestStarted,
                                                                                    oSessionHndlr.ClientName,
                                                                                    (ushort)oSessionHndlr.ClientID,
                                                                                    oSessionHndlr.HostName,
                                                                                    oSessionHndlr.FirstHeaderLine,
                                                                                    oSessionHndlr.RequestURL,
                                                                                    oSessionHndlr.Method,
                                                                                    oSessionHndlr.IPAddress + ":" + oSessionHndlr.Port,
                                                                                    (int)oSessionHndlr.ThreadIndex,
                                                                                    oSessionHndlr.RequestHeadersRawData,
                                                                                    oSessionHndlr.RequestRawData,
                                                                                    oSessionHndlr.UploadStream.MIME_DLL,
                                                                                    oSessionHndlr.UploadStream.MIME_Signature, oSessionHndlr.RequestEnded);
     }
     catch (Exception ex)
     {
         ////oSessionHndlr.Logger.Logger.Error(ex);
     }
 }
Example #2
0
        public static void BeginInsertResponse(SessionHandler oSessionHndlr)
        {
            try
            {
                if (oSessionHndlr == null || ProxyServiceManager.Proxydb == null)
                {
                    return;
                }

                while (oSessionHndlr.RequestID == -1)
                {
                    oSessionHndlr.RequestInsertAttempt++;
                    Thread.Sleep(1000);
                    if (oSessionHndlr.RequestInsertAttempt > 60)
                    {
                        //oSessionHndlr.Logger.Logger.Error("Error in inserting Response");
                        return;
                    }
                }
                if (oSessionHndlr.StatusCode == 206)
                {
                    IsFirstPacket(oSessionHndlr);
                }

                if (oSessionHndlr.ResponseRawData != null && (oSessionHndlr.StatusCode == 200 || oSessionHndlr.IsPartialFirst))
                {
                    MIMETypeIdentifier.GetStreamMIMEType(oSessionHndlr, oSessionHndlr.ResponseRawData, false);
                }
                if (oSessionHndlr != null)
                {
                    ProxyServiceManager.Proxydb.InsertResponseDetails(oSessionHndlr.ResponseStarted, oSessionHndlr.RequestID,
                                                                      oSessionHndlr.StatusCode,
                                                                      oSessionHndlr.ContentMimeType,
                                                                      oSessionHndlr.ResponseHeadersRawData,
                                                                      oSessionHndlr.ResponseRawData,
                                                                      oSessionHndlr.DownloadStream.MIME_DLL,
                                                                      oSessionHndlr.DownloadStream.MIME_Signature, oSessionHndlr.ResponseEnded);
                }
            }
            catch (Exception ex)
            {
                ////oSessionHndlr.Logger.Logger.Error(ex);
            }
        }