MCO_RET mco_lews_get_query_param_int(const char *in_buffer, mco_uint2 in_buf_size,
const char *param_name, mco_int4 *out_value);
in_buffer
in_buf_size
in_buffer.param_name
"tp").out_value
This function searches for a query or form parameter named
param_namein the provided buffer and attempts to parse its value as a signed 32-bit integer (mco_int4).For HTTP GET requests, parameters are expected in the query string (the part after
?in the URL).
For HTTP POST requests withapplication/x-www-form-urlencodedcontent type, parameters are expected in the request body.The function supports standard URL-encoded parameter format (e.g.,
tp=123). The numeric value must consist only of an optional minus sign followed by decimal digits.If the numeric string exceeds 19 characters (the maximum length of a 64-bit signed integer in decimal), the function returns
MCO_E_LEWS_NO_ENOUGH_MEMORY— this is a safeguard against overflow, even though the target type is 32-bit.lews_connection_context_h p_ctx; mco_int4 tp; ... if (IS_METHOD(p_ctx, "GET")) { if (IS_URL(p_ctx, "/test")) { ret = mco_lews_get_query_param_int(p_ctx->incoming_buf + p_ctx->params_pos, p_ctx->params_len, "tp", &tp); if (ret == MCO_S_OK) { /* Use 'tp' value */ ... } } }
MCO_S_OK
MCO_E_LEWS_NONEXISTENT_PARAMETER
MCO_E_LEWS_NO_ENOUGH_MEMORY