diff options
Diffstat (limited to '')
-rw-r--r-- | c/wasi-http/echo-request/component.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/c/wasi-http/echo-request/component.c b/c/wasi-http/echo-request/component.c index cecf390..fde450a 100644 --- a/c/wasi-http/echo-request/component.c +++ b/c/wasi-http/echo-request/component.c @@ -62,7 +62,6 @@ void exports_wasi_http_incoming_handler_handle( wasi_io_streams_borrow_output_stream_t b_out_stream; wasi_io_streams_list_u8_t stream_data; wasi_io_streams_stream_error_t stream_err; - wasi_http_types_error_code_t http_err; wasi_http_types_header_error_t hdr_err; wasi_http_types_field_key_t key; wasi_http_types_field_value_t value; @@ -114,10 +113,10 @@ void exports_wasi_http_incoming_handler_handle( ex("wasi_http_types_method_incoming_body_stream() failed\n"); b_in_stream = wasi_io_streams_borrow_input_stream(in_stream); - ok = wasi_io_streams_method_input_stream_read(b_in_stream, - 8 * 1024*1024, - &data, - &in_stream_err); + ok = wasi_io_streams_method_input_stream_blocking_read(b_in_stream, + 8 * 1024*1024, + &data, + &in_stream_err); if (method.tag == WASI_HTTP_TYPES_METHOD_POST || method.tag == WASI_HTTP_TYPES_METHOD_PUT) { @@ -155,19 +154,14 @@ void exports_wasi_http_incoming_handler_handle( stream_data.len = size; stream_data.ptr = (uint8_t *)out_ptr; - ok = wasi_io_streams_method_output_stream_write(b_out_stream, - &stream_data, - &stream_err); + ok = wasi_io_streams_method_output_stream_blocking_write_and_flush( + b_out_stream, + &stream_data, + &stream_err); if (!ok) - ex("wasi_io_streams_method_output_stream_write() failed\n"); + ex("wasi_io_streams_method_output_stream_blocking_write_and_flush() failed\n"); free(out_ptr); wasi_http_types_static_response_outparam_set(response_out, &rerr); - - wasi_io_streams_output_stream_drop_borrow(out_stream); - - ok = wasi_http_types_static_outgoing_body_finish(body, NULL, &http_err); - if (!ok) - ex("wasi_http_types_static_outgoing_body_finish() failed\n"); } |