websUrlType GoAhead WebServer API GoAhead EMF

Synopsis

Return the MIME type for a given URL.

Prototype

 #include "webs.h" 

 char_t *websUrlType(char_t *url, char_t *buf, int bufsize); 

Parameters

url Source URL to parse.
buf User supplied buffer to hold the mime type.
bufsize Size of buf.

Description

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.

When using the GoAhead WebServer, the mime types are defined in mime.c. When using the GoAhead EMF, they are automatically defined.

Return Value

Returns a pointer to the user supplied buffer in buf .

Example

 
char_t mimeType[80]; 
websUrlType(url, mimeType, sizeof(mimeType)); 
if (strcmp(mimeType, "text/plain") == 0) { } 

Stability Classification

Stable.

See Also

websUrlParse