Difference between revisions of "Ns respond"

From AOLserver Wiki
Jump to navigation Jump to search
(wiki-formatted the page)
Line 1: Line 1:
ns_respond
+
'''NAME'''
Overview
+
: ns_respond - Build a complete response
  
Build a complete response
+
'''SYNOPSIS'''
Syntax
+
: '''ns_respond''' ''?-status status? ?-type type? {?-string string? | ?-file file? | ?-fileid fileid? } ?-length length? ?-headers setId?''
  
ns_respond ?-status status? ?-type type?
+
'''DESCRIPTION'''
  
{?-string string? | ?-file file? | ?-fileid fileid? }
+
: ns_respond builds a complete response for the client with all of the specified information in the header.
  
?-length length? ?-headers setId?
+
'''EXAMPLE'''
Description
 
  
ns_respond builds a complete response for the client with all of the specified information in the header.
+
: Using ns_respond, it's easy to do an HTTP redirect:
Example
 
  
Using ns_respond, it's easy to do an HTTP redirect:
+
set headers [ns_set new myheaders]
 
+
ns_set put $headers location <nowiki>http://www.aolserver.com</nowiki>
    set headers [ns_set new myheaders]
+
ns_respond -status 302 -type text/plain \
    ns_set put $headers location http://www.aolserver.com
+
-string "redirection" -headers $headers
    ns_respond -status 302 -type text/plain \
 
    -string "redirection" -headers $headers
 

Revision as of 12:22, 6 May 2009

NAME

ns_respond - Build a complete response

SYNOPSIS

ns_respond ?-status status? ?-type type? {?-string string? | ?-file file? | ?-fileid fileid? } ?-length length? ?-headers setId?

DESCRIPTION

ns_respond builds a complete response for the client with all of the specified information in the header.

EXAMPLE

Using ns_respond, it's easy to do an HTTP redirect:
set headers [ns_set new myheaders]
ns_set put $headers location http://www.aolserver.com
ns_respond -status 302 -type text/plain \
	-string "redirection" -headers $headers