I am developing a url sniffer and i wanted to filter results as i wanted to grab only media files by checking their mime types. I am searching over google for two days now but can't find any correct solution.
Asked
Active
Viewed 425 times
0
-
What exactly do you mean by "url sniffer"? – Heinzi Apr 09 '11 at 15:05
-
2You can check the `Content-Type` header of the fetch to check the result, or you specify `Accept: mime/type` in your request to filter. – Brad Christie Apr 09 '11 at 15:05
-
Have you tried anything? Post your existing code. – Devendra D. Chavan Apr 09 '11 at 15:05
-
I'm not 100% sure that you know what it is you are trying to do. The mime-type is transferred as a header in the response. It is determined by IIS or Apache at the time that the file is requested by a client. Are you trying to act as the client or the server in this case? – riwalk Apr 09 '11 at 15:06
-
I have tried this code by converting it to C# (See Tim Schmelter's Answer)http://stackoverflow.com/questions/4465121/unable-to-get-the-correct-mime-type-of-flv-file but it only returns "application/octet-stream" – m.qayyum Apr 09 '11 at 15:15
1 Answers
1
IIS just looks at the file extension of a file, and looks it up in an internal database (you can Create/Read/Update/Delete entries).
This isn't 100% accurate (extension doesn't have to match the content), but going a step further would be overkill.

NKCSS
- 2,716
- 1
- 22
- 38