Wapp

Check-in [6cd6484c92]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix filename dequoting in multipart/form-data interpretation. Add two test files for multipart/form-data testing.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:6cd6484c9257cc7b9730d57a1338360280233471e421a29ce21bacff39610531
User & Date: drh 2018-02-06 17:58:08
Context
2018-02-07
01:37
New and improved documentation. check-in: ea88c28347 user: drh tags: trunk
2018-02-06
17:58
Fix filename dequoting in multipart/form-data interpretation. Add two test files for multipart/form-data testing. check-in: 6cd6484c92 user: drh tags: trunk
16:54
Adjust the regexp commands used to parse multipart/form-data to improved performance with very large upload files. check-in: 4cc53a980a user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added tests/drh4.jpg.

cannot compute difference between binary files

Added tests/one"two'three.txt.





>
>
1
2
This file exists to test wapp's handling of files with
unusual filenames.

Changes to wapp.tcl.

538
539
540
541
542
543
544
545

546
547
548
549
550
551
552
        set idx [string first $divider $body]
        set unit [string range $body 0 [expr {$idx-3}]]
        set body [string range $body [expr {$idx+$ndiv+2}] end]
        if {[regexp {^Content-Disposition: form-data; (.*?)\r\n\r\n(.*)$} \
             $unit unit hdr content] &&
            [regexp {name="(.*)"; filename="(.*)"\r\nContent-Type: (.*?)$}\
              $hdr hr name filename mimetype]} {
          dict set wapp $name.filename $filename

          dict set wapp $name.mimetype $mimetype
          dict set wapp $name.content $content
        }
      }
    }
  }
}







|
>







538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
        set idx [string first $divider $body]
        set unit [string range $body 0 [expr {$idx-3}]]
        set body [string range $body [expr {$idx+$ndiv+2}] end]
        if {[regexp {^Content-Disposition: form-data; (.*?)\r\n\r\n(.*)$} \
             $unit unit hdr content] &&
            [regexp {name="(.*)"; filename="(.*)"\r\nContent-Type: (.*?)$}\
              $hdr hr name filename mimetype]} {
          dict set wapp $name.filename \
            [string map [list \\\" \" \\\\ \\] $filename]
          dict set wapp $name.mimetype $mimetype
          dict set wapp $name.content $content
        }
      }
    }
  }
}