Skip to content

uvhttp_connection.h ​

Functions ​

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_start(uvhttp_connection_t *conn) ​

uvhttp_connection_close(uvhttp_connection_t *conn) ​

Return Type: void

uvhttp_connection_restart_read(uvhttp_connection_t *conn) ​

uvhttp_connection_schedule_restart_read(uvhttp_connection_t *conn) ​

uvhttp_connection_start_tls_handshake(uvhttp_connection_t *conn) ​

uvhttp_connection_tls_read(uvhttp_connection_t *conn) ​

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

uvhttp_connection_tls_handshake_func(uvhttp_connection_t *conn) ​

uvhttp_connection_tls_cleanup(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_get_state_string(uvhttp_connection_state_t state) ​

Return Type: const char *

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

uvhttp_connection_handle_websocket_handshake(uvhttp_connection_t *conn, const char *ws_key) ​

uvhttp_connection_switch_to_websocket(uvhttp_connection_t *conn) ​

Return Type: void

uvhttp_connection_websocket_close(uvhttp_connection_t *conn) ​

Return Type: void

Released under MIT License