Creating a filter for all text/html files

[prev] [thread] [next] [Date index for 2005/01/31]

From: Scott Gifford
Subject: Creating a filter for all text/html files
Date: 03:49 on 31 Jan 2005
Hello,

I'm working on moving a Web server to a new location, and to test it,
I'd like to use a simple filter to replace all references to the old
server name with the IP address of the new server.  This is just for
testing, so it's OK that it's not a perfect solution.

Basically, I'm doing:

    s/(?:www\.)?sitename\.(?:com|net|org)/1.2.3.4/ig;

I've got it working right now, but I'd like it to know the
Content-Type that Apache would use for a document, so I can decide
whether to filter it and so I can send a correct Content-Type header.

I can try to guess the content-type from the filename (which is what
I'm doing now), but I'd prefer not to re-implement Apache's system for
deciding content types, and I'd also like it to Do The Right Thing for
CGI/mod_perl scripts, where you can't tell by the filename what
content-type they're going to output.

Is there a way to do that?

Thanks!

---ScottG.

Creating a filter for all text/html files
Scott Gifford 03:49 on 31 Jan 2005

Re: Creating a filter for all text/html files
Philippe M. Chiasson 18:50 on 01 Feb 2005

Re: Creating a filter for all text/html files
Scott Gifford 07:39 on 03 Feb 2005

Re: Creating a filter for all text/html files
Geoffrey Young 19:01 on 01 Feb 2005

Generated at 12:39 on 05 Feb 2005 by mariachi v0.52