Move request/response debug logging to client
This commit is contained in:
parent
ace791b521
commit
dd3c60f50e
|
@ -12,7 +12,7 @@ use tokio_rustls::client::TlsStream;
|
||||||
use tokio_rustls::rustls::{ClientConfig, OwnedTrustAnchor, RootCertStore, ServerName};
|
use tokio_rustls::rustls::{ClientConfig, OwnedTrustAnchor, RootCertStore, ServerName};
|
||||||
#[cfg(feature = "tokio-rustls")]
|
#[cfg(feature = "tokio-rustls")]
|
||||||
use tokio_rustls::TlsConnector;
|
use tokio_rustls::TlsConnector;
|
||||||
use tracing::{error, info};
|
use tracing::{debug, error, info};
|
||||||
|
|
||||||
use crate::common::{Certificate, NoExtension, PrivateKey};
|
use crate::common::{Certificate, NoExtension, PrivateKey};
|
||||||
pub use crate::connection::Connector;
|
pub use crate::connection::Connector;
|
||||||
|
@ -105,11 +105,13 @@ impl<C: Connector> EppClient<C> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Executes an EPP Hello call and returns the response as an `Greeting`
|
/// Executes an EPP Hello call and returns the response as a `Greeting`
|
||||||
pub async fn hello(&mut self) -> Result<Greeting, Error> {
|
pub async fn hello(&mut self) -> Result<Greeting, Error> {
|
||||||
let hello_xml = HelloDocument::default().serialize()?;
|
let hello_xml = HelloDocument::default().serialize()?;
|
||||||
|
|
||||||
|
debug!("{}: hello: {}", self.connection.registry, &hello_xml);
|
||||||
let response = self.connection.transact(&hello_xml)?.await?;
|
let response = self.connection.transact(&hello_xml)?.await?;
|
||||||
|
debug!("{}: greeting: {}", self.connection.registry, &response);
|
||||||
|
|
||||||
Ok(GreetingDocument::deserialize(&response)?.data)
|
Ok(GreetingDocument::deserialize(&response)?.data)
|
||||||
}
|
}
|
||||||
|
@ -127,7 +129,9 @@ impl<C: Connector> EppClient<C> {
|
||||||
let epp_xml =
|
let epp_xml =
|
||||||
<Cmd as Transaction<Ext>>::serialize_request(data.command, data.extension, id)?;
|
<Cmd as Transaction<Ext>>::serialize_request(data.command, data.extension, id)?;
|
||||||
|
|
||||||
|
debug!("{}: request: {}", self.connection.registry, &epp_xml);
|
||||||
let response = self.connection.transact(&epp_xml)?.await?;
|
let response = self.connection.transact(&epp_xml)?.await?;
|
||||||
|
debug!("{}: response: {}", self.connection.registry, &response);
|
||||||
|
|
||||||
match Cmd::deserialize_response(&response) {
|
match Cmd::deserialize_response(&response) {
|
||||||
Ok(response) => Ok(response),
|
Ok(response) => Ok(response),
|
||||||
|
|
|
@ -15,7 +15,7 @@ use crate::error::Error;
|
||||||
|
|
||||||
/// EPP Connection struct with some metadata for the connection
|
/// EPP Connection struct with some metadata for the connection
|
||||||
pub(crate) struct EppConnection<C: Connector> {
|
pub(crate) struct EppConnection<C: Connector> {
|
||||||
registry: String,
|
pub registry: String,
|
||||||
connector: C,
|
connector: C,
|
||||||
stream: C::Connection,
|
stream: C::Connection,
|
||||||
pub greeting: String,
|
pub greeting: String,
|
||||||
|
@ -74,7 +74,6 @@ impl<C: Connector> EppConnection<C> {
|
||||||
|
|
||||||
/// Sends an EPP XML request to the registry and returns the response
|
/// Sends an EPP XML request to the registry and returns the response
|
||||||
pub(crate) fn transact<'a>(&'a mut self, command: &str) -> Result<RequestFuture<'a, C>, Error> {
|
pub(crate) fn transact<'a>(&'a mut self, command: &str) -> Result<RequestFuture<'a, C>, Error> {
|
||||||
debug!("{}: request: {}", self.registry, command);
|
|
||||||
let new = RequestState::new(command)?;
|
let new = RequestState::new(command)?;
|
||||||
|
|
||||||
// If we have a request currently in flight, finish that first
|
// If we have a request currently in flight, finish that first
|
||||||
|
|
Loading…
Reference in New Issue