NaviServer Programmable Web Server

ns_parseheader(n)

NaviServer Built-in Commands – 5.1.0


[ Main Table Of Contents | Table Of Contents | Keyword Index ]

Name

ns_parseheader - Parse HTTP header

Table Of Contents

Synopsis

Description

This function parses a single HTTP header line into a predefined ns_set specified by set.

COMMANDS

ns_parseheader ?-prefix value? set headerline

The headerline specifies a line containing HTTP header fields, where the field name is parsed into a key of the ns_set and the field value to the value of the entry.

The option -prefix can be used to specify a prefix for the key.

EXAMPLES

 set reply [ns_set create -nocase reply]
 ns_parseheader $reply "Connection: Upgrade"
 
 #
 # Output the content of the ns_set in a human friendly way
 #
 ns_set format $reply
 ## output:  reply:
 ## output:    connection: Upgrade

See Also

ns_parsefieldvalue, ns_parsemessage, ns_parseurl, nsd

Keywords

HTTP, NaviServer, global built-in, parse