title: How to get the content-type of a file
body: <p>I am implementing a HTTP/1.0 server that processes <code>GET</code> or <code>HEAD</code> request.</p>
  
  <p>I've finished <code>Date</code>, <code>Last-Modified</code>, and <code>Content-Length</code>, but I don't know how to get the <code>Content-Type</code> of a file.</p>
  
  <p>It has to return directory for directory(which I can do using <code>stat()</code> function), and for a regular file, <code>text/html</code> for <code>text</code> or <code>html</code> file, and <code>image/gif</code> for image or <code>gif</code> file.</p>
  
  <p>Should this be hard-coded, using the name of the file?</p>
  
  <p>I wonder if there is any function to get this <code>Content-Type</code>.</p>