Add IPMonitor

This commit is contained in:
2025-04-27 00:33:08 -04:00
parent 11c6f7357b
commit 9ad444762a
14 changed files with 699 additions and 52 deletions

View File

@@ -216,8 +216,6 @@ namespace MarketData.Integration
HttpWebResponse webResponse=null;
try
{
// ServicePointManager.Expect100Continue=true;
// ServicePointManager.SecurityProtocol=SecurityProtocolType.Ssl3|SecurityProtocolType.Tls12|SecurityProtocolType.Tls11|SecurityProtocolType.Tls;
MDTrace.WriteLine(LogLevel.VERBOSE,String.Format("GetRequestStreamCSV[ENTER]{0}",strRequest));
int charCount = 0;
byte[] buffer = new byte[8192];
@@ -300,7 +298,6 @@ namespace MarketData.Integration
try
{
ServicePointManager.Expect100Continue = true;
// ServicePointManager.SecurityProtocol=SecurityProtocolType.Ssl3|SecurityProtocolType.Tls12|SecurityProtocolType.Tls11|SecurityProtocolType.Tls;
MDTrace.WriteLine(LogLevel.VERBOSE,String.Format("GetRequestNoEncoding[ENTER]{0}",strRequest));
int charCount = 0;
byte[] buffer = new byte[8192];
@@ -355,7 +352,6 @@ namespace MarketData.Integration
public static HttpNetResponse GetRequestNoEncodingV1(String strRequest,WebProxy webProxy=null)
{
ServicePointManager.Expect100Continue=true;
// ServicePointManager.SecurityProtocol=SecurityProtocolType.Ssl3|SecurityProtocolType.Tls12|SecurityProtocolType.Tls11|SecurityProtocolType.Tls;
HttpWebResponse webResponse=null;
try
{
@@ -626,7 +622,6 @@ namespace MarketData.Integration
HttpWebResponse webResponse=null;
WebException lastWebException=null;
ServicePointManager.Expect100Continue=true;
// ServicePointManager.SecurityProtocol=SecurityProtocolType.Ssl3|SecurityProtocolType.Tls12|SecurityProtocolType.Tls11|SecurityProtocolType.Tls;
Random random=new Random();
try
@@ -733,7 +728,6 @@ namespace MarketData.Integration
HttpWebResponse webResponse=null;
WebException lastWebException=null;
ServicePointManager.Expect100Continue=true;
// ServicePointManager.SecurityProtocol=SecurityProtocolType.Ssl3|SecurityProtocolType.Tls12|SecurityProtocolType.Tls11|SecurityProtocolType.Tls;
try
{
@@ -832,7 +826,6 @@ namespace MarketData.Integration
HttpWebResponse webResponse=null;
WebException lastWebException=null;
ServicePointManager.Expect100Continue=true;
// ServicePointManager.SecurityProtocol=SecurityProtocolType.Ssl3|SecurityProtocolType.Tls12|SecurityProtocolType.Tls11|SecurityProtocolType.Tls;
Random random=new Random();
try
@@ -1001,10 +994,7 @@ namespace MarketData.Integration
int charCount=0;
byte[] buffer=new byte[8192];
StringBuilder sb=new StringBuilder();
// bool expect100Condition=ServicePointManager.Expect100Continue;
// SecurityProtocolType securityProtocolType=ServicePointManager.SecurityProtocol;
ServicePointManager.Expect100Continue=true;
// ServicePointManager.SecurityProtocol=SecurityProtocolType.Tls12;
HttpWebRequest webRequest=(HttpWebRequest)WebRequest.Create(new Uri(strRequest));
if(null!=webProxy)webRequest.Proxy=webProxy;
webRequest.Timeout=REQUEST_TIMEOUT;
@@ -1042,8 +1032,6 @@ namespace MarketData.Integration
sb.Append(Encoding.ASCII.GetString(buffer,0,charCount));
}
}
// ServicePointManager.Expect100Continue=expect100Condition;
// ServicePointManager.SecurityProtocol=securityProtocolType;
return new HttpNetResponse(sb.ToString(),strRequest,webResponse,webResponse.Cookies,true);
}
catch(WebException webException)
@@ -1074,10 +1062,6 @@ namespace MarketData.Integration
int charCount = 0;
byte[] buffer = new byte[8192];
StringBuilder sb = new StringBuilder();
// bool expect100Condition = ServicePointManager.Expect100Continue;
// SecurityProtocolType securityProtocolType = ServicePointManager.SecurityProtocol;
// ServicePointManager.Expect100Continue = true;
// ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(new Uri(strRequest));
if(null!=webProxy)webRequest.Proxy=webProxy;
webRequest.Timeout = webRequestTimeoutMS;
@@ -1104,8 +1088,6 @@ namespace MarketData.Integration
if (0 == charCount) break;
sb.Append(Encoding.ASCII.GetString(buffer, 0, charCount));
}
// ServicePointManager.Expect100Continue = expect100Condition;
// ServicePointManager.SecurityProtocol = securityProtocolType;
return new HttpNetResponse(sb.ToString(), strRequest, webResponse, webResponse.Cookies, true);
}
catch (WebException webException)
@@ -1203,10 +1185,6 @@ namespace MarketData.Integration
int charCount = 0;
byte[] buffer = new byte[8192];
StringBuilder sb = new StringBuilder();
// bool expect100Condition = ServicePointManager.Expect100Continue;
// SecurityProtocolType securityProtocolType = ServicePointManager.SecurityProtocol;
// ServicePointManager.Expect100Continue = true;
// ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(new Uri(strRequest));
if(null!=webProxy)webRequest.Proxy=webProxy;
webRequest.Timeout = webRequestTimeoutMS;
@@ -1235,8 +1213,6 @@ namespace MarketData.Integration
if (0 == charCount) break;
sb.Append(Encoding.ASCII.GetString(buffer, 0, charCount));
}
// ServicePointManager.Expect100Continue = expect100Condition;
// ServicePointManager.SecurityProtocol = securityProtocolType;
return new HttpNetResponse(sb.ToString(), strRequest, webResponse, webResponse.Cookies, true);
}
catch (WebException webException)
@@ -1268,9 +1244,6 @@ namespace MarketData.Integration
byte[] buffer = new byte[8192];
StringBuilder sb = new StringBuilder();
bool expect100Condition = ServicePointManager.Expect100Continue;
// SecurityProtocolType securityProtocolType = ServicePointManager.SecurityProtocol;
// ServicePointManager.Expect100Continue = true;
// ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(new Uri(strRequest));
if(null!=webProxy)webRequest.Proxy=webProxy;
webRequest.Timeout = webRequestTimeoutMS;
@@ -1302,8 +1275,6 @@ namespace MarketData.Integration
else throw;
}
HttpNetResponse httpNetResponse = ProcessWebResponse(strRequest, webResponse);
// ServicePointManager.Expect100Continue = expect100Condition;
// ServicePointManager.SecurityProtocol = securityProtocolType;
return httpNetResponse;
}
catch (WebException webException)
@@ -1333,10 +1304,6 @@ namespace MarketData.Integration
MDTrace.WriteLine(LogLevel.VERBOSE, String.Format("GetRequestNoEncodingV5C[ENTER]{0}", strRequest));
byte[] buffer = new byte[8192];
StringBuilder sb = new StringBuilder();
// bool expect100Condition = ServicePointManager.Expect100Continue;
// SecurityProtocolType securityProtocolType = ServicePointManager.SecurityProtocol;
// ServicePointManager.Expect100Continue = true;
// ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(new Uri(strRequest));
if(null!=webProxy)webRequest.Proxy=webProxy;
webRequest.Timeout = webRequestTimeoutMS;
@@ -1372,8 +1339,6 @@ namespace MarketData.Integration
HttpNetResponse httpNetResponse = ProcessWebResponse(strRequest, webResponse);
httpNetResponse.CookieCollection = new CookieCollection();
httpNetResponse.CookieCollection.Add(webResponse.Cookies);
// ServicePointManager.Expect100Continue = expect100Condition;
// ServicePointManager.SecurityProtocol = securityProtocolType;
return httpNetResponse;
}
catch (WebException webException)
@@ -1444,10 +1409,6 @@ namespace MarketData.Integration
int charCount = 0;
byte[] buffer = new byte[8192];
StringBuilder sb = new StringBuilder();
// bool expect100Condition = ServicePointManager.Expect100Continue;
// SecurityProtocolType securityProtocolType = ServicePointManager.SecurityProtocol;
// ServicePointManager.Expect100Continue = true;
// ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(new Uri(strRequest));
webRequest.Timeout = webRequestTimeoutMS;
webRequest.Headers.Add("Accept-Language: en-US,en;q=0.5");
@@ -1474,8 +1435,6 @@ namespace MarketData.Integration
if (0 == charCount) break;
sb.Append(Encoding.ASCII.GetString(buffer, 0, charCount));
}
// ServicePointManager.Expect100Continue = expect100Condition;
// ServicePointManager.SecurityProtocol = securityProtocolType;
return new HttpNetResponse(sb.ToString(), strRequest, webResponse, webResponse.Cookies, true);
}
catch (WebException webException)
@@ -1507,9 +1466,6 @@ namespace MarketData.Integration
byte[] buffer = new byte[8192];
StringBuilder sb = new StringBuilder();
bool expect100Condition = ServicePointManager.Expect100Continue;
// SecurityProtocolType securityProtocolType = ServicePointManager.SecurityProtocol;
// ServicePointManager.Expect100Continue = true;
// ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(new Uri(strRequest));
if(null!=webProxy)webRequest.Proxy=webProxy;
webRequest.KeepAlive=true;
@@ -1555,8 +1511,6 @@ namespace MarketData.Integration
sb.Append(Encoding.ASCII.GetString(buffer, 0, charCount));
}
}
// ServicePointManager.Expect100Continue = expect100Condition;
// ServicePointManager.SecurityProtocol = securityProtocolType;
return new HttpNetResponse(sb.ToString(), strRequest, webResponse, webResponse.Cookies, true);
}
catch (WebException webException)
@@ -1577,6 +1531,51 @@ namespace MarketData.Integration
MDTrace.WriteLine(LogLevel.VERBOSE, "GetRequestNoEncodingV7[LEAVE]");
}
}
public static HttpNetResponse GetRequestNoEncodingZoneEdit(String strRequest,String userName, String password)
{
HttpWebResponse webResponse = null;
try
{
MDTrace.WriteLine(LogLevel.VERBOSE, String.Format("GetRequestNoEncodingZoneEdit[ENTER]{0}", strRequest));
int charCount = 0;
byte[] buffer = new byte[8192];
StringBuilder sb = new StringBuilder();
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(new Uri(strRequest));
webRequest.Credentials=new NetworkCredential(userName,password);
webRequest.Headers.Add("Accept-Language: en-US,en;q=0.5");
webRequest.Headers.Add("Accept-Encoding: None");
webRequest.Accept = "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*";
webRequest.KeepAlive = true;
webResponse = (HttpWebResponse)webRequest.GetResponse();
Stream responseStream = webResponse.GetResponseStream();
while (true)
{
charCount = responseStream.Read(buffer, 0, buffer.Length);
if (0 == charCount) break;
sb.Append(Encoding.ASCII.GetString(buffer, 0, charCount));
}
return new HttpNetResponse(sb.ToString(), strRequest, webResponse, webResponse.Cookies, true);
}
catch (WebException webException)
{
return new HttpNetResponse((HttpWebResponse)webException.Response, strRequest, false, webException.Message);
}
catch (Exception exception)
{
return new HttpNetResponse(webResponse, strRequest, false, exception.Message);
}
finally
{
if(null!=webResponse)
{
webResponse.Close();
webResponse.Dispose();
}
MDTrace.WriteLine(LogLevel.VERBOSE, "GetRequestNoEncodingZoneEdit[LEAVE]");
}
}
// This is specifically taylored to Morningstar site for retrieval of historical data
public static HttpNetResponse GetRequestNoEncodingMStar(String strRequest,WebProxy webProxy=null)
{
@@ -1587,10 +1586,6 @@ namespace MarketData.Integration
int charCount = 0;
byte[] buffer = new byte[8192];
StringBuilder sb = new StringBuilder();
// bool expect100Condition = ServicePointManager.Expect100Continue;
// SecurityProtocolType securityProtocolType = ServicePointManager.SecurityProtocol;
// ServicePointManager.Expect100Continue = true;
// ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(new Uri(strRequest));
webRequest.KeepAlive=true;
webRequest.Headers.Add("Accept-Language: en-US,en;q=0.5");
@@ -1645,8 +1640,6 @@ namespace MarketData.Integration
sb.Append(Encoding.ASCII.GetString(buffer, 0, charCount));
}
}
// ServicePointManager.Expect100Continue = expect100Condition;
// ServicePointManager.SecurityProtocol = securityProtocolType;
return new HttpNetResponse(sb.ToString(), strRequest, webResponse, webResponse.Cookies, true);
}
catch (WebException webException)