| Home | Libraries | People | FAQ | More

# http::server::mime_types Namespace Reference

## Classes

struct | mapping

## Functions

std::string | extension_to_type (const std::string &extension)
| Convert a file extension into a MIME type.

## Variables

http::server::mime_types::mapping | mappings []

## Function Documentation

std::string http::server::mime_types::extension_to_type | ( | const std::string & | extension | ) |

Convert a file extension into a MIME type.

Definition at line 21 of file mime_types.cpp.

Referenced by http::server::request_handler::handle_request().

    00022 {
    00023   for (mapping* m = mappings; m->extension; ++m)
    00024   {
    00025     if (m->extension == extension)
    00026     {
    00027       return m->mime_type;
    00028     }
    00029   }
    00030
    00031   return "text/plain";
    00032 }

## Variable Documentation

struct http::server::mime_types::mapping http::server::mime_types::mappings[]

Referenced by extension_to_type().

| Copyright © 2003 - 2006 Christopher M. Kohlhoff