diff --git a/capi/libuwebsockets.cpp b/capi/libuwebsockets.cpp index bfe143f..e2bb12f 100644 --- a/capi/libuwebsockets.cpp +++ b/capi/libuwebsockets.cpp @@ -1154,51 +1154,51 @@ extern "C" return uwsRes->hasResponded(); } - void uws_res_on_writable(int ssl, uws_res_t *res, bool (*handler)(uws_res_t *res, uintmax_t, void *opcional_data), void *opcional_data) + void uws_res_on_writable(int ssl, uws_res_t *res, bool (*handler)(uws_res_t *res, uintmax_t, void *optional_data), void *optional_data) { if (ssl) { uWS::HttpResponse *uwsRes = (uWS::HttpResponse *)res; - uwsRes->onWritable([handler, res, opcional_data](uintmax_t a) - { return handler(res, a, opcional_data); }); + uwsRes->onWritable([handler, res, optional_data](uintmax_t a) + { return handler(res, a, optional_data); }); } else { uWS::HttpResponse *uwsRes = (uWS::HttpResponse *)res; - uwsRes->onWritable([handler, res, opcional_data](uintmax_t a) - { return handler(res, a, opcional_data); }); + uwsRes->onWritable([handler, res, optional_data](uintmax_t a) + { return handler(res, a, optional_data); }); } } - void uws_res_on_aborted(int ssl, uws_res_t *res, void (*handler)(uws_res_t *res, void *opcional_data), void *opcional_data) + void uws_res_on_aborted(int ssl, uws_res_t *res, void (*handler)(uws_res_t *res, void *optional_data), void *optional_data) { if (ssl) { uWS::HttpResponse *uwsRes = (uWS::HttpResponse *)res; - uwsRes->onAborted([handler, res, opcional_data] - { handler(res, opcional_data); }); + uwsRes->onAborted([handler, res, optional_data] + { handler(res, optional_data); }); } else { uWS::HttpResponse *uwsRes = (uWS::HttpResponse *)res; - uwsRes->onAborted([handler, res, opcional_data] - { handler(res, opcional_data); }); + uwsRes->onAborted([handler, res, optional_data] + { handler(res, optional_data); }); } } - void uws_res_on_data(int ssl, uws_res_t *res, void (*handler)(uws_res_t *res, const char *chunk, size_t chunk_length, bool is_end, void *opcional_data), void *opcional_data) + void uws_res_on_data(int ssl, uws_res_t *res, void (*handler)(uws_res_t *res, const char *chunk, size_t chunk_length, bool is_end, void *optional_data), void *optional_data) { if (ssl) { uWS::HttpResponse *uwsRes = (uWS::HttpResponse *)res; - uwsRes->onData([handler, res, opcional_data](auto chunk, bool is_end) - { handler(res, chunk.data(), chunk.length(), is_end, opcional_data); }); + uwsRes->onData([handler, res, optional_data](auto chunk, bool is_end) + { handler(res, chunk.data(), chunk.length(), is_end, optional_data); }); } else { uWS::HttpResponse *uwsRes = (uWS::HttpResponse *)res; - uwsRes->onData([handler, res, opcional_data](auto chunk, bool is_end) - { handler(res, chunk.data(), chunk.length(), is_end, opcional_data); }); + uwsRes->onData([handler, res, optional_data](auto chunk, bool is_end) + { handler(res, chunk.data(), chunk.length(), is_end, optional_data); }); } } diff --git a/capi/libuwebsockets.h b/capi/libuwebsockets.h index 77c73f8..33182f2 100644 --- a/capi/libuwebsockets.h +++ b/capi/libuwebsockets.h @@ -222,9 +222,9 @@ extern "C" DLL_EXPORT uintmax_t uws_res_get_write_offset(int ssl, uws_res_t *res); DLL_EXPORT void uws_res_override_write_offset(int ssl, uws_res_t *res, uintmax_t offset); DLL_EXPORT bool uws_res_has_responded(int ssl, uws_res_t *res); - DLL_EXPORT void uws_res_on_writable(int ssl, uws_res_t *res, bool (*handler)(uws_res_t *res, uintmax_t, void *opcional_data), void *user_data); - DLL_EXPORT void uws_res_on_aborted(int ssl, uws_res_t *res, void (*handler)(uws_res_t *res, void *opcional_data), void *opcional_data); - DLL_EXPORT void uws_res_on_data(int ssl, uws_res_t *res, void (*handler)(uws_res_t *res, const char *chunk, size_t chunk_length, bool is_end, void *opcional_data), void *opcional_data); + DLL_EXPORT void uws_res_on_writable(int ssl, uws_res_t *res, bool (*handler)(uws_res_t *res, uintmax_t, void *optional_data), void *user_data); + DLL_EXPORT void uws_res_on_aborted(int ssl, uws_res_t *res, void (*handler)(uws_res_t *res, void *optional_data), void *optional_data); + DLL_EXPORT void uws_res_on_data(int ssl, uws_res_t *res, void (*handler)(uws_res_t *res, const char *chunk, size_t chunk_length, bool is_end, void *optional_data), void *optional_data); DLL_EXPORT void uws_res_upgrade(int ssl, uws_res_t *res, void *data, const char *sec_web_socket_key, size_t sec_web_socket_key_length, const char *sec_web_socket_protocol, size_t sec_web_socket_protocol_length, const char *sec_web_socket_extensions, size_t sec_web_socket_extensions_length, uws_socket_context_t *ws); DLL_EXPORT size_t uws_res_get_remote_address(int ssl, uws_res_t *res, const char **dest); DLL_EXPORT size_t uws_res_get_remote_address_as_text(int ssl, uws_res_t *res, const char **dest); diff --git a/src/HttpResponse.h b/src/HttpResponse.h index 180725b..bf4d381 100644 --- a/src/HttpResponse.h +++ b/src/HttpResponse.h @@ -230,7 +230,7 @@ public: #endif /* Manually upgrade to WebSocket. Typically called in upgrade handler. Immediately calls open handler. - * NOTE: Will invalidate 'this' as socket might change location in memory. Throw away aftert use. */ + * NOTE: Will invalidate 'this' as socket might change location in memory. Throw away after use. */ template void upgrade(UserData &&userData, std::string_view secWebSocketKey, std::string_view secWebSocketProtocol, std::string_view secWebSocketExtensions,