How to read large amounts of CGI data via POST in Rebol3?

I am trying to upload an image using POST. Then on the server, to get the POST data, I use:

data: read system/ports/input

      

... but it seems that the data is being truncated.

There seems to be no defined boundary where the data is truncated. I upload images in the range of 15,000 kB and the resulting data is a few hundred to several tens of kilobytes in length, so there is no artificial boundary like 32,000 bytes.

Does anyone have any experience with getting data from POST?

+3


source to share


2 answers


The read action system/ports/input

does not work at a low level, like a stream. Continuous reads return partial data until the end of the input is reached. The problem is that it system/ports/input

will return an error at the end of the input instead of none! or an empty string.

The following code works for reading large POST input:



image: make binary! 200'000
while [
    not error? try [data: read system/ports/input]
][
        append image data
]

      

+4


source


with r3-64-view-2014-02-14-1926d8.exe I used

while [
    all [
       not error? try [data: read system/ports/input]
       0 < probe length? data
    ]
][
    append image data
]
print length? image

      

And did



D:\own\Rebol>r3-64-view-2014-02-14-1926d8.exe read-img.r < r3-64-view-2014-02-14-1926d8.exe > err.txt

      

and received

.
.
16384
16384
16384
2048
0
1181696

      

+1


source







All Articles