Problem - 4096 byte limit on POST from browser
[1/6] from: al:bri:xtra at: 3-Jun-2002 16:42
Hi!
I've got a problem with Rebol running as a CGI process. Rebol seems to be
limited to a maximum of 4096 bytes received from a browser's POST request of
a edit text area through the server. I'd like to receive around 30,000 bytes
of text from the edit box.
Has anyone got suggestions I could try to increase this limit?
Am I missing something?
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[2/6] from: rebol665::ifrance::com at: 3-Jun-2002 9:08
Hi Andrew
The 4096 limit may be caused by the encoding method. I suggest you use the multipart/form-data.
I have been able to transfer 500 Ko file without problem with it.
<FORM NAME="formulaire" METHOD="POST" ENCTYPE="multipart/form-data" ACTION="http://localhost/cgi-bin/uploader.r">
Reading such encoding is a little more complex. Here is a piece of code I was working
with some times ago. It is not complete, but it may help you see if data are sent correctly.
I am not able to test it now because of my "I-want-to-start-a-new-life-with Linux" situation.
You will have to change the first line and to create a download directory in your cgi-bin
directory.
8<- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
#! d:/rebview/rebol.exe -cs
REBOL []
print "Content-Type: text/html^/^/"
query-length: to-integer system/options/cgi/content-length
data: make binary! #{}
until [
buffer: make binary! #{}
read-io system/ports/input buffer query-length
append data buffer
((length? data) = query-length )
]
write/binary %./download/upload.bin data
parse-data: func [/talk][
;
; parsing the cgi data
;
; data are separated by a two characters end-of-line (eol)
eol: #{0D0A}
; text-boundary is often augmented with leading "-" characters
separator: to-string copy/part data find data eol
if talk [print [ <PRE> "separator: " separator </PRE>]]
; text-boundary + eol is used as a separator
separator: join separator eol
item: ""
cpt-length: 0
if parse data [
thru separator
some [
copy item
thru separator
(cpt-length: cpt-length + length? item)
(item: copy/part item find item separator)
(print [ <PRE> item </PRE> <BR> cpt-length <BR>])
]
copy item
thru text-boundary
(cpt-length: cpt-length + length? item)
(print [ <PRE> item </PRE> <BR> cpt-length <BR>])
4 skip
(cpt-length: cpt-length + 4)
(print [<BR> cpt-length <BR>])
][ print [ <H2> "data parsing correct !" </H2>]]
;---------------------------7d2334b888
]
; multipart/form-data?
; Content-Type: {multipart/form-data; boundary=---------------------------7d2324888}
parse system/options/cgi/content-type [
copy data-type
to ";"
skip
thru "="
copy text-boundary
to end
]
print [
<HTML>
<BODY>
<H1> "Rebol Uploader" </H1>
<H2> "POST method" </H2>
<PRE> "Content-length : " query-length </PRE>
<PRE> "Length data : " length? data </PRE>
<PRE> "data-type : " data-type </PRE>
<PRE> "text-boundary : " text-boundary " = " length? text-boundary </PRE>
<HR>
]
parse-data/talk
print [
<HR>
<PRE> mold system/options/cgi </PRE>
</BODY>
</HTML>
]
8<- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
HTH
Patrick
[3/6] from: al:bri:xtra at: 3-Jun-2002 17:52
> Hi!
> I've got a problem with Rebol running as a CGI process. Rebol seems to be
limited to a maximum of 4096 bytes received from a browser's POST request of
a edit text area through the server. I'd like to receive around 30,000 bytes
of text from the edit box.
> Has anyone got suggestions I could try to increase this limit?
This method reads all the data:
if none? Query_String: system/options/cgi/query-string [
Post: make string! 2 + Length: to-integer
system/options/cgi/content-length
read-io system/ports/input Post Length
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[4/6] from: gchiu:compkarori at: 3-Jun-2002 20:08
> I've got a problem with Rebol running as a CGI process.
> Rebol seems to be
<<quoted lines omitted: 5>>
> Has anyone got suggestions I could try to increase this
> limit?
Hi Andrew,
Check out a possible answer at vidwiki/cgi-post
sites/compkarori2/vidwiki - and use the index
Cheers,
--
Graham Chiu
[5/6] from: al:bri:xtra at: 3-Jun-2002 20:16
Thanks, Patrick!
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[6/6] from: al:bri:xtra at: 3-Jun-2002 21:57
> Check out a possible answer at vidwiki/cgi-post
>
> sites/compkarori2/vidwiki - and use the index
Thanks, Graham!
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted