projects
/
privoxy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Terminate the body of the HTTP snipplets with a single new line instead of \r\n
[privoxy.git]
/
tools
/
url-pattern-translator.pl
diff --git
a/tools/url-pattern-translator.pl
b/tools/url-pattern-translator.pl
index
f159fb0
..
5477a87
100755
(executable)
--- a/
tools/url-pattern-translator.pl
+++ b/
tools/url-pattern-translator.pl
@@
-15,11
+15,6
@@
#
# url-pattern-translator.pl old.action > new.action
#
#
# url-pattern-translator.pl old.action > new.action
#
-# Only convert your files once, or, as RoboCop used to say,
-# there will be... trouble.
-#
-# $Id: url-pattern-translator.pl 1.9 2008/04/06 16:01:49 fk Exp $
-#
# Copyright (c) 2008 Fabian Keil <fk@fabiankeil.de>
#
# Permission to use, copy, modify, and distribute this software for any
# Copyright (c) 2008 Fabian Keil <fk@fabiankeil.de>
#
# Permission to use, copy, modify, and distribute this software for any
@@
-63,20
+58,19
@@
sub convert_host_pattern ($) {
}
# Match-all syntax has changed ...
}
# Match-all syntax has changed ...
- $hp =~ s@\*@
.
*@g;
+ $hp =~ s@\*@
[^.]
*@g;
- if ($hp =~ m@\.$@) {
- # Extended host patterns are right-anchored by default
- $hp = $hp . '.*';
- }
+ # Extended host patterns are right-anchored by default
+ $hp =~ s@\.$@(\..*)?@;
# Literal dots have to be escaped
# Literal dots have to be escaped
- $hp =~ s@(\.[^*])@\\$1@g;
+ $hp =~ s@(
(?<!\\)
\.[^*])@\\$1@g;
# Match single character with a dot.
# Match single character with a dot.
- $hp =~ s@\?@.@g;
+ $hp =~ s@
(?<!\))
\?@.@g;
- #p("converted $host_pattern to: $hp");
+ # Add the prefix
+ $hp = "PCRE-HOST-PATTERN:" . $hp;
return $hp;
}
return $hp;
}
@@
-97,7
+91,11
@@
sub looks_interesting($) {
$type_to_skip = "whitespace";
$type_to_skip = "whitespace";
- } elsif (m@^\s*TAG:@) {
+ } elsif (m@^\s*CLIENT-TAG:@i) {
+
+ $type_to_skip = "client tag patttern";
+
+ } elsif (m@^\s*TAG:@i) {
$type_to_skip = "tag patttern";
$type_to_skip = "tag patttern";
@@
-105,9
+103,17
@@
sub looks_interesting($) {
$type_to_skip = "macro or version definition";
$type_to_skip = "macro or version definition";
+ } elsif (m@^\s*standard\.@) {
+
+ $type_to_skip = "predefined settings";
+
+ } elsif (m@^\s*PCRE-HOST-PATTERN:@i) {
+
+ $type_to_skip = "already converted pcre host patttern";
+
}
}
- #p("Skipping " . $type_to_skip . ": " . $_);
+ #p("Skipping " . $type_to_skip . ": " . $_)
if defined $type_to_skip
;
return not defined $type_to_skip;
}
return not defined $type_to_skip;
}