uvhttp_protocol_upgrade.c
UVHTTP protocol upgrade framework implementation.
Functions
uvhttp_server_register_protocol_upgrade(uvhttp_server_t *server, const char *protocol_name, const char *upgrade_header, uvhttp_protocol_detector_t detector, uvhttp_protocol_upgrade_handler_t handler, void *user_data)
Register protocol upgrade handler.
Parameters:
server: Server objectprotocol_name: Protocol name (e.g., "ipps", "grpc-web"), will be normalized to lowercaseupgrade_header: Upgrade header value (optional, for fast matching), will be normalized to lowercasedetector: Protocol detector functionhandler: Protocol upgrade handler functionuser_data: User data, will be passed to handler
Returns: uvhttp_error_t UVHTTP_OK for success
uvhttp_server_unregister_protocol_upgrade(uvhttp_server_t *server, const char *protocol_name)
Unregister protocol upgrade handler.
Parameters:
server: Server objectprotocol_name: Protocol name
uvhttp_connection_transfer_ownership(uvhttp_connection_t *conn, uvhttp_connection_ownership_callback_t callback, void *user_data)
Transfer connection ownership to external library.
Parameters:
conn: HTTP connection objectcallback: Ownership transfer callback functionuser_data: User data
Returns: uvhttp_error_t UVHTTP_OK for success
uvhttp_connection_set_lifecycle(uvhttp_connection_t *conn, uvhttp_connection_lifecycle_t *lifecycle)
Set connection lifecycle callback.
Parameters:
conn: HTTP connection objectlifecycle: Lifecycle callback structure
Returns: uvhttp_error_t UVHTTP_OK for success
uvhttp_connection_get_fd(uvhttp_connection_t *conn, int *fd)
Get connection file descriptor.
Parameters:
conn: HTTP connection objectfd: Output parameter, file descriptor
uvhttp_connection_get_peer_address(uvhttp_connection_t *conn, struct sockaddr_storage *addr, socklen_t *addr_len)
Get client address.
Parameters:
conn: HTTP connection objectaddr: Output parameter, client addressaddr_len: Input/output parameter, address length