Skip to content

uvhttp_connection.c ​

Functions ​

uvhttp_validate_buffer_capacity(uvhttp_connection_t *conn, size_t additional_size) ​

Return Type: int

Validate buffer capacity for additional data.

Parameters:

  • conn: Connection to validate
  • additional_size: Size of data to add

Returns: int 0 if sufficient capacity, -1 if overflow would occur

Note: This helper function validates if buffer has enough space for additional data Note: Logs error and returns -1 if overflow would occur

on_idle_restart_read(uv_idle_t *handle) ​

Return Type: void

on_alloc_buffer(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf) ​

Return Type: void

on_read(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf) ​

Return Type: void

uvhttp_connection_restart_read(uvhttp_connection_t *conn) ​

connection_new_close_cb(uv_handle_t *handle) ​

Return Type: void

uvhttp_connection_new(struct uvhttp_server *server, uvhttp_connection_t **conn) ​

createnewConnectionobject

Parameters:

  • server: Serverobject
  • conn: outputParameter, Used forreceiveConnectionpointer

Returns: UVHTTP_OK Success, othervaluerepresentsFailure

Note: Successwhen, *conn issettovalidConnectionobject, mustUse uvhttp_connection_free release Note: Failurewhen, *conn issetto NULL

uvhttp_connection_free(uvhttp_connection_t *conn) ​

Return Type: void

uvhttp_connection_free_resources(uvhttp_connection_t *conn) ​

Return Type: void

uvhttp_connection_start(uvhttp_connection_t *conn) ​

on_handle_close(uv_handle_t *handle) ​

Return Type: void

uvhttp_connection_close(uvhttp_connection_t *conn) ​

Return Type: void

uvhttp_connection_set_state(uvhttp_connection_t *conn, uvhttp_connection_state_t state) ​

Return Type: void

uvhttp_connection_tls_handshake_func(uvhttp_connection_t *conn) ​

uvhttp_connection_tls_read(uvhttp_connection_t *conn) ​

uvhttp_connection_tls_cleanup(uvhttp_connection_t *conn) ​

Return Type: void

uvhttp_connection_start_tls_handshake(uvhttp_connection_t *conn) ​

uvhttp_connection_tls_write(uvhttp_connection_t *conn, const void *data, size_t len) ​

uvhttp_connection_schedule_restart_read(uvhttp_connection_t *conn) ​

connection_timeout_cb(uv_timer_t *handle) ​

Return Type: void

uvhttp_connection_start_timeout(uvhttp_connection_t *conn) ​

ConnectionTimeoutwhen.

Parameters:

  • conn: Connectionobject

Returns: int SuccessReturn UVHTTP_OK, FailureReturnnegativeError code

Note: Timeoutwhen conn->server->config->connection_timeout read, if config to NULL, Use UVHTTP_CONNECTION_TIMEOUT_DEFAULT Note: Functionstoprestartexistingwhen(if)

uvhttp_connection_start_timeout_custom(uvhttp_connection_t *conn, int timeout_seconds) ​

ConnectionTimeoutwhen(customTimeoutwhen)

Parameters:

  • conn: Connectionobject
  • timeout_seconds: Timeoutwhen(seconds), scope: 5-300

Returns: uvhttp_error_t SuccessReturn UVHTTP_OK, FailureReturnnegativeError code

Note: Timeoutwhenmust UVHTTP_CONNECTION_TIMEOUT_MIN and UVHTTP_CONNECTION_TIMEOUT_MAX Note: Functionstoprestartexistingwhen(if) Note: ifTimeoutwhencauseoverflow, Return UVHTTP_ERROR_INVALID_PARAM

Released under MIT License