ns_return status type string
ns_returnadminnotice status msg ?longmsg?
ns_returnbadrequest reason
ns_returnerror status msg
ns_returnfile status type filename
ns_returnforbidden
ns_returnfp status type fileId len
ns_returnnotfound
ns_returnnotice status msg ?longmsg?
ns_returnredirect location
ns_returnunauthorized
These procedures provide a simple interface for returning information to the client. They build HTTP/1.0 headers and send the appropriate data out the socket.
type should be a MIME type (see ns_guesstype manual page for a list).
status is a three-digit number fitting the pattern below:
Informational - Not used, but reserved for future use.
Success - The action was successfully received, understood, and accepted.
Redirection - Further action must be taken in order to complete the request.
Client Error - The request contains bad syntax or cannot be fulfilled.
Server Error - The server failed to fulfill an apparently valid request.
Some common status values and their meanings are:
OK
403
Forbidden
Created
404
Not Found
Accepted
405
Method Not Allowed
Provisional Information
406
None Acceptable
No Content
407
Proxy Authentication Required
Multiple Choices
408
Request Time-out
Moved Permanently
409
Conflict
Moved Temporarily
410
Gone
Method
500
Internal Server Error
Not Modified
501
Not Implemented
Bad Request
502
Bad Gateway
Unauthorized
503
Service Unavailable
Payment Required
504
Gateway Time-out
ns_return sends back both the headers and the string.
ns_returnadminnotice performs the same function as ns_returnnotice, except that it appends a line with a link to "mailto:serveradministrator" based on the virtual server parameter "WebMaster".
ns_returnbadrequest returns a 400 status code and a formatted HTML message containing the reason text.
ns_returnerror wraps the text msg in some html and returns that to the client.
ns_returnfile sends back the headers and the contents of the file.
ns_returnforbidden returns a 403 status code.
ns_returnfp first sends the appropriate headers. Next, it writes out the contents of file from the current file position until the end of the file.
ns_returnnotfound returns a 404 status code.
ns_returnnotice wraps the text msg and longmsg in some html and returns that to the client.
ns_returnredirect returns a redirect to the passed in location.
ns_returnunauthorized returns a 401 status code.
ns_conn outputheaders, ns_write (Tcl API)
Ns_ReturnHtml(), Ns_ReturnFile(), Ns_ReturnOpenFile(), Ns_ReturnError(), Ns_DbReturnError(), Ns_ReturnStatus(), Ns_ReturnNotice(), Ns_ReturnOk(), Ns_ReturnNoResponse(), Ns_ReturnRedirect(), Ns_ReturnNotModified(), Ns_ReturnBadRequest(), Ns_ReturnUnauthorized(), Ns_ReturnForbidden(), Ns_ReturnNotFound(), Ns_ReturnNotImplemented() (C API)