asio 0.3.8rc3 Home | Reference | Tutorial | Examples | Design
Examples

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

struct
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 31 of file mime_types.cpp.

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

00032 {
00033   for (mapping* m = mappings; m->extension; ++m)
00034   {
00035     if (m->extension == extension)
00036     {
00037       return m->mime_type;
00038     }
00039   }
00040 
00041   return "text/plain";
00042 }


Variable Documentation

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

Referenced by extension_to_type().

asio 0.3.8rc3 Home | Reference | Tutorial | Examples | Design