Fix up CSS when forwarding

This commit is contained in:
Jamie Cameron
2007-10-02 17:51:49 +00:00
parent 3b682c577b
commit b76fbc2541

View File

@@ -137,6 +137,7 @@ else {
# read back the rest of the page
if ($header{'content-type'} =~ /text\/html/ && !$header{'x-no-links'}) {
# Fix up HTML
while($_ = &read_http_connection($con)) {
s/src='(\/[^']*)'/src='$url$1'/gi;
s/src="(\/[^"]*)"/src="$url$1"/gi;
@@ -157,7 +158,15 @@ if ($header{'content-type'} =~ /text\/html/ && !$header{'x-no-links'}) {
print;
}
}
elsif ($header{'content-type'} =~ /text\/css/ && !$header{'x-no-links'}) {
# Fix up CSS
while($_ = &read_http_connection($con)) {
s/url\("(\/[^"]*)"\)/url\("$url$1"\)/gi;
print;
}
}
else {
# Just pass through
while($buf = &read_http_connection($con, 1024)) {
print $buf;
}