Index: openacs-4/packages/xowiki/tcl/xowiki-utility-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-utility-procs.tcl,v diff -u -N -r1.37.2.4 -r1.37.2.5 --- openacs-4/packages/xowiki/tcl/xowiki-utility-procs.tcl 11 Feb 2016 10:06:38 -0000 1.37.2.4 +++ openacs-4/packages/xowiki/tcl/xowiki-utility-procs.tcl 28 Feb 2016 10:41:35 -0000 1.37.2.5 @@ -392,10 +392,38 @@ } proc write_file {fn content} { set F [::open $fn w] - ::fconfigure $F -translation binary + ::fconfigure $F -translation binary -encoding binary ::puts -nonewline $F $content ::close $F } + + nsf::proc ::xowiki::get_raw_request_body {-as_string:switch -as_file:switch} { + if {$as_string eq $as_file} { + error "either -as_string or -as_file must be specified" + } + set contentfile [ns_conn contentfile] + if {$as_file} { + # + # If the file was not spooled, obtained it via [ns_conn content] + # as write it to a file. + # + if {$contentfile eq ""} { + set contentfile [ad_tmpnam] + write_file $contentfile [ns_conn content -binary] + } + set result $contentfile + } else { + # + # Return the result as a string + # + if {$contentfile eq ""} { + set result [ns_conn content -binary] + } else { + set result [read_file $contentfile] + } + } + return $result + } proc ::xowiki::page_order_uses_ltree {} { if {[::xo::dc has_ltree]} {