1058 /* not a list of methods, so just compare the 2 strings */ |
1058 /* not a list of methods, so just compare the 2 strings */ |
1059 if(!strcmp(cmp, method)) { |
1059 if(!strcmp(cmp, method)) { |
1060 return 1; |
1060 return 1; |
1061 } |
1061 } |
1062 } else if(cmp[0] == 0) { |
1062 } else if(cmp[0] == 0) { |
1063 /* empty string */ |
1063 // empty string |
|
1064 log_ereport( |
|
1065 LOG_WARN, |
|
1066 "Skipped service saf with empty method parameter"); |
1064 return 0; |
1067 return 0; |
1065 } |
1068 } |
1066 |
1069 |
1067 size_t method_len = strlen(method); |
1070 size_t method_len = strlen(method); |
1068 size_t last_pos = 0; |
1071 size_t last_pos = 0; |
1080 last_pos = i + 1; |
1083 last_pos = i + 1; |
1081 } |
1084 } |
1082 } |
1085 } |
1083 |
1086 |
1084 return 0; |
1087 return 0; |
|
1088 } |
|
1089 |
|
1090 /* |
|
1091 * checks if the content type matches the cmp string |
|
1092 * the format of cmp is a single string with wildcards or a list |
|
1093 * of types (also with wildcard support) |
|
1094 * (type1|type2*) |
|
1095 */ |
|
1096 int contenttype_match(sstr_t cmp, sstr_t ctype) { |
|
1097 if(cmp.ptr[0] != '(') { |
|
1098 if(cmp.ptr[0] == '*') { |
|
1099 cmp.ptr++; |
|
1100 cmp.length--; |
|
1101 return sstrsuffix(ctype, cmp); |
|
1102 } else if(cmp.ptr[cmp.length-1] == '*') { |
|
1103 cmp.length--; |
|
1104 return sstrprefix(ctype, cmp); |
|
1105 } else { |
|
1106 return !sstrcmp(cmp, ctype); |
|
1107 } |
|
1108 } else if(cmp.ptr[0] == 0) { |
|
1109 log_ereport(LOG_WARN, "Skipped service saf with empty type parameter"); |
|
1110 return 0; |
|
1111 } |
|
1112 |
|
1113 cmp = sstrsubsl(cmp, 1, cmp.length - 2); |
|
1114 |
|
1115 int begin = 0; |
|
1116 for(int i=0;i<cmp.length;i++) { |
|
1117 if(cmp.ptr[i] == '|') { |
|
1118 if(contenttype_match(sstrsubsl(cmp, begin, i-begin), ctype)) { |
|
1119 return 1; |
|
1120 } |
|
1121 begin = i + 1; |
|
1122 } |
|
1123 } |
|
1124 return contenttype_match(sstrsubs(cmp, begin), ctype); |
1085 } |
1125 } |
1086 |
1126 |
1087 /* |
1127 /* |
1088 * adds objects with specific name or path to the httpd_objset |
1128 * adds objects with specific name or path to the httpd_objset |
1089 */ |
1129 */ |