Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix for [063e7a95beef451c], Correct Handling of quotes in quoted strings in parseMimeValue |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | pooryorick |
Files: | files | file ages | folders |
SHA3-256: |
e4a17a66b17a2bbe7558070e73dfb414 |
User & Date: | pooryorick 2018-08-15 04:34:51.320 |
References
2018-08-15
| ||
04:36 | • Ticket [063e7a95be] Correct Handling of quotes in quoted strings in parseMimeValue status still Open with 4 other changes artifact: 5a1aeabbab user: pooryorick | |
Context
2021-04-30
| ||
21:01 | ncgi, merge fix for [063e7a95beef451c], Correct Handling of quotes in quoted strings in parseMimeValue. check-in: 74c178b772 user: pooryorick tags: trunk | |
2018-08-15
| ||
05:23 | code cleanup check-in: 6b167d6d17 user: pooryorick tags: pooryorick | |
04:34 | Fix for [063e7a95beef451c], Correct Handling of quotes in quoted strings in parseMimeValue check-in: e4a17a66b1 user: pooryorick tags: pooryorick | |
2018-08-14
| ||
19:39 | convert mime.test to utf-8 check-in: 6c21e9dfe4 user: pooryorick tags: pooryorick | |
Changes
Changes to modules/ncgi/ncgi.tcl.
︙ | ︙ | |||
811 812 813 814 815 816 817 | # # Results: # A two-element list, the first is the primary value, # the second is in turn a name-value list corresponding to the # parameters. Given the above example, the return value is # { # value | | | < | > | < | 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | # # Results: # A two-element list, the first is the primary value, # the second is in turn a name-value list corresponding to the # parameters. Given the above example, the return value is # { # value # {param value param2 value2 param3 value3} # } proc ::ncgi::parseMimeValue {value} { set parts [split $value \;] set results [list [string trim [lindex $parts 0]]] set paramList [list] foreach sub [lrange $parts 1 end] { if {[regexp -- {([^=]+)=(.+)} $sub match key val]} { set key [string trim [string tolower $key]] set val [string trim $val] # Allow single as well as double quotes if {[regexp -- {^(['"])(.*)\1} $val x quote val2]} { ; # need a " for balance # Trim quotes and any extra crap after close quote # remove quoted quotation marks set val [string map {\\" "\"" \\' "\'"} $val2] } lappend paramList $key $val } } if {[llength $paramList]} { lappend results $paramList } |
︙ | ︙ |
Changes to modules/ncgi/ncgi.test.
︙ | ︙ | |||
573 574 575 576 577 578 579 580 581 582 583 584 585 586 | test ncgi-13.5 {ncgi::parseMimeValue} { ncgi::parseMimeValue "text/html; charset=\"iso-8859-1\"; ignored" } {text/html {charset iso-8859-1}} test ncgi-13.6 {ncgi::parseMimeValue} { ncgi::parseMimeValue "text/html; charset=\"iso-8859-1\"morecrap" } {text/html {charset iso-8859-1}} test ncgi-14.1 {ncgi::multipart} { catch {ncgi::multipart "application/x-www-urlencoded" name=val+ue} err set err } {Not a multipart Content-Type: application/x-www-urlencoded} | > > > > > > > > | 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 | test ncgi-13.5 {ncgi::parseMimeValue} { ncgi::parseMimeValue "text/html; charset=\"iso-8859-1\"; ignored" } {text/html {charset iso-8859-1}} test ncgi-13.6 {ncgi::parseMimeValue} { ncgi::parseMimeValue "text/html; charset=\"iso-8859-1\"morecrap" } {text/html {charset iso-8859-1}} test ncgi-13.7 {ncgi::parseMimeValue} { ncgi::parseMimeValue {test/test; foo="bar\"baz\""} } {test/test {foo bar\"baz\"}} test ncgi-13.8 {ncgi::parseMimeValue} { ncgi::parseMimeValue {test/test; foo=""} } {test/test {foo {}}} test ncgi-14.1 {ncgi::multipart} { catch {ncgi::multipart "application/x-www-urlencoded" name=val+ue} err set err } {Not a multipart Content-Type: application/x-www-urlencoded} |
︙ | ︙ |