private void LogRequest(object o, XmlRpcRequestEventArgs args) { string xml = DumpStream(args.RequestStream, String.Empty); // Find the method name within the XML string methodName = ""; int methodNameStart = xml.IndexOf("<methodName>"); if (methodNameStart >= 0) { methodNameStart += 12; // skip past "<methodName>" int methodNameEnd = xml.IndexOf('<', methodNameStart); if (methodNameEnd > methodNameStart) { methodName = xml.Substring(methodNameStart, methodNameEnd - methodNameStart); } } // do not log while downloading objects // also exclude calls occurring frequently; we don't need to know about them; // only log the full XML at Debug level because it may have sensitive data in: CA-80174 if (CanLogCall(methodName)) { log.DebugFormat("Invoking XML-RPC method {0}: {1}", methodName, xml); } else { log.InfoFormat("Invoking XML-RPC method {0}", methodName); } }
private void LoginRequest(object sender, XmlRpcRequestEventArgs e) { if (OnLoginResponse != null) { OnLoginResponse(e.m_Request, e.m_originalSize, e.m_headers, e.m_host, Direction.Outgoing); } }
void proxy_RequestEvent(object sender, XmlRpcRequestEventArgs args) { Console.Clear(); // Set the position to the beginning of the stream. Stream memStream = args.RequestStream; memStream.Seek(0, SeekOrigin.Begin); // Read the first 20 bytes from the stream. byte[] byteArray = new byte[memStream.Length]; int count = memStream.Read(byteArray, 0, 20); // Read the remaining bytes, byte by byte. while (count < memStream.Length) { byteArray[count++] = Convert.ToByte(memStream.ReadByte()); } // Decode the byte array into a char array // and write it to the console. //UnicodeEncoding uniEncoding = new UnicodeEncoding(); //char[]charArray = new char[uniEncoding.GetCharCount(byteArray, 0, count)]; //uniEncoding.GetDecoder().GetChars(byteArray, 0, count, charArray, 0); ASCIIEncoding ascii = new ASCIIEncoding(); Console.WriteLine(ascii.GetString(byteArray)); }
// LoginRequest: dump a login request to the console private void LoginRequest(object sender, XmlRpcRequestEventArgs e) { if (logLogin) { Console.WriteLine("==> Login Request"); Console.WriteLine(e.m_Request); } }
/// <summary>Called when a request is made</summary> /// <param name="sender">The <c>XmlRpcClientProtocol</c> from the XML-RPC /// library, who raised this event.</param> /// <param name="e">The Event arguments</param> protected override void OnRequest(object sender, XmlRpcRequestEventArgs e) { if (Writer != null) { Writer.WriteLine("Sending =====>"); } DumpStream(e.RequestStream); if (Writer != null) { Writer.WriteLine("====="); Writer.Flush(); } }
private void LogRequest(object o, XmlRpcRequestEventArgs args) { Level logLevel; string xml = DumpStream(args.RequestStream, String.Empty); // Find the method name within the XML string methodName = ""; int methodNameStart = xml.IndexOf("<methodName>"); if (methodNameStart >= 0) { methodNameStart += 12; // skip past "<methodName>" int methodNameEnd = xml.IndexOf('<', methodNameStart); if (methodNameEnd > methodNameStart) { methodName = xml.Substring(methodNameStart, methodNameEnd - methodNameStart); } } if (CacheWarming) { logLevel = Level.Debug; } else if (methodName == "event.next" || methodName == "event.from" || methodName == "host.get_servertime" || methodName.StartsWith("task.get_")) // these occur frequently and we don't need to know about them { logLevel = Level.Debug; } else { logLevel = Level.Info; } // Only log the full XML at Debug level because it may have sensitive data in: CA-80174 if (logLevel == Level.Debug) { LogMsg(logLevel, "Invoking XML-RPC method " + methodName + ": " + xml); } else { LogMsg(logLevel, "Invoking XML-RPC method " + methodName); } }
protected override void OnRequest(object sender, XmlRpcRequestEventArgs e) { this.DumpStream(e.RequestStream); }
private void svc_RequestEvent(object sender, XmlRpcRequestEventArgs args) { PrintStream(args.RequestStream); }
protected override void OnRequest(object sender, XmlRpcRequestEventArgs e) { _listener.OnRequest(DumpStream(e.RequestStream)); }
private void LogRequest(object o, XmlRpcRequestEventArgs args) { LogSomething("Invoking XML-RPC method:", args.RequestStream); }
// LoginRequest: tell the user about login process starting private void MyLoginRequest(object sender, XmlRpcRequestEventArgs request) { SayToUser("Sending login request to server."); StatusSetMsg("Logging in..."); }
protected override void OnRequest(object sender, XmlRpcRequestEventArgs e) { DumpStream(e.RequestStream); }
// utility for xml-rpc request handler public static void RequestEventHandler(object sender, XmlRpcRequestEventArgs args) { StreamReader reader = new StreamReader(args.RequestStream, Encoding.UTF8); Console.WriteLine("\nXML-RPC REQUEST\n" + reader.ReadToEnd()); }