NaviServer - programmable web server
4.99  5.0

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

ns_parseheader(n) 4.99.30 naviserver "NaviServer Built-in Commands"

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? set headerline ?disposition?

The headerline specifies a line containing HTTP header fields, where the field name is parased 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.

Optional argument disposition can be one of the following

  • toupper - convert header names to uppercase

  • tolower - convert header names to lowercase

  • preserve - preserve the existing case

When no disposition is provided, it defaults to tolower

EXAMPLES

 set reply [ns_set create reply]
 ns_parseheader $reply "Connection: Upgrade"
 
 #
 # Return the content of the ns_set in form of a dict
 #
 ns_set array $reply
 % connection Upgrade

See Also

ns_parsefieldvalue, ns_parseurl, nsd

Keywords

NaviServer, global built-in, parse