/*--------------------------------------------------
FUNCTION: httpc_free
DESC: Free the given http client object.
----------------------------------------------------*/
void
httpc_free(httpc_conn_t * conn)
{
  hpair_t *tmp;

  if (conn == NULL)
    return;


  while (conn->header != NULL)
  {
    tmp = conn->header;
    conn->header = conn->header->next;
    hpairnode_free(tmp);
  }

  if (conn->out != NULL)
  {
    http_output_stream_free(conn->out);
    conn->out = NULL;
  }

  hsocket_free(&(conn->sock));
  free(conn);

  return;
}
Example #2
0
void
httpd_free(httpd_conn_t * conn)
{
  if (!conn)
    return;

  if (conn->out)
    http_output_stream_free(conn->out);

  if (conn->header)
    hpairnode_free_deep(conn->header);

  free(conn);

  return;
}