HTTP Sever Exported Functions
E-12
E.4.3
HTTP Server Exported API Functions
Send the Status of this Request to the Client
httpSendStatusLine
Syntax
void httpSendStatusLine( int Sock, int StatusCode, char *ContentType );
Parameter(s)
Sock
Socket on which to send
StatusCode
HTTP status code of the request
ContentType
HTTP type string of the response
Return Value
nothing
Description
Sends a formatted response message to Sock with the given status code and
content type. The value of ContentType can be NULL if no ContentType is re-
quired.
The status code and content type should match HTTP standard definitions.
Some content type strings are listed in E.4.1. The pre-defined status codes in-
clude:
HTTP_OK
(200)
HTTP_NO_CONTENT (204)
HTTP_NOT_FOUND
(404)
HTTP_NOT_IMPLEMENTED
(501)
Send NULL Terminated String Data to Client
httpSendClientStr
Syntax
void httpSendClientStr( int Sock, char *Response );
Parameter(s)
Sock
Socket on which to send
Response
Pointer to NULL terminated string
Return Value
nothing
Description
This function sends the indicated NULL terminated response string to the indi-
cated client socket. In other words, it calls strlen() and send()
Send a Full Formatted Response to the Client
httpSendFullResponse
Syntax
void httpSendFullResponse( int Sock, int StatusCode, char *RequestedFile );
Parameter(s)
Sock
Socket on which to send
StatusCode
HTTP status code of the request
RequestedFile Pointer to filename of file to include in body
Return Value
nothing
Description
Sends a full formatted response message to Sock, including the file indicated
by the filename pointed to by RequestedFile. The status code for this call is
usually HTTP_OK, but can also be HTTP_NOT_FOUND when sending the file
“404.HTM”.