Lines Matching refs:chunk
221 static void php_cli_server_buffer_append(php_cli_server_buffer *buffer, php_cli_server_chunk *chunk…
859 static size_t php_cli_server_chunk_size(const php_cli_server_chunk *chunk) /* {{{ */ in php_cli_server_chunk_size() argument
861 switch (chunk->type) { in php_cli_server_chunk_size()
863 return chunk->data.heap.len; in php_cli_server_chunk_size()
865 return chunk->data.immortal.len; in php_cli_server_chunk_size()
870 static void php_cli_server_chunk_dtor(php_cli_server_chunk *chunk) /* {{{ */ in php_cli_server_chunk_dtor() argument
872 switch (chunk->type) { in php_cli_server_chunk_dtor()
874 if (chunk->data.heap.block != chunk) { in php_cli_server_chunk_dtor()
875 pefree(chunk->data.heap.block, 1); in php_cli_server_chunk_dtor()
885 php_cli_server_chunk *chunk, *next; in php_cli_server_buffer_dtor() local
886 for (chunk = buffer->first; chunk; chunk = next) { in php_cli_server_buffer_dtor()
887 next = chunk->next; in php_cli_server_buffer_dtor()
888 php_cli_server_chunk_dtor(chunk); in php_cli_server_buffer_dtor()
889 pefree(chunk, 1); in php_cli_server_buffer_dtor()
899 static void php_cli_server_buffer_append(php_cli_server_buffer *buffer, php_cli_server_chunk *chunk… in php_cli_server_buffer_append() argument
902 for (last = chunk; last->next; last = last->next); in php_cli_server_buffer_append()
904 buffer->first = chunk; in php_cli_server_buffer_append()
906 buffer->last->next = chunk; in php_cli_server_buffer_append()
911 …php_cli_server_buffer_prepend(php_cli_server_buffer *buffer, php_cli_server_chunk *chunk) /* {{{ */ in php_cli_server_buffer_prepend() argument
914 for (last = chunk; last->next; last = last->next); in php_cli_server_buffer_prepend()
919 buffer->first = chunk; in php_cli_server_buffer_prepend()
924 php_cli_server_chunk *chunk; in php_cli_server_buffer_size() local
926 for (chunk = buffer->first; chunk; chunk = chunk->next) { in php_cli_server_buffer_size()
927 retval += php_cli_server_chunk_size(chunk); in php_cli_server_buffer_size()
934 php_cli_server_chunk *chunk = pemalloc(sizeof(php_cli_server_chunk), 1); in php_cli_server_chunk_immortal_new() local
936 chunk->type = PHP_CLI_SERVER_CHUNK_IMMORTAL; in php_cli_server_chunk_immortal_new()
937 chunk->next = NULL; in php_cli_server_chunk_immortal_new()
938 chunk->data.immortal.p = buf; in php_cli_server_chunk_immortal_new()
939 chunk->data.immortal.len = len; in php_cli_server_chunk_immortal_new()
940 return chunk; in php_cli_server_chunk_immortal_new()
945 php_cli_server_chunk *chunk = pemalloc(sizeof(php_cli_server_chunk), 1); in php_cli_server_chunk_heap_new() local
947 chunk->type = PHP_CLI_SERVER_CHUNK_HEAP; in php_cli_server_chunk_heap_new()
948 chunk->next = NULL; in php_cli_server_chunk_heap_new()
949 chunk->data.heap.block = block; in php_cli_server_chunk_heap_new()
950 chunk->data.heap.p = buf; in php_cli_server_chunk_heap_new()
951 chunk->data.heap.len = len; in php_cli_server_chunk_heap_new()
952 return chunk; in php_cli_server_chunk_heap_new()
957 php_cli_server_chunk *chunk = pemalloc(sizeof(php_cli_server_chunk) + len, 1); in php_cli_server_chunk_heap_new_self_contained() local
959 chunk->type = PHP_CLI_SERVER_CHUNK_HEAP; in php_cli_server_chunk_heap_new_self_contained()
960 chunk->next = NULL; in php_cli_server_chunk_heap_new_self_contained()
961 chunk->data.heap.block = chunk; in php_cli_server_chunk_heap_new_self_contained()
962 chunk->data.heap.p = (char *)(chunk + 1); in php_cli_server_chunk_heap_new_self_contained()
963 chunk->data.heap.len = len; in php_cli_server_chunk_heap_new_self_contained()
964 return chunk; in php_cli_server_chunk_heap_new_self_contained()
979 php_cli_server_chunk *chunk, *next; in php_cli_server_content_sender_send() local
982 for (chunk = sender->buffer.first; chunk; chunk = next) { in php_cli_server_content_sender_send()
988 next = chunk->next; in php_cli_server_content_sender_send()
990 switch (chunk->type) { in php_cli_server_content_sender_send()
993 nbytes_sent = send(fd, chunk->data.heap.p, (int)chunk->data.heap.len, 0); in php_cli_server_content_sender_send()
995 nbytes_sent = send(fd, chunk->data.heap.p, chunk->data.heap.len, 0); in php_cli_server_content_sender_send()
1001 } else if (nbytes_sent == chunk->data.heap.len) { in php_cli_server_content_sender_send()
1003 } else if (nbytes_sent == (ssize_t)chunk->data.heap.len) { in php_cli_server_content_sender_send()
1005 php_cli_server_chunk_dtor(chunk); in php_cli_server_content_sender_send()
1006 pefree(chunk, 1); in php_cli_server_content_sender_send()
1012 chunk->data.heap.p += nbytes_sent; in php_cli_server_content_sender_send()
1013 chunk->data.heap.len -= nbytes_sent; in php_cli_server_content_sender_send()
1020 nbytes_sent = send(fd, chunk->data.immortal.p, (int)chunk->data.immortal.len, 0); in php_cli_server_content_sender_send()
1022 nbytes_sent = send(fd, chunk->data.immortal.p, chunk->data.immortal.len, 0); in php_cli_server_content_sender_send()
1028 } else if (nbytes_sent == chunk->data.immortal.len) { in php_cli_server_content_sender_send()
1030 } else if (nbytes_sent == (ssize_t)chunk->data.immortal.len) { in php_cli_server_content_sender_send()
1032 php_cli_server_chunk_dtor(chunk); in php_cli_server_content_sender_send()
1033 pefree(chunk, 1); in php_cli_server_content_sender_send()
1039 chunk->data.immortal.p += nbytes_sent; in php_cli_server_content_sender_send()
1040 chunk->data.immortal.len -= nbytes_sent; in php_cli_server_content_sender_send()
1057 php_cli_server_chunk *chunk = php_cli_server_chunk_heap_new_self_contained(131072); in php_cli_server_content_sender_pull() local
1060 _nbytes_read = read(fd, chunk->data.heap.p, (unsigned int)chunk->data.heap.len); in php_cli_server_content_sender_pull()
1062 _nbytes_read = read(fd, chunk->data.heap.p, chunk->data.heap.len); in php_cli_server_content_sender_pull()
1068 php_cli_server_chunk_dtor(chunk); in php_cli_server_content_sender_pull()
1069 pefree(chunk, 1); in php_cli_server_content_sender_pull()
1072 chunk->data.heap.len = _nbytes_read; in php_cli_server_content_sender_pull()
1073 php_cli_server_buffer_append(&sender->buffer, chunk); in php_cli_server_content_sender_pull()
1892 …php_cli_server_chunk *chunk = php_cli_server_chunk_heap_new_self_contained(strlen(prologue_templat… in php_cli_server_send_error_page() local
1893 if (!chunk) { in php_cli_server_send_error_page()
1896 snprintf(chunk->data.heap.p, chunk->data.heap.len, prologue_template, status, status_string); in php_cli_server_send_error_page()
1897 chunk->data.heap.len = strlen(chunk->data.heap.p); in php_cli_server_send_error_page()
1898 php_cli_server_buffer_append(&client->content_sender.buffer, chunk); in php_cli_server_send_error_page()
1901 …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
1902 if (!chunk) { in php_cli_server_send_error_page()
1905 php_cli_server_buffer_append(&client->content_sender.buffer, chunk); in php_cli_server_send_error_page()
1909 php_cli_server_chunk *chunk = php_cli_server_chunk_immortal_new(template, sizeof(template) - 1); in php_cli_server_send_error_page() local
1910 if (!chunk) { in php_cli_server_send_error_page()
1913 php_cli_server_buffer_append(&client->content_sender.buffer, chunk); in php_cli_server_send_error_page()
1916 …php_cli_server_chunk *chunk = php_cli_server_chunk_heap_new_self_contained(strlen(content_template… in php_cli_server_send_error_page() local
1917 if (!chunk) { in php_cli_server_send_error_page()
1920 …snprintf(chunk->data.heap.p, chunk->data.heap.len, content_template, status_string, ZSTR_VAL(escap… in php_cli_server_send_error_page()
1921 chunk->data.heap.len = strlen(chunk->data.heap.p); in php_cli_server_send_error_page()
1922 php_cli_server_buffer_append(&client->content_sender.buffer, chunk); in php_cli_server_send_error_page()
1926 …php_cli_server_chunk *chunk = php_cli_server_chunk_immortal_new(epilogue_template, sizeof(epilogue… in php_cli_server_send_error_page() local
1927 if (!chunk) { 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()
1934 php_cli_server_chunk *chunk; in php_cli_server_send_error_page() local
1948 chunk = php_cli_server_chunk_heap_new(buffer.s, ZSTR_VAL(buffer.s), ZSTR_LEN(buffer.s)); in php_cli_server_send_error_page()
1949 if (!chunk) { in php_cli_server_send_error_page()
1953 php_cli_server_buffer_prepend(&client->content_sender.buffer, chunk); in php_cli_server_send_error_page()
2029 php_cli_server_chunk *chunk; in php_cli_server_begin_send_static() local
2053 chunk = php_cli_server_chunk_heap_new(buffer.s, ZSTR_VAL(buffer.s), ZSTR_LEN(buffer.s)); in php_cli_server_begin_send_static()
2054 if (!chunk) { in php_cli_server_begin_send_static()
2059 php_cli_server_buffer_append(&client->content_sender.buffer, chunk); in php_cli_server_begin_send_static()