| Ticket UUID: | 756939 | |||
| Title: | No way to get a list of only the known keys | |||
| Type: | Bug | Version: | None | |
| Submitter: | andreas_kupries | Created on: | 2003-06-18 23:51:43 | |
| Subsystem: | ncgi | Assigned To: | andreas_kupries | |
| Priority: | 8 | Severity: | ||
| Status: | Closed | Last Modified: | 2005-10-01 05:23:35 | |
| Resolution: | Accepted | Closed By: | andreas_kupries | |
| Closed on: | 2005-09-30 22:23:35 | |||
| Description: |
The package provides a command to ask if a key is present in the ncgi package, but has no command to return a list of all known keys ... Indirectly possible through 'nvlist' and stripping out the data elements. | |||
| User Comments: |
andreas_kupries added on 2005-10-01 05:23:34:
Logged In: YES
user_id=75003
Added to head, with a small fix. "set names {}" should have
been "array set names {}".
afaupell added on 2003-07-30 16:46:10: Logged In: YES
user_id=812825
try #2, in the same style as ::ncgi::parse. you could also
get the same list by calling parse and then [array names
::ncgi::value]
proc ::ncgi::names {} {
set names {}
foreach {name val} [nvlist] {
if {$name != "anonymous"} {
set names($name) 1
}
}
return [array names names]
}
andreas_kupries added on 2003-07-05 12:36:24: Logged In: YES
user_id=75003
Two notes:
1. 'nvlist' uses
split [string trim $query], and not
split $query. I believe nvlist is more correct.
2. nvlist also uses 'multipart' for the multipart. This
means that for multipar data 'names' delivers names and
values, and not the names alone. This is a bug in the
proposed code.
afaupell added on 2003-07-01 01:59:34: Logged In: YES
user_id=812825
doesnt return the "anonymous" names
proc ::ncgi::names {} {
set query [query]
set type [type]
switch -glob -- $type {
"" -
application/x-www-form-urlencoded -
application/x-www-urlencoded {
set result {}
foreach {x} [split $query &] {
if {[regexp -- (.*)= $x dummy varname]} {
lappend result [decode $varname]
}
}
return $result
}
multipart/* {
return [multipart $type $query]
}
default {
return -code error "Unknown Content-Type: $type"
}
}
}
| |||
Home
Blog
Docs
Downloads
Tickets
Timeline
Branches
Tags
Wiki