websUrlType | GoAhead WebServer API | GoAhead EMF |
Return the MIME type for a given URL.
#include "webs.h" char_t *websUrlType(char_t *url, char_t *buf, int bufsize);
url | Source URL to parse |
buf | User supplied buffer to hold the mime type |
bufsize | Size of buf |
The websUrlType procedure returns the mime type for a given URL by examining the URL document name extension. If the mime type is unknown, "text/plain" will be returned.
If you are using the GoAhead WebServer, the mime types are defined in mime.c. If you are using the GoAhead EMF, they are automatically defined for you.
Returns a pointer to the user supplied buffer in buf .
char_t mimeType[80]; websUrlType(url, mimeType, sizeof(mimeType)); if (strcmp(mimeType, "text/plain") == 0) { }