summaryrefslogtreecommitdiff
path: root/src/libtipidee/tipidee_conf_get_responseheaders.c
blob: ee8c78632aff74712584d9c6d501d2f6dc7aa9b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* ISC license. */

#include <stddef.h>
#include <errno.h>
#include <string.h>

#include <skalibs/uint32.h>
#include <skalibs/cdb.h>

#include <tipidee/conf.h>

#include <skalibs/posixishard.h>

char const *tipidee_conf_get_responseheaders (tipidee_conf const *conf, char const *key, uint32_t *len, uint32_t *n)
{
  cdb_data data ;
  if (!tipidee_conf_get(conf, key, &data)) return NULL ;
  if (data.len < 4) return (errno = EPROTO, NULL) ;
  uint32_unpack_big(data.s + data.len - 4, n) ;
  *len = data.len - 4 ;
  return data.s ;
}