Hi Robert,
I tested last night the new content processing framework. It is great
especially because of the acl and configuration features.
But I was unable to use it because of the lack of some details I'll
explain later. Fortunately, it will not a big work to have a nice
solution as I guess.
So let's try to have a concrete content processing module (called
hi_subs): for some reason, I want to have squid send me all text/plain
files with the word "Hello" substituted by "Hi".
So when squid calls the function
clientFilterHiSubs(*buf,len,*filter_list,filters,flags,data), it'll send
me in buf, the headers, then the file content and then stops calling
this function.
The first problem is that my filter have not to substitute "Hello" by
"Hi" in the headers. Second, the filter need to know when is it called
with the last chunk to do some terminating actions(for example flushing
its buffers in our case).
So I suggest that the flags parameter contain some information which
will guide the filter while processing data. When we call it with the
headers in buf, you can put flags |=CP_HEADERS and when we call it with
the last chunk, flags |= CP_LAST_CHUNK.
I recommend also to ensure that the headers are always sent not mixed
with the body of the reply. I mean, there always not less than two calls
to the filter. One for the headers, and the other for the body.
This implies some clarification:
* If the headers size is < MAX_CHUNK_SIZE (I think it is 4096), call the
filter with the headers and flag = CP_HEADERS
* If the headers size is > MAX_CHUNK_SIZE, call the filter with the
headers chunks and flag = CP_HEADERS as long as required. (If headers
size is 10000 for example, call it first with 4096 bytes, then with 4096
bytes then with 1808 bytes before starting sending the body).
* If the body size is 0, do a call to the filter with flag=CP_LAST_CHUNK
(I mean, always do a call to filters for the body even if it is empty).
Last request, I'd prefer to have in the prototype of the filters the
reply/request struct for read only. The programmer can use to have some
information about what it is processing.
That's all folks...
Waiting your comments and patches....
--Moez
Received on Wed Jan 31 2001 - 02:26:52 MST
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:13:26 MST