Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

HTTP Post hits 4K limit?

 [1/3] from: amicom:sonic at: 22-Oct-2001 8:07


Using both the http-post.r script available on www.rebol.com and also using read/custom url [post {post-string}], REBOL stops after sending 4096 bytes of the posted data and eventually times out. The exact same script works for data less than 4096. Has anybody else noticed this? Any workarounds? Thanks! -Bo

 [2/3] from: gchiu:compkarori at: 23-Oct-2001 8:12


> Has anybody else noticed this? Any workarounds? >
Hi Bo, This is a FAQ :) The 20 in the code is probabaly redundant. ================================================ About the other problem, i.e. getting data from a POST request within a REBOL CGI script: keep in mind that read-io is a very-low-level read request that returns as soon as the OS returns something. The amount of data returned is not necessarily what was requested. It can be less. This is not a bug, it is by design. If you see a limit of around 4096 bytes then this is caused by how the OS clusters its data. What you need to do in a CGI script is loop until read-io returns 0, e.g. cgi-str: make string! 100000 while [0 < read-io system/ports/input cgi-str 100000] [] -- Holger Kruse ; # working code if system/options/cgi/request-method = "POST" [ len_post: ( 20 + load system/options/cgi/content-length ) post: make string! len_post while [0 < read-io system/ports/input post len_post ] [] do decode-cgi post ] -- Graham Chiu

 [3/3] from: petr::krenzelok::trz::cz at: 22-Oct-2001 20:50


Hi Bo, I've got just the same behavior some time ago. I will have to check my solution at my work, but I think it had something to do with buffer. If you use read-io, write-io, don't forget to use 'clear on your buffer, or something like that ... -pekr-