diff options
author | dkf <dkf@noemail.net> | 2009-09-10 21:20:00 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2009-09-10 21:20:00 (GMT) |
commit | 9cf8b91b7cdd08573a236c5afb9665c7c8e9a6e2 (patch) | |
tree | ebe61937ea738384d242238013689df1a19bac65 /library | |
parent | caf5cb301f06ed9ba124e785e6f11348451bddfb (diff) | |
download | tcl-9cf8b91b7cdd08573a236c5afb9665c7c8e9a6e2.zip tcl-9cf8b91b7cdd08573a236c5afb9665c7c8e9a6e2.tar.gz tcl-9cf8b91b7cdd08573a236c5afb9665c7c8e9a6e2.tar.bz2 |
Correct handling of quoted charset names. [Bug 2849860]
FossilOrigin-Name: 5acb804b5c480cf7a10796c4e5cfe5aa643516d6
Diffstat (limited to 'library')
-rw-r--r-- | library/http/http.tcl | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/library/http/http.tcl b/library/http/http.tcl index 654d8b0..18487fb 100644 --- a/library/http/http.tcl +++ b/library/http/http.tcl @@ -8,7 +8,7 @@ # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: http.tcl,v 1.76 2009/04/19 18:27:59 patthoyts Exp $ +# RCS: @(#) $Id: http.tcl,v 1.77 2009/09/10 21:20:01 dkf Exp $ package require Tcl 8.6 # Keep this in sync with pkgIndex.tcl and with the install directories in @@ -1030,8 +1030,14 @@ proc http::Event {sock token} { content-type { set state(type) [string trim [string tolower $value]] # grab the optional charset information - regexp -nocase {charset\s*=\s*(\S+?);?} \ - $state(type) -> state(charset) + if {[regexp -nocase \ + {charset\s*=\s*\"((?:[^""]|\\\")*)\"} \ + $state(type) -> cs]} { + set state(charset) [string map {{\"} \"} $cs] + } else { + regexp -nocase {charset\s*=\s*(\S+?);?} \ + $state(type) -> state(charset) + } } content-length { set state(totalsize) [string trim $value] |