You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ben Davies <be...@stickyeyes.com> on 2008/06/02 16:31:56 UTC

[users@httpd] AddOutputFilterByType

Hi Everybody!

 

I've noticed that the directive AddOutputFilterByType has been deprecated in
Apache 2.1 and later. Does anyone have a suggestion (or a link) on how one
would be able to configure Apache to accomplish the same task without using
AddOutputFilterByType on Apache2.2?

 

Cheers,

 

Ben

 

Ben Davies | Lead Developer |  <http://www.stickyeyes.com/> Stickyeyes

6th Floor, 

West One, 

Wellington Street, 

Leeds, LS1 1BA 

Email:  <ma...@stickyeyes.com> ben.davies@stickyeyes.com

0113 391 2929 | Fax 0113 391 2939

 

This e-mail may contain information that is privileged, confidential or
otherwise protected from disclosure. It must not be used by, or its contents
copied or disclosed to persons other than the intended recipient. Any
liability (in negligence or otherwise) arising from any third party acting,
or refraining from acting, on any information contained in this e-mail is
excluded. The views expressed may not be official company policy, but
instead, the personal views of the originator. If you have received this
e-mail in error please notify the sender and delete the e-mail.

 


RE: [users@httpd] AddOutputFilterByType

Posted by Ben Davies <be...@stickyeyes.com>.
" MultiViews is used specifically when choosing
between a bunch of files that exist in the filesystem, but that have
different meta-data attached to them. You only have a single file, but
wish to process it in a bunch of different ways."

That's what I thought, though the brief explanation of MultiViewsMatch
Filters suggests something else.
I have a copy of the Apache Modules book and I'll have a dig through to see
if there is anything on this directive.

Cheers,

Ben

Ben Davies | Lead Developer | Stickyeyes
6th Floor, 
West One, 
Wellington Street, 
Leeds, LS1 1BA 
Email: ben.davies@stickyeyes.com
0113 391 2929 | Fax 0113 391 2939

This e-mail may contain information that is privileged, confidential or
otherwise protected from disclosure. It must not be used by, or its contents
copied or disclosed to persons other than the intended recipient. Any
liability (in negligence or otherwise) arising from any third party acting,
or refraining from acting, on any information contained in this e-mail is
excluded. The views expressed may not be official company policy, but
instead, the personal views of the originator. If you have received this
e-mail in error please notify the sender and delete the e-mail.

-----Original Message-----
From: jslive@gmail.com [mailto:jslive@gmail.com] On Behalf Of Joshua Slive
Sent: 03 June 2008 19:02
To: users@httpd.apache.org
Subject: Re: [users@httpd] AddOutputFilterByType

On Tue, Jun 3, 2008 at 6:42 AM, Ben Davies <be...@stickyeyes.com> wrote:
> Okay, this is great! Making some real headway here.
>
> Your suggestions works as expected. However, I want to throw another
spanner
> in the works :)
>
> I have a directory which only contains flac files. I have several bash
> scripts, each of which convert a flac file to another format (mp3, aac,
etc)
>
> I've setup various custom filters for each using ExtFilterDefine, and they
> all work as suggested.
>
> Now:
>
> I could expand your suggestion of using SetEnvIf to pass through the value
> of the quality field for each mimetype I want to support. This would be a
> fine solution, and would work.
>
> However, I'm interested in seeing if I can get MultiViews to work with
> directives provided by mod_filter.

I haven't though your problem through in detail, but I don't think
this approach will work. MultiViews is used specifically when choosing
between a bunch of files that exist in the filesystem, but that have
different meta-data attached to them. You only have a single file, but
wish to process it in a bunch of different ways.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] AddOutputFilterByType

Posted by Joshua Slive <jo...@slive.ca>.
On Tue, Jun 3, 2008 at 6:42 AM, Ben Davies <be...@stickyeyes.com> wrote:
> Okay, this is great! Making some real headway here.
>
> Your suggestions works as expected. However, I want to throw another spanner
> in the works :)
>
> I have a directory which only contains flac files. I have several bash
> scripts, each of which convert a flac file to another format (mp3, aac, etc)
>
> I've setup various custom filters for each using ExtFilterDefine, and they
> all work as suggested.
>
> Now:
>
> I could expand your suggestion of using SetEnvIf to pass through the value
> of the quality field for each mimetype I want to support. This would be a
> fine solution, and would work.
>
> However, I'm interested in seeing if I can get MultiViews to work with
> directives provided by mod_filter.

I haven't though your problem through in detail, but I don't think
this approach will work. MultiViews is used specifically when choosing
between a bunch of files that exist in the filesystem, but that have
different meta-data attached to them. You only have a single file, but
wish to process it in a bunch of different ways.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] AddOutputFilterByType

