Skip to main content

build_query_string

Function build_query_string 

Source
pub fn build_query_string(query: &Query) -> String
Expand description

Build the wire-format query string to send over the TCP connection.

Per RFC 1288:

  • Verbose queries prepend /W (with trailing space).
  • Forwarding appends @host1@host2... for all hosts except the last (the last host is the connection target, not part of the query string).
  • The query is terminated with \r\n.

ยงExample

use digit::query::Query;
use digit::protocol::build_query_string;

let q = Query::parse(Some("user@host"), true, 79).unwrap();
assert_eq!(build_query_string(&q), "/W user\r\n");