Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
decoder.diary = diary;
decoder.pool = pool;
decoder.log2p = log2p;
decoder.data = (const unsigned char*)data;
decoder.datalen = len;
decoder.offset = 1;
decoder.bit = 8;
decoder.last_val = 0;
diary->N = N;
/* Determine effective N we use for storage */
if (!N) {
/* a totally empty cache digest. someone tells us that she has no
* entries in the cache at all. Use our own preferences for N+mask
*/
diary->N = diary->NMax;
return APR_SUCCESS;
}
else if (N > diary->NMax) {
/* Store not more than diary is configured to hold. We open us up
* to DOS attacks otherwise. */
diary->N = diary->NMax;
}
/* Intentional no APLOGNO */
ap_log_perror(APLOG_MARK, GCSLOG_LEVEL, 0, pool,
"h2_push_diary_digest_set: N=%d, log2n=%d, "
"diary->mask_bits=%d, dec.log2p=%d",
(int)diary->N, (int)log2n, diary->mask_bits,
(int)decoder.log2p);
for (i = 0; i < diary->N; ++i) {
if (gset_decode_next(&decoder, &e.hash) != APR_SUCCESS) {
/* the data may have less than N values */
break;
}
h2_push_diary_append(diary, &e);
}
/* Intentional no APLOGNO */
ap_log_perror(APLOG_MARK, GCSLOG_LEVEL, 0, pool,
"h2_push_diary_digest_set: diary now with %d entries, mask_bits=%d",
(int)diary->entries->nelts, diary->mask_bits);
return status;
}
apr_status_t h2_push_diary_digest64_set(h2_push_diary *diary, const char *authority,
const char *data64url, apr_pool_t *pool)
{
const char *data;
apr_size_t len = h2_util_base64url_decode(&data, data64url, pool);
/* Intentional no APLOGNO */
ap_log_perror(APLOG_MARK, GCSLOG_LEVEL, 0, pool,
"h2_push_diary_digest64_set: digest=%s, dlen=%d",
data64url, (int)len);
return h2_push_diary_digest_set(diary, authority, data, len);
}