lör 2012-04-14 klockan 19:11 -0600 skrev Alex Rousskov:

> Sure, I am just trying to find a way to improve compatibility of ICAP
> agents, even though the ICAP protocol itself is using wrong concepts
> when defining what was meant as a pretty useful feature.

I'd propose the following algorithm:

1. Look up content-type in the mime table and deduce file extension from
there unless the content-type is application/octet-stream. Limited to
mime table expressions on the form \.ext$ where ext do not contain any
special regex patterns.

2. For application/octet-stream or when the file extension is otherwise
uncertain, identify the filename and derive file extension from there,
in priority order

 a) Content-Disposition filename parameter

 b) URL-path

 c) Last part of query parameters

With some handwaving and juggling to determine priority of b & c...

Regards
Henrik

Reply via email to