Lines Matching refs:chunk

221 static void php_cli_server_buffer_append(php_cli_server_buffer *buffer, php_cli_server_chunk *chunk
860 static size_t php_cli_server_chunk_size(const php_cli_server_chunk *chunk) /* {{{ */ in php_cli_server_chunk_size() argument
862 switch (chunk->type) { in php_cli_server_chunk_size()
864 return chunk->data.heap.len; in php_cli_server_chunk_size()
866 return chunk->data.immortal.len; in php_cli_server_chunk_size()
871 static void php_cli_server_chunk_dtor(php_cli_server_chunk *chunk) /* {{{ */ in php_cli_server_chunk_dtor() argument
873 switch (chunk->type) { in php_cli_server_chunk_dtor()
875 if (chunk->data.heap.block != chunk) { in php_cli_server_chunk_dtor()
876 pefree(chunk->data.heap.block, 1); in php_cli_server_chunk_dtor()
886 php_cli_server_chunk *chunk, *next; in php_cli_server_buffer_dtor() local
887 for (chunk = buffer->first; chunk; chunk = next) { in php_cli_server_buffer_dtor()
888 next = chunk->next; in php_cli_server_buffer_dtor()
889 php_cli_server_chunk_dtor(chunk); in php_cli_server_buffer_dtor()
890 pefree(chunk, 1); in php_cli_server_buffer_dtor()
900 static void php_cli_server_buffer_append(php_cli_server_buffer *buffer, php_cli_server_chunk *chunk in php_cli_server_buffer_append() argument
903 for (last = chunk; last->next; last = last->next); in php_cli_server_buffer_append()
905 buffer->first = chunk; in php_cli_server_buffer_append()
907 buffer->last->next = chunk; in php_cli_server_buffer_append()
912 …php_cli_server_buffer_prepend(php_cli_server_buffer *buffer, php_cli_server_chunk *chunk) /* {{{ */ in php_cli_server_buffer_prepend() argument
915 for (last = chunk; last->next; last = last->next); in php_cli_server_buffer_prepend()
920 buffer->first = chunk; in php_cli_server_buffer_prepend()
925 php_cli_server_chunk *chunk; in php_cli_server_buffer_size() local
927 for (chunk = buffer->first; chunk; chunk = chunk->next) { in php_cli_server_buffer_size()
928 retval += php_cli_server_chunk_size(chunk); in php_cli_server_buffer_size()
935 php_cli_server_chunk *chunk = pemalloc(sizeof(php_cli_server_chunk), 1); in php_cli_server_chunk_immortal_new() local
936 if (!chunk) { in php_cli_server_chunk_immortal_new()
940 chunk->type = PHP_CLI_SERVER_CHUNK_IMMORTAL; in php_cli_server_chunk_immortal_new()
941 chunk->next = NULL; in php_cli_server_chunk_immortal_new()
942 chunk->data.immortal.p = buf; in php_cli_server_chunk_immortal_new()
943 chunk->data.immortal.len = len; in php_cli_server_chunk_immortal_new()
944 return chunk; in php_cli_server_chunk_immortal_new()
949 php_cli_server_chunk *chunk = pemalloc(sizeof(php_cli_server_chunk), 1); in php_cli_server_chunk_heap_new() local
950 if (!chunk) { in php_cli_server_chunk_heap_new()
954 chunk->type = PHP_CLI_SERVER_CHUNK_HEAP; in php_cli_server_chunk_heap_new()
955 chunk->next = NULL; in php_cli_server_chunk_heap_new()
956 chunk->data.heap.block = block; in php_cli_server_chunk_heap_new()
957 chunk->data.heap.p = buf; in php_cli_server_chunk_heap_new()
958 chunk->data.heap.len = len; in php_cli_server_chunk_heap_new()
959 return chunk; in php_cli_server_chunk_heap_new()
964 php_cli_server_chunk *chunk = pemalloc(sizeof(php_cli_server_chunk) + len, 1); in php_cli_server_chunk_heap_new_self_contained() local
965 if (!chunk) { in php_cli_server_chunk_heap_new_self_contained()
969 chunk->type = PHP_CLI_SERVER_CHUNK_HEAP; in php_cli_server_chunk_heap_new_self_contained()
970 chunk->next = NULL; in php_cli_server_chunk_heap_new_self_contained()
971 chunk->data.heap.block = chunk; in php_cli_server_chunk_heap_new_self_contained()
972 chunk->data.heap.p = (char *)(chunk + 1); in php_cli_server_chunk_heap_new_self_contained()
973 chunk->data.heap.len = len; in php_cli_server_chunk_heap_new_self_contained()
974 return chunk; in php_cli_server_chunk_heap_new_self_contained()
989 php_cli_server_chunk *chunk, *next; in php_cli_server_content_sender_send() local
992 for (chunk = sender->buffer.first; chunk; chunk = next) { in php_cli_server_content_sender_send()
998 next = chunk->next; in php_cli_server_content_sender_send()
1000 switch (chunk->type) { in php_cli_server_content_sender_send()
1003 nbytes_sent = send(fd, chunk->data.heap.p, (int)chunk->data.heap.len, 0); in php_cli_server_content_sender_send()
1005 nbytes_sent = send(fd, chunk->data.heap.p, chunk->data.heap.len, 0); in php_cli_server_content_sender_send()
1011 } else if (nbytes_sent == chunk->data.heap.len) { in php_cli_server_content_sender_send()
1013 } else if (nbytes_sent == (ssize_t)chunk->data.heap.len) { in php_cli_server_content_sender_send()
1015 php_cli_server_chunk_dtor(chunk); in php_cli_server_content_sender_send()
1016 pefree(chunk, 1); in php_cli_server_content_sender_send()
1022 chunk->data.heap.p += nbytes_sent; in php_cli_server_content_sender_send()
1023 chunk->data.heap.len -= nbytes_sent; in php_cli_server_content_sender_send()
1030 nbytes_sent = send(fd, chunk->data.immortal.p, (int)chunk->data.immortal.len, 0); in php_cli_server_content_sender_send()
1032 nbytes_sent = send(fd, chunk->data.immortal.p, chunk->data.immortal.len, 0); in php_cli_server_content_sender_send()
1038 } else if (nbytes_sent == chunk->data.immortal.len) { in php_cli_server_content_sender_send()
1040 } else if (nbytes_sent == (ssize_t)chunk->data.immortal.len) { in php_cli_server_content_sender_send()
1042 php_cli_server_chunk_dtor(chunk); in php_cli_server_content_sender_send()
1043 pefree(chunk, 1); in php_cli_server_content_sender_send()
1049 chunk->data.immortal.p += nbytes_sent; in php_cli_server_content_sender_send()
1050 chunk->data.immortal.len -= nbytes_sent; in php_cli_server_content_sender_send()
1067 php_cli_server_chunk *chunk = php_cli_server_chunk_heap_new_self_contained(131072); in php_cli_server_content_sender_pull() local
1070 _nbytes_read = read(fd, chunk->data.heap.p, (unsigned int)chunk->data.heap.len); in php_cli_server_content_sender_pull()
1072 _nbytes_read = read(fd, chunk->data.heap.p, chunk->data.heap.len); in php_cli_server_content_sender_pull()
1078 php_cli_server_chunk_dtor(chunk); in php_cli_server_content_sender_pull()
1079 pefree(chunk, 1); in php_cli_server_content_sender_pull()
1082 chunk->data.heap.len = _nbytes_read; in php_cli_server_content_sender_pull()
1083 php_cli_server_buffer_append(&sender->buffer, chunk); in php_cli_server_content_sender_pull()
1924 …php_cli_server_chunk *chunk = php_cli_server_chunk_heap_new_self_contained(strlen(prologue_templat… in php_cli_server_send_error_page() local
1925 if (!chunk) { in php_cli_server_send_error_page()
1928 snprintf(chunk->data.heap.p, chunk->data.heap.len, prologue_template, status, status_string); in php_cli_server_send_error_page()
1929 chunk->data.heap.len = strlen(chunk->data.heap.p); in php_cli_server_send_error_page()
1930 php_cli_server_buffer_append(&client->content_sender.buffer, chunk); in php_cli_server_send_error_page()
1933 …php_cli_server_chunk *chunk = php_cli_server_chunk_immortal_new(php_cli_server_css, sizeof(php_cli… in php_cli_server_send_error_page() local
1934 if (!chunk) { in php_cli_server_send_error_page()
1937 php_cli_server_buffer_append(&client->content_sender.buffer, chunk); in php_cli_server_send_error_page()
1941 php_cli_server_chunk *chunk = php_cli_server_chunk_immortal_new(template, sizeof(template) - 1); in php_cli_server_send_error_page() local
1942 if (!chunk) { in php_cli_server_send_error_page()
1945 php_cli_server_buffer_append(&client->content_sender.buffer, chunk); in php_cli_server_send_error_page()
1948 …php_cli_server_chunk *chunk = php_cli_server_chunk_heap_new_self_contained(strlen(content_template… in php_cli_server_send_error_page() local
1949 if (!chunk) { in php_cli_server_send_error_page()
1952 …snprintf(chunk->data.heap.p, chunk->data.heap.len, content_template, status_string, ZSTR_VAL(escap… in php_cli_server_send_error_page()
1953 chunk->data.heap.len = strlen(chunk->data.heap.p); in php_cli_server_send_error_page()
1954 php_cli_server_buffer_append(&client->content_sender.buffer, chunk); in php_cli_server_send_error_page()
1958 …php_cli_server_chunk *chunk = php_cli_server_chunk_immortal_new(epilogue_template, sizeof(epilogue… in php_cli_server_send_error_page() local
1959 if (!chunk) { in php_cli_server_send_error_page()
1962 php_cli_server_buffer_append(&client->content_sender.buffer, chunk); in php_cli_server_send_error_page()
1966 php_cli_server_chunk *chunk; in php_cli_server_send_error_page() local
1980 chunk = php_cli_server_chunk_heap_new(buffer.s, ZSTR_VAL(buffer.s), ZSTR_LEN(buffer.s)); in php_cli_server_send_error_page()
1981 if (!chunk) { in php_cli_server_send_error_page()
1985 php_cli_server_buffer_prepend(&client->content_sender.buffer, chunk); in php_cli_server_send_error_page()
2061 php_cli_server_chunk *chunk; in php_cli_server_begin_send_static() local
2085 chunk = php_cli_server_chunk_heap_new(buffer.s, ZSTR_VAL(buffer.s), ZSTR_LEN(buffer.s)); in php_cli_server_begin_send_static()
2086 if (!chunk) { in php_cli_server_begin_send_static()
2091 php_cli_server_buffer_append(&client->content_sender.buffer, chunk); in php_cli_server_begin_send_static()