#define IS_URL(ctx, url) \
mco_lews_strcmp(url, (ctx)->incoming_buf, (ctx)->url_pos, (ctx)->url_pos + (ctx)->url_len)
ctx
lews_connection_context_h) containing the parsed HTTP request.url
"/test").This macro checks whether the URL path in the current HTTP request exactly matches the specified
urlstring.It uses
mco_lews_strcmp(), passing the start position of the URL (url_pos) and a synthetic buffer size ofurl_pos + url_len. This effectively restricts the comparison to the exact length of the parsed URL token, ensuring that only the path (without query parameters or fragments) is compared.The comparison is case-sensitive and requires an exact match in both content and length.
lews_connection_context_h p_ctx; ... if (IS_METHOD(p_ctx, "GET")) { if (IS_URL(p_ctx, "/test")) { // Handle request to /test ... } }
1
url string.0