Posted by Ben Davies <be...@stickyeyes.com>.
Okay, this is great! Making some real headway here.

Your suggestions works as expected. However, I want to throw another spanner
in the works :)

I have a directory which only contains flac files. I have several bash
scripts, each of which convert a flac file to another format (mp3, aac, etc)

I've setup various custom filters for each using ExtFilterDefine, and they
all work as suggested. 

Now:

I could expand your suggestion of using SetEnvIf to pass through the value
of the quality field for each mimetype I want to support. This would be a
fine solution, and would work.

However, I'm interested in seeing if I can get MultiViews to work with
directives provided by mod_filter. It is my understanding that:

MultiViewsMatch Filters

Would tell Apache to check the mime-types of any attached filters and apply
those in order to provide the requested resource.

Here is a pseudo-example of what I've configured:

ExtFilterDefine Transcode_MP3 mode=output intype=audio/flac
outtype=audio/mp3 cmd="flac2mp3"
ExtFilterDefine Transcode_AAC mode=output intype=audio/flac
outtype=audio/aac cmd="flac2aac"
ExtFilterDefine Transcode_MP4 mode=output intype=audio/flac
outtype=audio/mp4 cmd="flac2mp4"

<Directory /mylib>

	Options MultiViews

	MultiViewsMatch Filters
	
	FilterProvider Transcode_MP3 ext_filter Content-type audio/mp3
	FilterProvider Transcode_AAC ext_filter Content-type audio/aac
	FilterProvider Transcode_MP4 ext_filter Content-type audio/mp4

	FilterChain Transcode_MP3 Transcode_AAC Transcode_MP4

</Directory>
Alias /lib /mylib

The directory /mylib only contains flac files.

So, in theory, I should be able to make the following request:

GET /lib/song1
Accept: audio/mp3;q=1,audio/aac;q=0.5

And the process should be:

1) MultiViews fires up and tries to conneg the file. Matches the audio/mp3
type from the Accept header.
2) Matches the file /mylib/song1.flac
3) Passes the file out through the custom filter Transcode_MP3 (flac2mp3
script)
4) Returns song1.mp3

Can anyone give me some advice? My main concerns are regarding the process
Apache goes through to accomplish this:

1) The Second parameter of FilterProvider should be the provider-name. In
the example above, Apache refuses to start if I use "ext_filter", but
replacing it with "Transcode_MP3" lets it start (the thinking is that the
provider-name is the custom filter name I have previously setup using
ExtFilterDefine, but I think this may be wrong)

2) I think I may have made a incorrect assumption that multiviews will grab
the song1.flac file and pass it through to the appropriate filter. Is this
correct? If "MultiViewsMatch Filters" is used, will MultiViews pass through
the first file that *could* match to the appropriate filter? I couldn't find
any further information on what happens with this directive from the Apache
2.2 Documentation.

3) This may seem like a long winded way of doing things, but I am interested
in running my custom filter as much like "real" filters as possible, so that
in the future I could replace them with properly coded "real" filters :).
That and I really want to understand Apache Filters better, and considering
Apache source code is way out of my league, custom/script filters are about
the best I can cope with. If I can do pretty much everything you can with
custom/script filters you can do with "real" filters, that would definitely
help my understanding.

If you have a better, more in-depth reference for filters (besides the
Apache 2.2 Documentation), please send me the link, and I'll quit bothering
the list :)

Again, thanks for your help so far.

Cheers,

Ben



Ben Davies | Lead Developer | Stickyeyes
6th Floor, 
West One, 
Wellington Street, 
Leeds, LS1 1BA 
Email: ben.davies@stickyeyes.com
0113 391 2929 | Fax 0113 391 2939

This e-mail may contain information that is privileged, confidential or
otherwise protected from disclosure. It must not be used by, or its contents
copied or disclosed to persons other than the intended recipient. Any
liability (in negligence or otherwise) arising from any third party acting,
or refraining from acting, on any information contained in this e-mail is
excluded. The views expressed may not be official company policy, but
instead, the personal views of the originator. If you have received this
e-mail in error please notify the sender and delete the e-mail.


-----Original Message-----
From: jslive@gmail.com [mailto:jslive@gmail.com] On Behalf Of Joshua Slive
Sent: 02 June 2008 17:28
To: users@httpd.apache.org
Subject: Re: [users@httpd] AddOutputFilterByType

