After this, I've been trying to get POST requests to work.
I needed to change the revproxy code a little since, for me, the backend
would wait forever for the POST body unless I explicitly sent it after
opening the backend channel.

This will now work fine for POSTs with a body of ~32,768 bytes and under.
But anything more than that, again, the backend will again wait forever for
some input from the front end with:

[23/Feb/2017:17:20:22][19157.7fa9c17fa700][-driver:nsssl:0-]
Debug(ns:driver): SockRead wait for more input

It seems notable that the backend receives data in 16384 byte chunks and
this starts failing when the content is around 2x 16384

Should "ns_connchann write" be happy sending data of this size in a single
request or am I abusing it?

[23/Feb/2017:17:29:17][19157.7fa9c17fa700][-driver:nsssl:0-]
Debug(ns:driver): SockRead: require tmp file for content spooling (length
101332 > readahead 16384)
[23/Feb/2017:17:29:17][19157.7fa9c17fa700][-driver:nsssl:0-]
Debug(ns:driver): SockRead receive from network 16384 bytes
[23/Feb/2017:17:29:17][19157.7fa9c17fa700][-driver:nsssl:0-]
Debug(ns:driver): SockRead wait for more input
[23/Feb/2017:17:29:17][19157.7fa9c17fa700][-driver:nsssl:0-]
Debug(ns:driver): === PollWait returned 1, trigger[0] 0
[23/Feb/2017:17:29:17][19157.7fa9c17fa700][-driver:nsssl:0-]
Debug(ns:driver): SockRead receive from network 16384 bytes
[23/Feb/2017:17:29:17][19157.7fa9c17fa700][-driver:nsssl:0-]
Debug(ns:driver): SockRead wait for more input



--- a/revproxy-procs.tcl Tue Nov 01 16:27:48 2016 +0100
+++ b/revproxy-procs.tcl Thu Feb 23 17:07:59 2017 +0000
@@ -62,6 +62,8 @@
     {*}$validation_callback -url $url
  }

+        set content [ns_getcontent -binary true -as_file false]
+
  if {[catch {
     #
     # Open backend channel, get frontend channel and connect these.
@@ -73,7 +75,13 @@
   $url]
     set frontendChan [ns_connchan detach]
     log notice "back $backendChan front $frontendChan method [ns_conn
method] version 1.0 $url"
-
+
+            # POST requests
+            if { [string length $content] > 0 } {
+                # We have a body, send it to the backend
+                ns_connchan write $backendChan $content
+            }
+
     ns_connchan callback $backendChan  [list ::revproxy::backendReply
$backendChan $frontendChan $url 0] rex
     ns_connchan callback $frontendChan [list ::revproxy::spool
$frontendChan $backendChan client 0] rex


On 23 February 2017 at 11:54, Gustaf Neumann <neum...@wu.ac.at> wrote:

> good news! yes, sure, the change is right. merged already. -gn
>
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to