Add "request.is_handled" condition
parent
80346e85d1
commit
367404fdb1
|
@ -44,6 +44,7 @@ typedef enum {
|
|||
LI_COMP_REQUEST_QUERY_STRING,
|
||||
LI_COMP_REQUEST_METHOD,
|
||||
LI_COMP_REQUEST_CONTENT_LENGTH,
|
||||
LI_COMP_REQUEST_IS_HANDLED,
|
||||
LI_COMP_PHYSICAL_PATH,
|
||||
LI_COMP_PHYSICAL_EXISTS,
|
||||
LI_COMP_PHYSICAL_SIZE,
|
||||
|
|
|
@ -253,6 +253,7 @@ const char* li_cond_lvalue_to_string(liCondLValue t) {
|
|||
case LI_COMP_REQUEST_QUERY_STRING: return "request.query";
|
||||
case LI_COMP_REQUEST_METHOD: return "request.method";
|
||||
case LI_COMP_REQUEST_CONTENT_LENGTH: return "request.length";
|
||||
case LI_COMP_REQUEST_IS_HANDLED: return "request.is_handled";
|
||||
case LI_COMP_PHYSICAL_PATH: return "physical.path";
|
||||
case LI_COMP_PHYSICAL_EXISTS: return "physical.exist";
|
||||
case LI_COMP_PHYSICAL_SIZE: return "physical.size";
|
||||
|
@ -292,6 +293,8 @@ liCondLValue li_cond_lvalue_from_string(const gchar *str, guint len) {
|
|||
return LI_COMP_REQUEST_CONTENT_LENGTH;
|
||||
else if (strncmp(c, "header", len) == 0)
|
||||
return LI_COMP_REQUEST_HEADER;
|
||||
else if (strncmp(c, "is_handled", len) == 0)
|
||||
return LI_COMP_REQUEST_IS_HANDLED;
|
||||
} else if (g_str_has_prefix(c, "physical.")) {
|
||||
c += sizeof("physical.")-1;
|
||||
len -= sizeof("physical.")-1;
|
||||
|
@ -347,6 +350,9 @@ static liHandlerResult li_condition_check_eval_bool(liVRequest *vr, liCondition
|
|||
}
|
||||
|
||||
switch (cond->lvalue->type) {
|
||||
case LI_COMP_REQUEST_IS_HANDLED:
|
||||
*res = li_vrequest_is_handled(vr);
|
||||
break;
|
||||
case LI_COMP_PHYSICAL_ISDIR:
|
||||
*res = S_ISDIR(st.st_mode);
|
||||
break;
|
||||
|
@ -577,6 +583,9 @@ static liHandlerResult li_condition_check_eval_ip(liVRequest *vr, liCondition *c
|
|||
case LI_COMP_REQUEST_METHOD:
|
||||
VR_ERROR(vr, "%s", "Cannot parse request.method as ip");
|
||||
return LI_HANDLER_ERROR;
|
||||
case LI_COMP_REQUEST_IS_HANDLED:
|
||||
VR_ERROR(vr, "%s", "Cannot parse request.is_handled as ip");
|
||||
return LI_HANDLER_ERROR;
|
||||
case LI_COMP_PHYSICAL_PATH:
|
||||
case LI_COMP_PHYSICAL_EXISTS:
|
||||
VR_ERROR(vr, "%s", "Cannot parse physical.path(-exists) as ip");
|
||||
|
|
|
@ -855,6 +855,8 @@
|
|||
lvalue = li_condition_lvalue_new(LI_COMP_REQUEST_REMOTEIP, NULL);
|
||||
else if (g_str_equal(str, "localip"))
|
||||
lvalue = li_condition_lvalue_new(LI_COMP_REQUEST_LOCALIP, NULL);
|
||||
else if (g_str_equal(str, "is_handled"))
|
||||
lvalue = li_condition_lvalue_new(LI_COMP_REQUEST_IS_HANDLED, NULL);
|
||||
else if (g_str_equal(str, "header")) {
|
||||
if (k == NULL) {
|
||||
WARNING(srv, "%s", "header conditional needs a key");
|
||||
|
|
Loading…
Reference in New Issue