[ Previous ] [ Contents ] [ Index ] [ Next ]

ns_return

Overview

Return information to client

Syntax

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

Description

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:

1xx

Informational - Not used, but reserved for future use.

2xx

Success - The action was successfully received, understood, and accepted.

3xx

Redirection - Further action must be taken in order to complete the request.

4xx

Client Error - The request contains bad syntax or cannot be fulfilled.

5xx

Server Error - The server failed to fulfill an apparently valid request.

Some common status values and their meanings are:

200

OK

403

Forbidden

201

Created

404

Not Found

202

Accepted

405

Method Not Allowed

203

Provisional Information

406

None Acceptable

204

No Content

407

Proxy Authentication Required

300

Multiple Choices

408

Request Time-out

301

Moved Permanently

409

Conflict

302

Moved Temporarily

410

Gone

303

Method

500

Internal Server Error

304

Not Modified

501

Not Implemented

400

Bad Request

502

Bad Gateway

401

Unauthorized

503

Service Unavailable

402

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.

See Also

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)

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1996 America Online, Inc.