ua_info_extract - extract information on latest request#

ORCAcode ua_info_extract(struct ua_conn *conn, struct ua_info *info)#

Extract information from conn previous request.

Parameters:
  • conn – the connection handle

  • info – handle to store information on previous request

Returns:

ORCAcode for how the operation went, ORCA_OK means nothing out of the ordinary

Example#

struct user_agent *ua = ua_init(NULL);
ua_set_url(ua, "https://www.example.com");

struct ua_conn_attr conn_attr = { .method = HTTP_GET };
struct ua_conn *conn = ua_conn_start(ua);
ua_conn_setup(conn, &conn_attr);

if (ORCA_OK == ua_conn_perform(conn)) {
  struct ua_info info = { 0 };
  ua_info_extract(conn, &info);

  struct sized_buffer body = ua_conn_get_body(&info);

  printf("%.*s\n", (int)body.size, body.start);

  ua_info_cleanup(&info);
}

ua_conn_stop(conn);
ua_cleanup(ua);