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

POST

 [1/12] from: John:Harbaugh:capmetro at: 26-Jun-2003 10:57


I would like to pass CGI that has more than 2000 bytes. I know that the POST works, but I keep getting script samples that do nothing. Can someone send me a form that works, a simple form please. The ones that are posted do not work correctly. John

 [2/12] from: tim:johnsons-web at: 26-Jun-2003 8:38


* Harbaugh, John <[John--Harbaugh--capmetro--org]> [030626 08:19]:
> I would like to pass CGI that has more than 2000 bytes. > > I know that the POST works, but I keep getting script samples that do nothing. > > Can someone send me a form that works, a simple form please. > > The ones that are posted do not work correctly.
Hello John: Perhaps you could do this: Send us : 1)The form that you have used 2)The example script that it POSTs to It is also good to include copies of errors messages or descriptions of any other results. thanks -- Tim Johnson <[tim--johnsons-web--com]> http://www.alaska-internet-solutions.com http://www.johnsons-web.com

 [3/12] from: gchiu:compkarori at: 27-Jun-2003 7:57


On Thu, 26 Jun 2003 10:57:10 -0500 "Harbaugh, John" <[John--Harbaugh--capmetro--org]> wrote:
>Can someone send me a form that works, a simple form >please. > >The ones that are posted do not work correctly.
Hi John, See http://www.rebol.com/docs/cgi2.html#section-4.2 -- Graham Chiu http://www.compkarori.com/vanilla/ Rebol Encyclopaedia Project

 [4/12] from: termin::terminal::sky::pl at: 27-Jun-2003 10:36


> On Thu, 26 Jun 2003 10:57:10 -0500 > "Harbaugh, John" <[John--Harbaugh--capmetro--org]> wrote:
<<quoted lines omitted: 7>>
> -- > Graham Chiu
In fact script in this tutorial doesn't work with - for example - PWS. Use this - which reads exact size of data (sorry - but i don't remember the author). input-cgi: func [/stdin] [ stdin: make string! 15000 either system/options/cgi/request-method = "POST" [ use [Length] [ Query: make string! Length: 2 + to-integer system/options/cgi/content-length read-io system/ports/input Query Length Query ] ][ system/options/cgi/query-string ] ] Aleksander K.

 [5/12] from: John:Harbaugh:capmetro at: 27-Jun-2003 7:54


Tim: Good idea, thanks.. John

 [6/12] from: tim:johnsons-web at: 27-Jun-2003 7:39


* alekk <[termin--terminal--sky--pl]> [030627 01:15]:
> > On Thu, 26 Jun 2003 10:57:10 -0500 > > "Harbaugh, John" <[John--Harbaugh--capmetro--org]> wrote:
<<quoted lines omitted: 26>>
> ] > ]
I haven't used the following on PWS, but I recommend Andreas' approach because of potential buffering of stdin with large amounts of data: ;;====================================================================================================== ;; Courtesy of Andreas Bolka <[andreas--bolka--gmx--net]> ;;====================================================================================================== read-post-data: func [ {Reads the HTTP entity body} /safe "Disables evaluation of content-length header." /local len data tmp ] [ len: load any [ all [ safe "65536" ] system/options/cgi/content-length "0" ] data: make string! len tmp: make string! len while [ 0 < read-io system/ports/input tmp len ] [ insert tail data tmp clear tmp ] data ] ; end: sub ;; The 'while loop checks the return value from read-io to ensure ;; that all data is read. ;; Good work Andreas! ~tj~ -- Tim Johnson <[tim--johnsons-web--com]> http://www.alaska-internet-solutions.com http://www.johnsons-web.com

 [7/12] from: carl:s:rebol at: 27-Jun-2003 15:11


