Dne Sat, 27 Feb 2010 21:54:04 +0100 Wily Dev <wily...@optonline.net> napsal/-a:
> "Is there an easy and safe way to detect whether the content is in > plain format, or gzip'ed?" > > Yes. The servers' "Content-Encoding" response headers will tell you if > it's gzipped, or otherwise compressed/encoded. Rather a basic question > to ask, when nearly every discussion of such compression describes those > mechanisms, no? > > See: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html I'm afraid is is not so simple: RFC 2616 defines, how an encoding SHOULD BE indicated, but it does not mean that you could rely on this piece of information... The key question is, what kind of data it is and who serves those data for you (I met a web mail application, where some PHP sprayer has returned binary content as TEXT/HTML). AFAIK, there is no easy and safe way how to detect it: for inspiration see e.g. into Apache's configuration folder for magic and mime.types files to see how Apache tries to guess MIME type and encoding of files. IMHO a *reliable* way to detect gziped content is - to check identification and CRC of content whether it follows RFC 1952 - to try to decompress the content pf ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ synalist-public mailing list synalist-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/synalist-public