Skip to content

Commit

Permalink
core: fix ic_get_content_len
Browse files Browse the repository at this point in the history
  • Loading branch information
0x501D committed Aug 17, 2020
1 parent 6751223 commit 7b10217
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion libicap.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ int ic_get_status_code(ic_query_t *q);
const char *ic_get_icap_hdr(ic_query_t *q);
const char *ic_get_req_hdr(ic_query_t *q);
const char *ic_get_resp_hdr(ic_query_t *q);
uint64_t ic_get_content_len(ic_query_t *q);
/** @return -1 if ERROR */
int ic_get_content_len(ic_query_t *q, uint64_t *len);
/** @return NULL if ERROR */
const char *ic_get_content(ic_query_t *q, size_t *len, int *err);

Expand Down
10 changes: 6 additions & 4 deletions src/ic_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1618,15 +1618,17 @@ IC_EXPORT const char *ic_get_icap_hdr(ic_query_t *q)
return icap->srv.icap_hdr;
}

IC_EXPORT uint64_t ic_get_content_len(ic_query_t *q)
IC_EXPORT int ic_get_content_len(ic_query_t *q, uint64_t *len)
{
ic_query_int_t *icap = ic_int_query(q);

if (!icap) {
return NULL;
if (!icap || !len) {
return -1;
}

return icap->cl.content_len;
*len = icap->cl.content_len;

return 0;
}

IC_EXPORT const char *ic_get_content(ic_query_t *q, size_t *len, int *err)
Expand Down

0 comments on commit 7b10217

Please sign in to comment.