Skip to content

Commit

Permalink
lib-http: Add accessors for some response details
Browse files Browse the repository at this point in the history
  • Loading branch information
cmouse committed Feb 19, 2016
1 parent 53cc71c commit 0c5fef3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/lib-http/http-server-response.c
Expand Up @@ -767,3 +767,17 @@ http_server_response_get_payload_output(struct http_server_response *resp,
o_stream_create(&hsostream->ostream, conn->conn.output, -1);
return resp->blocking_output;
}

void http_server_response_get_status(struct http_server_response *resp,
int *status_r, const char **reason_r)
{
i_assert(resp != NULL);
*status_r = resp->status;
*reason_r = resp->reason;
}

uoff_t http_server_response_get_total_size(struct http_server_response *resp)
{
i_assert(resp != NULL);
return resp->payload_size + str_len(resp->headers);
}
4 changes: 4 additions & 0 deletions src/lib-http/http-server.h
Expand Up @@ -166,6 +166,10 @@ struct ostream *
http_server_response_get_payload_output(struct http_server_response *resp,
bool blocking);

/* get some information about response */
void http_server_response_get_status(struct http_server_response *resp,
int *status_r, const char **reason_r);
uoff_t http_server_response_get_total_size(struct http_server_response *resp);
void http_server_response_add_auth(
struct http_server_response *resp,
const struct http_auth_challenge *chlng);
Expand Down

0 comments on commit 0c5fef3

Please sign in to comment.