From: <[EMAIL PROTECTED]>
> I'm trying to incorporate my 'decode-multipart/form-data function into the
> commonly used 'retrieve-user-data function, but I am getting something
> wrong. The function works now for GET operations but not for POST.
>
> If I use 'read-io on system/ports/input, that clears the port, correct?
<snip>

Hi, Ryan,

On May 2nd on a different thread ("read bug?"), Holger said (excerpt):
  <excerpt>
  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] []
  </excerpt>

I've not had a chance to play with this approach.  Maybe it will help.
--Scott Jones

> Then...
>
> return make object! decode-cgi input
>
> ...will no longer work. But if I replace that line with...
>
> return make object! decode-cgi post-data
>
> ...thus using the data I have already retrieved, (using 'post-data in my
> function below instead of 'input) the function does not work.
>
> Why?
>
> 'decode-cgi requres an argument of 'any-string! and should be able to
> handle my 'post-data argument, shouldn't it?
>
> Here is the version of 'retrieve-user-data I am trying to use...
>
> retrieve-user-data: func [][
>     either system/options/cgi/request-method = "POST" [
>         content-length: 20 + load system/options/cgi/content-length
>         post-data: make string! content-length
>         read-io system/ports/input post-data content-length
>         parse/all post-data [thru "Content-Disposition: " copy text to ";"
> (post-type: copy text)]
>         switch/default post-type [
>             "form-data" [
>                 decode-multipart/form-data
>             ]
>         return make object! decode-cgi input
>         ]
>     ][
>         return make object! decode-cgi system/options/cgi/query-string
>     ]
> ]
>
> Ryan C. Christiansen
> Web Developer
>
> Intellisol International
> 4733 Amber Valley Parkway
> Fargo, ND 58104
> 701-235-3390 ext. 6671
> FAX: 701-235-9940
> http://www.intellisol.com
>
> Global Leader in People Performance Software
>
> _____________________________________
>
> Confidentiality Notice
> This message may contain privileged and confidential information. If you
> think, for any reason, that this message may have been addressed to you in
> error, you must not disseminate, copy or take any action in reliance on
it,
> and we would ask you to notify us immediately by return email to
> [EMAIL PROTECTED]
>
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.
>

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to