On Mon, Jun 2, 2008 at 11:50 AM, Ben Davies <be...@stickyeyes.com> wrote:
> Sorry, I should have been more explicit:
>
> How would you implement AddOutputFilterByType for filters created with
> ExtFilterDefine?
>
> Example:
>
> I have a flac file. I have a custom filter that converts flac files to mp3
> files. If the request contains the header Accept: audio/mp3, how can I
> ensure that my custom filter will run?
>
> I had a look at the directives for mod_filter and the closest match
appears
> to be FilterProvider, but the second argument requires that I specify a
> regular filter.

mod_ext_filter does create "regular" filters that should be usable in
a FilterProvider directive. (Although I have never tried it myself.)

Alternatively, mod_ext_filter has its own set of triggers. For
example, the AddOutputFilterByType directive can be easily replaced by
specifying an intype= argument for your ExtFilterDefine directive. If
you really want to match off the Accept request header (rather than
imitating AddOutputFilterByType as you initially requested), you can
do something like

SetEnvIf Accept audio/mp3 accept-mp3
ExtFilterDefine ... enableenv=accept-mp3

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] AddOutputFilterByType

Posted by Joshua Slive <jo...@slive.ca>.
On Mon, Jun 2, 2008 at 11:50 AM, Ben Davies <be...@stickyeyes.com> wrote:
> Sorry, I should have been more explicit:
>
> How would you implement AddOutputFilterByType for filters created with
> ExtFilterDefine?
>
> Example:
>
> I have a flac file. I have a custom filter that converts flac files to mp3
> files. If the request contains the header Accept: audio/mp3, how can I
> ensure that my custom filter will run?
>
> I had a look at the directives for mod_filter and the closest match appears
> to be FilterProvider, but the second argument requires that I specify a
> regular filter.

mod_ext_filter does create "regular" filters that should be usable in
a FilterProvider directive. (Although I have never tried it myself.)

Alternatively, mod_ext_filter has its own set of triggers. For
example, the AddOutputFilterByType directive can be easily replaced by
specifying an intype= argument for your ExtFilterDefine directive. If
you really want to match off the Accept request header (rather than
imitating AddOutputFilterByType as you initially requested), you can
do something like

SetEnvIf Accept audio/mp3 accept-mp3
ExtFilterDefine ... enableenv=accept-mp3

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] AddOutputFilterByType

Posted by Ben Davies <be...@stickyeyes.com>.
Sorry, I should have been more explicit: 

How would you implement AddOutputFilterByType for filters created with
ExtFilterDefine? 

Example:

I have a flac file. I have a custom filter that converts flac files to mp3
files. If the request contains the header Accept: audio/mp3, how can I
ensure that my custom filter will run?

I had a look at the directives for mod_filter and the closest match appears
to be FilterProvider, but the second argument requires that I specify a
regular filter.

Cheers!

Ben


Ben Davies | Lead Developer | Stickyeyes
6th Floor, 
West One, 
Wellington Street, 
Leeds, LS1 1BA 
Email: ben.davies@stickyeyes.com
0113 391 2929 | Fax 0113 391 2939

This e-mail may contain information that is privileged, confidential or
otherwise protected from disclosure. It must not be used by, or its contents
copied or disclosed to persons other than the intended recipient. Any
liability (in negligence or otherwise) arising from any third party acting,
or refraining from acting, on any information contained in this e-mail is
excluded. The views expressed may not be official company policy, but
instead, the personal views of the originator. If you have received this
e-mail in error please notify the sender and delete the e-mail.


-----Original Message-----
From: jslive@gmail.com [mailto:jslive@gmail.com] On Behalf Of Joshua Slive
Sent: 02 June 2008 15:42
To: users@httpd.apache.org
Subject: Re: [users@httpd] AddOutputFilterByType

On Mon, Jun 2, 2008 at 10:31 AM, Ben Davies <be...@stickyeyes.com> wrote:
> Hi Everybody!
>
>
>
> I've noticed that the directive AddOutputFilterByType has been deprecated
in
> Apache 2.1 and later. Does anyone have a suggestion (or a link) on how one
> would be able to configure Apache to accomplish the same task without
using
> AddOutputFilterByType on Apache2.2?

See mod_filter.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] AddOutputFilterByType

Posted by Joshua Slive <jo...@slive.ca>.
On Mon, Jun 2, 2008 at 10:31 AM, Ben Davies <be...@stickyeyes.com> wrote:
> Hi Everybody!
>
>
>
> I've noticed that the directive AddOutputFilterByType has been deprecated in
> Apache 2.1 and later. Does anyone have a suggestion (or a link) on how one
> would be able to configure Apache to accomplish the same task without using
> AddOutputFilterByType on Apache2.2?

See mod_filter.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org