OCT 1. 更正HTTP Server服务回调函数定义
This commit is contained in:
parent
f9fa369457
commit
900d86eb6c
|
@ -7,6 +7,7 @@
|
|||
#include "http_response_cache.h"
|
||||
|
||||
static bool tcp_nodelay;
|
||||
extern uv_read_cb http_stream_on_read;
|
||||
|
||||
void ipc_read_cb(uv_stream_t *handle, ssize_t nread, const uv_buf_t *buf) {
|
||||
int rc;
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include "http_response_cache.h"
|
||||
#include "hw_string.h"
|
||||
|
||||
extern http_server_write_response_cb http_server_write_response;
|
||||
|
||||
#define CRLF "\r\n"
|
||||
KHASH_MAP_INIT_STR(string_hashmap, char *)
|
||||
|
||||
|
@ -78,8 +80,8 @@ hw_string *create_response_buffer(hw_http_response *response) {
|
|||
int header_buffer_incr = 512;
|
||||
int body_size = resp->body.length;
|
||||
int header_size_remaining = header_buffer_incr;
|
||||
int response_size = header_size_remaining + sizeof(length_header) + num_chars(resp->body.length) + 2 * line_sep_size
|
||||
+ body_size + line_sep_size;
|
||||
int response_size = header_size_remaining + sizeof(length_header) + num_chars(resp->body.length) +
|
||||
2 * line_sep_size + body_size + line_sep_size;
|
||||
|
||||
response_string->value = malloc(response_size);
|
||||
|
||||
|
|
|
@ -48,6 +48,8 @@ int listener_count;
|
|||
uv_async_t *listener_async_handles;
|
||||
uv_loop_t *listener_event_loops;
|
||||
uv_barrier_t *listeners_created_barrier;
|
||||
uv_read_cb http_stream_on_read;
|
||||
http_server_write_response_cb http_server_write_response;
|
||||
|
||||
int hw_init_with_config(configuration *c) {
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -25,8 +25,7 @@ extern uv_async_t *listener_async_handles;
|
|||
extern uv_loop_t *listener_event_loops;
|
||||
extern uv_barrier_t *listeners_created_barrier;
|
||||
|
||||
void (*http_stream_on_read)(uv_stream_t *, ssize_t, const uv_buf_t *);
|
||||
int (*http_server_write_response)(hw_write_context *, hw_string *);
|
||||
typedef int (*http_server_write_response_cb)(hw_write_context *, hw_string *);
|
||||
|
||||
http_connection *create_http_connection();
|
||||
void http_stream_on_connect(uv_stream_t *stream, int status);
|
||||
|
|
Loading…
Reference in New Issue