applied. You could also specified differents headers for same pattern.
The format is: `pattern name=value`. For each request matching `pattern`, an
-HTTP header "name: value" will be added to the response.
+HTTP header "name: value" will be added to the response. If value is empty, a
+previously added header could be removed.
.RS
.PP
Example:
char *name = read_name(&parse);
char *value = read_value(&parse);
- if (pattern && name && value) {
+ if (pattern && name) {
MatchARH *marh = g_slice_new0(MatchARH);
marh->pattern = g_strdup(pattern);
MatchARH *marh = (MatchARH *)l->data;
if (util_wildmatch(marh->pattern, uri)) {
- /* the pattern match, so replace headers
- * as side-effect, for one header the last matched will be keeped */
- soup_message_headers_replace(msg->response_headers,
- marh->name, marh->value);
+ if (marh->value) {
+ /* the pattern match, so replace headers
+ * as side-effect, for one header the last matched will be keeped */
+ soup_message_headers_replace(msg->response_headers,
+ marh->name, marh->value);
+
+ PRINT_DEBUG(" header added: %s: %s", marh->name, marh->value);
+ } else {
+ /* remove a previously setted auto-reponse-header */
+ soup_message_headers_remove(msg->response_headers, marh->name);
+
+ PRINT_DEBUG(" header removed: %s", marh->name);
+ }
- PRINT_DEBUG(" header added: %s: %s", marh->name, marh->value);
}
}
}