Esempio n. 1
0
        public string SendTest(string mutatedRequest, string host, int port, bool useSSL)
        {
            HttpRequestInfo reqInfo = new HttpRequestInfo(mutatedRequest, false);

            reqInfo.IsSecure = useSSL;
            reqInfo.Host     = host;
            reqInfo.Port     = port;
            IHttpClient client = _httpClientFactory.MakeClient();

            client.SetNetworkSettings(_netSettings);
            DateTime reqTime = DateTime.Now;


            HttpResponseInfo resp = null;


            TVRequestInfo tvReqInfo = null;

            if (_verbose)
            {
                tvReqInfo = SaveRequest("Custom Test", reqInfo, useSSL, String.Empty, reqTime, reqTime, "");
            }

            try
            {
                resp = client.SendRequest(reqInfo);
            }
            catch
            { }
            DateTime respTime = DateTime.Now;

            string response;

            if (resp != null)
            {
                PatternTracker.Instance.UpdatePatternValues(resp);
                response = resp.ToString();
                if (tvReqInfo != null)
                {
                    tvReqInfo.ResponseTime = DateTime.Now;
                    _trafficFile.UpdateRequestInfo(tvReqInfo);
                    _trafficFile.SaveResponse(tvReqInfo.Id, resp.ToArray());
                }
            }
            else
            {
                response = String.Empty;
            }

            return(response);
        }