Lines Matching refs:len

27 static void http_chunk_len_append(chunkqueue * const cq, uintmax_t len) {  in http_chunk_len_append()  argument
31 buffer_append_uint_hex(&b, len); in http_chunk_len_append()
38 do { buf[--i] = "0123456789abcdef"[len & 0x0F]; } while (len >>= 4); in http_chunk_len_append()
44 static int http_chunk_len_append_tempfile(chunkqueue * const cq, uintmax_t len, log_error_st * cons… in http_chunk_len_append_tempfile() argument
48 buffer_append_uint_hex(&b, len); in http_chunk_len_append_tempfile()
55 do { buf[--i] = "0123456789abcdef"[len & 0x0F]; } while (len >>= 4); in http_chunk_len_append_tempfile()
61 …ad_fd_range(request_st * const r, const buffer * const fn, const int fd, off_t offset, off_t len) { in http_chunk_append_read_fd_range() argument
72 http_chunk_len_append(cq, (uintmax_t)len); in http_chunk_append_read_fd_range()
74 buffer * const b = chunkqueue_append_buffer_open_sz(cq, len+2+1); in http_chunk_append_read_fd_range()
79 rd = chunk_file_pread(fd, b->ptr+offset, (size_t)len, foff+offset); in http_chunk_append_read_fd_range()
80 } while (rd > 0 && (offset += rd, len -= rd)); in http_chunk_append_read_fd_range()
87 return (len == 0) ? 0 : -1; in http_chunk_append_read_fd_range()
91 …file_ref_range(request_st * const r, stat_cache_entry * const sce, const off_t offset, off_t len) { in http_chunk_append_file_ref_range() argument
94 if (sce->st.st_size - offset < len) in http_chunk_append_file_ref_range()
95 len = sce->st.st_size - offset; in http_chunk_append_file_ref_range()
96 if (len <= 0) in http_chunk_append_file_ref_range()
100 http_chunk_len_append(cq, (uintmax_t)len); in http_chunk_append_file_ref_range()
104 chunkqueue_append_file_fd(cq, fn, fd, offset, len); in http_chunk_append_file_ref_range()
117 …request_st * const r, const buffer * const fn, const int fd, const off_t offset, const off_t len) { in http_chunk_append_file_fd_range() argument
121 http_chunk_len_append(cq, (uintmax_t)len); in http_chunk_append_file_fd_range()
123 chunkqueue_append_file_fd(cq, fn, fd, offset, len); in http_chunk_append_file_fd_range()
156 …int http_chunk_append_to_tempfile(request_st * const r, const char * const mem, const size_t len) { in http_chunk_append_to_tempfile() argument
161 && 0 != http_chunk_len_append_tempfile(cq, len, errh)) in http_chunk_append_to_tempfile()
164 if (0 != chunkqueue_append_mem_to_tempfile(cq, mem, len, errh)) in http_chunk_append_to_tempfile()
176 … http_chunk_append_cq_to_tempfile(request_st * const r, chunkqueue * const src, const size_t len) { in http_chunk_append_cq_to_tempfile() argument
181 && 0 != http_chunk_len_append_tempfile(cq, len, errh)) in http_chunk_append_cq_to_tempfile()
184 if (0 != chunkqueue_steal_with_tempfiles(cq, src, len, errh)) in http_chunk_append_cq_to_tempfile()
197 static int http_chunk_uses_tempfile(const chunkqueue * const cq, const size_t len) { in http_chunk_uses_tempfile() argument
206 || chunkqueue_length(cq) + len > 65536); in http_chunk_uses_tempfile()
211 size_t len = mem ? buffer_clen(mem) : 0; in http_chunk_append_buffer() local
212 if (0 == len) return 0; in http_chunk_append_buffer()
216 if (http_chunk_uses_tempfile(cq, len)) { in http_chunk_append_buffer()
217 int rc = http_chunk_append_to_tempfile(r, mem->ptr, len); in http_chunk_append_buffer()
223 http_chunk_len_append(cq, len); in http_chunk_append_buffer()
235 int http_chunk_append_mem(request_st * const r, const char * const mem, const size_t len) { in http_chunk_append_mem() argument
236 if (0 == len) return 0; in http_chunk_append_mem()
241 if (http_chunk_uses_tempfile(cq, len)) in http_chunk_append_mem()
242 return http_chunk_append_to_tempfile(r, mem, len); in http_chunk_append_mem()
245 http_chunk_len_append(cq, len); in http_chunk_append_mem()
247 chunkqueue_append_mem(cq, mem, len); in http_chunk_append_mem()
255 int http_chunk_transfer_cqlen(request_st * const r, chunkqueue * const src, const size_t len) { in http_chunk_transfer_cqlen() argument
256 if (0 == len) return 0; in http_chunk_transfer_cqlen()
260 if (http_chunk_uses_tempfile(cq, len)) in http_chunk_transfer_cqlen()
261 return http_chunk_append_cq_to_tempfile(r, src, len); in http_chunk_transfer_cqlen()
264 http_chunk_len_append(cq, len); in http_chunk_transfer_cqlen()
266 chunkqueue_steal(cq, src, len); in http_chunk_transfer_cqlen()
286 http_chunk_decode_append_data (request_st * const r, const char *mem, off_t len) in http_chunk_decode_append_data() argument
292 while (len) { in http_chunk_decode_append_data()
299 p = memchr(mem, '\n', (size_t)len); in http_chunk_decode_append_data()
303 if (len >= 1024) { in http_chunk_decode_append_data()
308 buffer_append_string_len(h, mem, (uint32_t)len); in http_chunk_decode_append_data()
318 p = memchr(mem, '\n', (size_t)len); in http_chunk_decode_append_data()
319 hsz = (p ? (off_t)(++p - mem) : len); in http_chunk_decode_append_data()
328 len -= hsz; in http_chunk_decode_append_data()
355 if (len - hsz >= 2 && p[0] == '\r' && p[1] == '\n') { in http_chunk_decode_append_data()
356 if (len - hsz > 2) return -1; /*(excess data)*/ in http_chunk_decode_append_data()
375 if ((off_t)mlen < len) { in http_chunk_decode_append_data()
394 buffer_append_string_len(h, mem, (uint32_t)len); in http_chunk_decode_append_data()
404 len -= hsz; in http_chunk_decode_append_data()
408 if (0 == len) break; in http_chunk_decode_append_data()
413 if (clen > len) clen = len; in http_chunk_decode_append_data()
418 len -= clen; in http_chunk_decode_append_data()
421 if (len >= 2) { in http_chunk_decode_append_data()
424 len -= 2; in http_chunk_decode_append_data()
427 else if (len == 1) { in http_chunk_decode_append_data()
440 --len; in http_chunk_decode_append_data()
483 int http_chunk_decode_append_mem(request_st * const r, const char * const mem, size_t len) in http_chunk_decode_append_mem() argument
488 if (0 != http_chunk_decode_append_data(r, mem, (off_t)len)) in http_chunk_decode_append_mem()
498 int rc = http_chunk_append_mem(r, mem, len); /*might append to tmpfile*/ in http_chunk_decode_append_mem()