I should clarify that the CGI script examples have only been tested under Apache web servers (running on a variety of systems). A few other notes: 1. GGI CONTENT-LENGTH field is not used because we have found that field is not always supplied or accurate on all web servers (at least that's been our experience - we know one site that modifies web packets and changes their lengths!). 2. We switch on POST and GET to allow a third case: NONE. This is very handy for local debugging (getting your script working before you upload it to the server). For example: cgi-data: any [read-cgi "test=123&"] will return the test string when you run your script locally. -Carl

 [8/12] from: andreas:bolka:gmx at: 28-Jun-2003 19:13


Saturday, June 28, 2003, 12:11:50 AM, Carl wrote:
> 1. GGI CONTENT-LENGTH field is not used because we have found that > field is not always supplied or accurate on all web servers (at > least that's been our experience - we know one site that modifies > web packets and changes their lengths!).
hehe :) be strict in what you send and liberal in what you accept. just for the sake of completeness: by using the /safe refinement of my simple 'read-post-data script Tim Johnson posted earlier, you can easily accomodate for other people's faults in this regard.
> 2. We switch on POST and GET to allow a third case: NONE. This is > very handy for local debugging
yes it is indeed. but as a sidenote, it is perfectly legal to have both, a query string and post data (thru e.g. a POST to /my/script.cgi?n1=v1 ). -- Best regards, Andreas mailto:[andreas--bolka--gmx--net]

 [9/12] from: rebol:meurrens at: 29-Jun-2003 12:03


At 19:13 28/06/2003 +0200, you wrote:
>Saturday, June 28, 2003, 12:11:50 AM, Carl wrote: > > 2. We switch on POST and GET to allow a third case: NONE. This is
<<quoted lines omitted: 3>>
>"/my/script.cgi?n1=v1"). > Andreas mailto:[andreas--bolka--gmx--net]
a) MIXING 'post AND query-string Yes indeed. There is an example of "mixing" 'post method and query-string at URL http://rebol.mksa.net/make-cgi/form-mix.php the output of the action script "cgi.reb" of this form probes a REBOL object showing how mixed entries are processed by make-cgi.r Can be usefull to quickly add some config values thru the URL of the form's action, etc. without the need for hidden fields in the form it self. As another sidenote, mind that your query-string and/or posted data do NOT need to be a set of well formed form fields values. Instead, your script on your server may decide to retrieve and to proceed it-self the data as in http://rebol.mksa.net/make-cgi/cgi.reb?this+is+your+query+string+in+your+proprietary+format b) LOCAL DEBUGGING See the refinements /test-query-string , /test-posted-data and /test-multipart added in the brand new version 0.1.2 of make-cgi.r at http://rebol.mksa.net/make-cgi/ (or read the intensively commented source code, near the end) Regards, </marc> Prof. Ir Marc Meurrens, Brussels (be) TEL: +32 (0)2 537 2812 FAX: +32 (0)2 537 7645 EMAIL: [marc--meurrens--org] URL: http://www.meurrens.org/ REB: http://rebol.mksa.net/ PGPKEY: http://www.meurrens.org/pgp/ Please don't mail me attached files, instead, use my 'exchange area' : EXCHANGE AREA: http://www.meurrens.org/exchange/ (HTTP/FTP upload/download of temporary/persistent files)

 [10/12] from: tim:johnsons-web at: 29-Jun-2003 8:38


* Marc Meurrens <[rebol--meurrens--org]> [030629 02:47]:
> At 19:13 28/06/2003 +0200, you wrote: > >Saturday, June 28, 2003, 12:11:50 AM, Carl wrote:
<<quoted lines omitted: 6>>
> > > > Andreas mailto:[andreas--bolka--gmx--net]
This is very interesting, I've tried this in the past, with no success, but I didn't use the enctype. BTW: I've used pathinfo extensively in the past for config values. It's never let me down. IOWS http://rebol.mksa.net/make-cgi/cgi.reb/mammals/cats/tabby pathinfo yields ['mammals' 'cats' 'tabby'] data structure depending on the parsing method of course. ~tj~
> a) MIXING 'post AND query-string > Yes indeed.
<<quoted lines omitted: 32>>
> [rebol-request--rebol--com] with "unsubscribe" in the > subject, without the quotes.
-- Tim Johnson <[tim--johnsons-web--com]> http://www.alaska-internet-solutions.com http://www.johnsons-web.com

 [11/12] from: rebol:meurrens at: 30-Jun-2003 11:04


Hello, According to remarks by Andreas and by Tim on this ML, the page :
> > http://rebol.mksa.net/make-cgi/form-mix.php
and the script
> > http://rebol.mksa.net/make-cgi/
have been updated to show several cases of mixing posted data with query-string and/or path-info. Enjoy! Regards </marc>
Prof. Ir Marc Meurrens, Brussels (be) TEL: +32 (0)2 537 2812 FAX: +32 (0)2 537 7645 EMAIL: [marc--meurrens--org] URL: http://www.meurrens.org/ REB: http://rebol.mksa.net/ PGPKEY: http://www.meurrens.org/pgp/ Please don't mail me attached files, instead, use my 'exchange area' : EXCHANGE AREA: http://www.meurrens.org/exchange/ (HTTP/FTP upload/download of temporary/persistent files)

 [12/12] from: Al:Bri:xtra at: 2-Jul-2003 18:43


Marc wrote:
> As another sidenote, mind that your query-string and/or posted data do NOT
need to be a set of well formed form fields values. Sometimes this a key to a really interesting user interface, where the user manipulates the URL to the script. Andrew J Martin ICQ: 26227169 http://www.rebol.it/Valley/ 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