1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-27 07:26:38 +02:00

Rename some more:

* WEB() now has handle_request() and handle_body(), makes more sense.
* webserver_handle_body_data() -> webserver_handle_body()
* and similar cases
This commit is contained in:
Bram Matthys
2022-06-08 17:58:08 +02:00
parent 12f2cd8555
commit 4a68008b81
8 changed files with 17 additions and 17 deletions
+2 -2
View File
@@ -837,7 +837,7 @@ extern MODVAR int (*make_oper)(Client *client, const char *operblock_name, const
extern MODVAR int (*unreal_match_iplist)(Client *client, NameList *l);
extern MODVAR void (*webserver_send_response)(Client *client, int status, char *msg);
extern MODVAR void (*webserver_close_client)(Client *client);
extern MODVAR int (*webserver_handle_request_body)(Client *client, WebRequest *web, const char *readbuf, int length);
extern MODVAR int (*webserver_handle_body)(Client *client, WebRequest *web, const char *readbuf, int length);
extern MODVAR void (*rpc_response)(Client *client, json_t *request, json_t *result);
extern MODVAR void (*rpc_error)(Client *client, json_t *request, int error_code, const char *error_message);
extern MODVAR void (*rpc_error_fmt)(Client *client, json_t *request, int error_code, FORMAT_STRING(const char *fmt), ...) __attribute__((format(printf,4,5)));
@@ -879,7 +879,7 @@ extern void do_unreal_log_remote_deliver_default_handler(LogLevel loglevel, cons
extern int make_oper_default_handler(Client *client, const char *operblock_name, const char *operclass, ConfigItem_class *clientclass, long modes, const char *snomask, const char *vhost);
extern void webserver_send_response_default_handler(Client *client, int status, char *msg);
extern void webserver_close_client_default_handler(Client *client);
extern int webserver_handle_request_body_default_handler(Client *client, WebRequest *web, const char *readbuf, int length);
extern int webserver_handle_body_default_handler(Client *client, WebRequest *web, const char *readbuf, int length);
extern void rpc_response_default_handler(Client *client, json_t *request, json_t *result);
extern void rpc_error_default_handler(Client *client, json_t *request, int error_code, const char *error_message);
extern void rpc_error_fmt_default_handler(Client *client, json_t *request, int error_code, const char *fmt, ...);
+1 -1
View File
@@ -2492,7 +2492,7 @@ enum EfunctionType {
EFUNC_UNREAL_MATCH_IPLIST,
EFUNC_WEBSERVER_SEND_RESPONSE,
EFUNC_WEBSERVER_CLOSE_CLIENT,
EFUNC_WEBSERVER_HANDLE_BODY_DATA,
EFUNC_WEBSERVER_HANDLE_BODY,
EFUNC_RPC_RESPONSE,
EFUNC_RPC_ERROR,
EFUNC_RPC_ERROR_FMT,
+1 -1
View File
@@ -1726,7 +1726,7 @@ struct WebRequest {
typedef struct WebServer WebServer;
struct WebServer {
int (*handle_request)(Client *client, WebRequest *web);
int (*handle_data)(Client *client, WebRequest *web, const char *buf, int length);
int (*handle_body)(Client *client, WebRequest *web, const char *buf, int length);
};
struct ConfigItem_listen {
+2 -2
View File
@@ -138,7 +138,7 @@ int (*make_oper)(Client *client, const char *operblock_name, const char *opercla
int (*unreal_match_iplist)(Client *client, NameList *l);
void (*webserver_send_response)(Client *client, int status, char *msg);
void (*webserver_close_client)(Client *client);
int (*webserver_handle_request_body)(Client *client, WebRequest *web, const char *readbuf, int length);
int (*webserver_handle_body)(Client *client, WebRequest *web, const char *readbuf, int length);
void (*rpc_response)(Client *client, json_t *request, json_t *result);
void (*rpc_error)(Client *client, json_t *request, int error_code, const char *error_message);
void (*rpc_error_fmt)(Client *client, json_t *request, int error_code, const char *fmt, ...);
@@ -415,7 +415,7 @@ void efunctions_init(void)
efunc_init_function(EFUNC_UNREAL_MATCH_IPLIST, unreal_match_iplist, NULL);
efunc_init_function(EFUNC_WEBSERVER_SEND_RESPONSE, webserver_send_response, webserver_send_response_default_handler);
efunc_init_function(EFUNC_WEBSERVER_CLOSE_CLIENT, webserver_close_client, webserver_close_client_default_handler);
efunc_init_function(EFUNC_WEBSERVER_HANDLE_BODY_DATA, webserver_handle_request_body, webserver_handle_request_body_default_handler);
efunc_init_function(EFUNC_WEBSERVER_HANDLE_BODY, webserver_handle_body, webserver_handle_body_default_handler);
efunc_init_function(EFUNC_RPC_RESPONSE, rpc_response, rpc_response_default_handler);
efunc_init_function(EFUNC_RPC_ERROR, rpc_error, rpc_error_default_handler);
efunc_init_function(EFUNC_RPC_ERROR_FMT, rpc_error_fmt, rpc_error_fmt_default_handler);
+1 -1
View File
@@ -1392,7 +1392,7 @@ void webserver_close_client_default_handler(Client *client)
{
}
int webserver_handle_request_body_default_handler(Client *client, WebRequest *web, const char *readbuf, int length)
int webserver_handle_body_default_handler(Client *client, WebRequest *web, const char *readbuf, int length)
{
return 0;
}
+2 -2
View File
@@ -147,7 +147,7 @@ int rpc_config_run_ex(ConfigFile *cf, ConfigEntry *ce, int type, void *ptr)
l->start_handshake = rpc_client_handshake;
l->webserver = safe_alloc(sizeof(WebServer));
l->webserver->handle_request = rpc_handle_webrequest;
l->webserver->handle_data = rpc_handle_webrequest_data;
l->webserver->handle_body = rpc_handle_webrequest_data;
l->rpc_options = 1;
return 1;
@@ -207,7 +207,7 @@ int rpc_handle_webrequest_data(Client *client, WebRequest *web, const char *buf,
// NB: content_length
// NB: chunked transfers?
if (!webserver_handle_request_body(client, web, buf, len))
if (!webserver_handle_body(client, web, buf, len))
{
webserver_send_response(client, 400, "Error handling POST body data\n");
return 0;
+7 -7
View File
@@ -40,7 +40,7 @@ int webserver_handle_handshake(Client *client, const char *readbuf, int *length)
int webserver_handle_request_header(Client *client, const char *readbuf, int *length);
void _webserver_send_response(Client *client, int status, char *msg);
void _webserver_close_client(Client *client);
int _webserver_handle_request_body(Client *client, WebRequest *web, const char *readbuf, int length);
int _webserver_handle_body(Client *client, WebRequest *web, const char *readbuf, int length);
/* Global variables */
ModDataInfo *webserver_md;
@@ -50,7 +50,7 @@ MOD_TEST()
MARK_AS_OFFICIAL_MODULE(modinfo);
EfunctionAddVoid(modinfo->handle, EFUNC_WEBSERVER_SEND_RESPONSE, _webserver_send_response);
EfunctionAddVoid(modinfo->handle, EFUNC_WEBSERVER_CLOSE_CLIENT, _webserver_close_client);
EfunctionAdd(modinfo->handle, EFUNC_WEBSERVER_HANDLE_BODY_DATA, _webserver_handle_request_body);
EfunctionAdd(modinfo->handle, EFUNC_WEBSERVER_HANDLE_BODY, _webserver_handle_body);
return MOD_SUCCESS;
}
@@ -160,7 +160,7 @@ int webserver_packet_in(Client *client, const char *readbuf, int *length)
return 1; /* "normal" IRC client */
if (WEB(client)->request_header_parsed)
return WEBSERVER(client)->handle_data(client, WEB(client), readbuf, *length);
return WEBSERVER(client)->handle_body(client, WEB(client), readbuf, *length);
/* else.. */
return webserver_handle_request_header(client, readbuf, length);
@@ -408,7 +408,7 @@ int webserver_handle_request_header(Client *client, const char *readbuf, int *le
*/
nextframe = find_end_of_request(netbuf2, totalsize, &remaining_bytes);
if (nextframe)
return WEBSERVER(client)->handle_data(client, WEB(client), nextframe, remaining_bytes);
return WEBSERVER(client)->handle_body(client, WEB(client), nextframe, remaining_bytes);
return 0;
}
@@ -474,7 +474,7 @@ void _webserver_close_client(Client *client)
}
}
int webserver_handle_request_body_append_buffer(Client *client, const char *buf, int len)
int webserver_handle_body_append_buffer(Client *client, const char *buf, int len)
{
/* Guard.. */
if (len <= 0)
@@ -490,7 +490,7 @@ int webserver_handle_request_body_append_buffer(Client *client, const char *buf,
return 1;
}
int _webserver_handle_request_body(Client *client, WebRequest *web, const char *readbuf, int length)
int _webserver_handle_body(Client *client, WebRequest *web, const char *readbuf, int length)
{
char *buf;
long long n;
@@ -499,7 +499,7 @@ int _webserver_handle_request_body(Client *client, WebRequest *web, const char *
if (1) // (WEB(client)->transfer_encoding == TRANSFER_ENCODING_NONE)
{
/* Ohh.. so easy! */
webserver_handle_request_body_append_buffer(client, readbuf, length);
webserver_handle_body_append_buffer(client, readbuf, length);
WEB(client)->request_body_complete = 1; // FIXME: WRONG! But for testing ;)
return 1;
}
+1 -1
View File
@@ -231,7 +231,7 @@ int websocket_config_run_ex(ConfigFile *cf, ConfigEntry *ce, int type, void *ptr
l = (ConfigItem_listen *)ptr;
l->webserver = safe_alloc(sizeof(WebServer));
l->webserver->handle_request = websocket_handle_request;
l->webserver->handle_data = websocket_handle_websocket;
l->webserver->handle_body = websocket_handle_websocket;
for (cep = ce->items; cep; cep = cep->next)
{