2003-06-30 16:44:03 +04:00
|
|
|
/*
|
|
|
|
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
|
|
|
* Licensed under the GNU General Public License,
|
|
|
|
* http://www.opensource.org/licenses/gpl-license
|
|
|
|
* Copyright 2003 James Bursa <bursa@users.sourceforge.net>
|
2003-06-21 17:18:00 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "netsurf/content/fetch.h"
|
|
|
|
#include "netsurf/utils/log.h"
|
|
|
|
#include "netsurf/utils/utils.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* filetype -- determine the MIME type of a local file
|
|
|
|
*/
|
|
|
|
|
|
|
|
const char *fetch_filetype(const char *unix_path)
|
|
|
|
{
|
2003-09-28 03:36:34 +04:00
|
|
|
int l;
|
2003-06-21 17:18:00 +04:00
|
|
|
LOG(("unix path %s", unix_path));
|
2003-09-28 03:36:34 +04:00
|
|
|
l = strlen(unix_path);
|
|
|
|
if (2 < l && strcasecmp(unix_path + l - 3, "css") == 0)
|
2003-06-21 17:18:00 +04:00
|
|
|
return "text/css";
|
2004-03-27 03:54:03 +03:00
|
|
|
if (2 < l && strcasecmp(unix_path + l - 3, "jpg") == 0)
|
|
|
|
return "image/jpeg";
|
|
|
|
if (3 < l && strcasecmp(unix_path + l - 4, "jpeg") == 0)
|
|
|
|
return "image/jpeg";
|
2004-06-03 01:00:10 +04:00
|
|
|
if (2 < l && strcasecmp(unix_path + l - 3, "gif") == 0)
|
|
|
|
return "image/gif";
|
|
|
|
if (2 < l && strcasecmp(unix_path + l - 3, "png") == 0)
|
|
|
|
return "image/png";
|
2003-06-21 17:18:00 +04:00
|
|
|
return "text/html";
|
|
|
|
}
|
|
|
|
|
2004-03-22 03:38:08 +03:00
|
|
|
|
|
|
|
char *fetch_mimetype(const char *ro_path)
|
|
|
|
{
|
|
|
|
return strdup("text/plain");
|
|
|
|
}
|