Merge pull request #163 from stephen-turner/CA-141389

CA-141389 Log all GET and POST calls
This commit is contained in:
Mihaela Stoica 2014-08-11 07:02:13 +01:00
commit f16b63af23
9 changed files with 18 additions and 12 deletions

View File

@ -986,7 +986,7 @@ namespace XenAdmin.ConsoleView
SessionUUID = activeSession.uuid;
}
Stream stream = HTTPHelper.CONNECT(uri, console.Connection, SessionUUID, false);
Stream stream = HTTPHelper.CONNECT(uri, console.Connection, SessionUUID, false, true);
InvokeConnection(v, stream, console);
}

View File

@ -299,7 +299,7 @@ namespace XenAdmin.Controls.CustomDataGraph
Session session = xenObject.Connection.Session;
if (session == null)
return;
using (Stream httpstream = HTTPHelper.GET(URI(session, host, interval, xenObject), xenObject.Connection, true))
using (Stream httpstream = HTTPHelper.GET(URI(session, host, interval, xenObject), xenObject.Connection, true, false))
{
using (XmlReader reader = XmlReader.Create(httpstream))
{

View File

@ -245,7 +245,7 @@ namespace XenAdmin.Actions
protected virtual XmlDocument FetchCheckForUpdatesXml(string location)
{
XmlDocument xdoc;
using (Stream xmlstream = HTTPHelper.GET(new Uri(location), Connection, false))
using (Stream xmlstream = HTTPHelper.GET(new Uri(location), Connection, false, true))
{
xdoc = Helpers.LoadXmlDocument(xmlstream);
}

View File

@ -252,7 +252,7 @@ namespace XenAdmin.Actions
{
using (FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.Write))
{
using (Stream http = HTTPHelper.GET(uri, Connection, true))
using (Stream http = HTTPHelper.GET(uri, Connection, true, true))
{
new Export().verify(http, fs, (Export.cancellingCallback)delegate() { return Cancelling; });
}

View File

@ -305,18 +305,24 @@ namespace XenAPI
}
}
public static Stream CONNECT(Uri uri, IXenConnection connection, string session, bool timeout)
public static Stream CONNECT(Uri uri, IXenConnection connection, string session, bool timeout, bool do_log)
{
if (do_log)
log.DebugFormat("HTTP CONNECTING to {0}", uri);
return HTTP.CONNECT(uri, XenAdminConfigManager.Provider.GetProxyFromSettings(connection), session, XenAdminConfigManager.Provider.GetProxyTimeout(timeout));
}
public static Stream PUT(Uri uri, long ContentLength, bool timeout)
public static Stream PUT(Uri uri, long ContentLength, bool timeout, bool do_log)
{
if (do_log)
log.DebugFormat("HTTP PUTTING file to {0}", uri);
return HTTP.PUT(uri, XenAdminConfigManager.Provider.GetProxyFromSettings(null), ContentLength, XenAdminConfigManager.Provider.GetProxyTimeout(timeout));
}
public static Stream GET(Uri uri, IXenConnection connection, bool timeout)
public static Stream GET(Uri uri, IXenConnection connection, bool timeout, bool do_log)
{
if (do_log)
log.DebugFormat("HTTP GETTING file from {0}", uri);
return HTTP.GET(uri, XenAdminConfigManager.Provider.GetProxyFromSettings(connection), XenAdminConfigManager.Provider.GetProxyTimeout(timeout));
}
}

View File

@ -53,7 +53,7 @@ namespace XenAdmin.ServerDBs
{
_tables = new TableDictionary(this);
using (StreamReader stream = url.StartsWith("http") ? new StreamReader(HTTPHelper.GET(new Uri(url), connection, true)) : new StreamReader(url))
using (StreamReader stream = url.StartsWith("http") ? new StreamReader(HTTPHelper.GET(new Uri(url), connection, true, true)) : new StreamReader(url))
{
StatusReportXmlDocReader reader = new StatusReportXmlDocReader();
XmlDocument doc = new XmlDocument();

View File

@ -175,7 +175,7 @@ namespace XenAdmin.Actions.Wlb
byte[] buf = new byte[BUFSIZE];
using (MemoryStream ms = new MemoryStream())
{
using (Stream http = HTTPHelper.GET(uri, Connection, false))
using (Stream http = HTTPHelper.GET(uri, Connection, false, true))
{
while (true)
{

View File

@ -53,7 +53,7 @@ namespace XenAPI
uri.Query = String.Format("ref={0}&session_id={1}",
opaque_ref, Uri.EscapeDataString(session.uuid));
using (Stream outStream = HTTPHelper.PUT(uri.Uri, inStream.Length, true))
using (Stream outStream = HTTPHelper.PUT(uri.Uri, inStream.Length, true, true))
{
HTTP.CopyStream(inStream, outStream, null, delegate() { return XenAdminConfigManager.Provider.ForcedExiting; });
}
@ -74,7 +74,7 @@ namespace XenAPI
uri.Query = String.Format("ref={0}&session_id={1}",
opaque_ref, Uri.EscapeDataString(session.uuid));
return HTTPHelper.GET(uri.Uri, Connection, true);
return HTTPHelper.GET(uri.Uri, Connection, true, true);
}
}
}

View File

@ -184,7 +184,7 @@ namespace XenAdmin.XenSearch
{
Session session = host.Connection.Session;
if (session != null)
return AllValues(HTTPHelper.GET(GetUri(session, host), host.Connection, true));
return AllValues(HTTPHelper.GET(GetUri(session, host), host.Connection, true, false));
}
catch (Exception e)
{