?
Solved

Filtering HTML on a Web Server

Posted on 1999-01-18
2
Medium Priority
?
156 Views
Last Modified: 2013-12-25
All requests which reach Web Servers are responded with HTML streams back to the requesting client. Is there a way I can filter ALL the HTML output from the Web Server BEFORE it is sent to the client. This has nothing to do with files with specific extensions which I want to handle differently but with all the HTML output of the Web Server. I want to identify a specific tag which might be in any of the output and DO SOMETHING when I find it...

Thanx....
0
Comment
Question by:ariefishler
2 Comments
 
LVL 11

Accepted Solution

by:
mouatts earned 200 total points
ID: 1832312
In short yes maybe. To do it you must write an extension to the Web Server. How you do that depends on the web server.

The basic approach is that when an HTML page is transmitted by the server the server reads the head section of the page and transmits any HTTP messages indicated by HTTP-EQUIV meta tags.

This is known as head parsing and the trick to doing what you want to do is to include some additional parsing that will check the rest of the file.

There is a slight problem with this in that whilst HTML files are parsed most other types are not. So you will also need to include the code to parse any others that you wish to implement this upon and configure the server accordingly.

I don't think doing this is much of a problem with Netscape (I know it isn't because I've done it) and I think it shouldn't be a problem with either Apache or IIS. To do it with Oracle you will probably need to be on version 3 and you will need to dump the listerner an use an alternative HTTP server (if you're not using Oracle this won't make any sense so ignore it).

It is quite a big job and certainly too big for here. I would suggest that you look up the documentation for Apache, NSAPI (for Netscape) or ISAPI (for IIS) as you next step.

Incidentally in all cases you basically will have to write a library (DLL in windows, so on Unix) which is linked into the Server dynamically. Generally such libraries are (and should be ) written in C.

HTH
   Steve
0
 

Author Comment

by:ariefishler
ID: 1832313
Thanks for the answer....this is more or less what I expected but,
Before I accept I just want to clarify some things: I actually need to parse only HTML files (static, dynamic and any other created HTML type) which pass through the Web Server at a specific site.
I think that the part you wrote about "There is a slight problem with this in that whilst HTML files are parsed most other types are not. So you will also need to include the code to parse any others that you wish to implement this upon and configure the server accordingly. " becomes irelevant isn't it?

Can you elaborate on the other part you wrote "The basic approach is that when an HTML page is transmitted by the server the server reads the head section of the page and transmits any HTTP messages indicated by HTTP-EQUIV meta tags". What is the web server doing exactly here. I could not understand it from what you wrote. Do u also mean that I will have to hook the extension at the end of this parsing done by the server?

What I am trying to do is to plant my own tag in the HTMLs and parse it with my own code. This is something like Cold Fusion is doing if you know the product, but I think they have a specific extension for their files, and maybe that is how they map it to their code.

Wouldn't it be just easier to use a CGI at the place I want my special tag and make this CGI do what I want instead of parsing all the HTML. How much will I pay in communication time? (The HTML goes to the browser and then the CGI/Servlet is being called again from the BROWSER. Will it be expensive?)

Thanks....It can sure help :)
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses
Course of the Month16 days, 13 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question