static CURLcode add_haproxy_protocol_header(struct Curl_easy *data)
{
  struct dynbuf req;
  CURLcode result;
  const char *tcp_version;
  DEBUGASSERT(data->conn);
  Curl_dyn_init(&req, DYN_HAXPROXY);

#ifdef USE_UNIX_SOCKETS
  if(data->conn->unix_domain_socket)
    /* the buffer is large enough to hold this! */
    result = Curl_dyn_addn(&req, STRCONST("PROXY UNKNOWN\r\n"));
  else {
#endif
  /* Emit the correct prefix for IPv6 */
  tcp_version = data->conn->bits.ipv6 ? "TCP6" : "TCP4";

  result = Curl_dyn_addf(&req, "PROXY %s %s %s %i %i\r\n",
                         tcp_version,
                         data->info.conn_local_ip,
                         data->info.conn_primary_ip,
                         data->info.conn_local_port,
                         data->info.conn_primary_port);

#ifdef USE_UNIX_SOCKETS
  }
#endif

  if(!result)
    result = Curl_buffer_send(&req, data, &data->info.request_size,
                              0, FIRSTSOCKET);
  return result;
}
static CURLcode add_haproxy_protocol_header(struct Curl_easy *data)
{
  struct dynbuf req;
  CURLcode result;
  const char *tcp_version;
  DEBUGASSERT(data->conn);
  Curl_dyn_init(&req, DYN_HAXPROXY);

#ifdef USE_UNIX_SOCKETS
  if(data->conn->unix_domain_socket)
     
    result = Curl_dyn_addn(&req, STRCONST("PROXY UNKNOWN\r\n"));
  else {
#endif
   
  tcp_version = data->conn->bits.ipv6 ? "TCP6" : "TCP4";

  result = Curl_dyn_addf(&req, "PROXY %s %s %s %i %i\r\n",
                         tcp_version,
                         data->info.conn_local_ip,
                         data->info.conn_primary_ip,
                         data->info.conn_local_port,
                         data->info.conn_primary_port);

#ifdef USE_UNIX_SOCKETS
  }
#endif

  if(!result)
    result = Curl_buffer_send(&req, data, &data->info.request_size,
                              0, FIRSTSOCKET);
  return result;
}