Rebol Talk Forum  |  Getting Started  |  Newbie Help  |  Topic: Starting CGI blog.r script .........
Pages: [1] Print
Author Topic: Starting CGI blog.r script .........  (Read 282 times)
jfdutcher
Jr. Member
**
Offline Offline

Posts: 95


View Profile
Starting CGI blog.r script .........
« on: April 09, 2007, 09:05:36 PM »

I call my localhost server to initiate the 1.4.2 verson of the blog.r script as follows:
http://localhost/cgi-bin/blog.r
 
This leads to the error shown below:

** Script Error: decode-cgi expected args argument of type: any-string ** Near: cgi: decode-cgi cgi-obj/query-string if find

The blog.r script ends with a call to "do-cgi" the code for which is shown below also......... the URL call to the script only works if some query string is made part of the URL, as in http://localhost/cgi-bin/blog.r?get-object......it just seems to me that the call should be able to succeed using the common and ordinary format
for script initiation: http://localhost/cgi-bin/blog.r  Huh?? (which ordinary users would expect).
 
do-cgi ; start it (if no tests are uncommented)

do-cgi: has [cgi] [
   ; Main CGI command handler.
   ; (It's getting to be time to rewrite it.)
   blog-count: 1 + any [attempt [load blog-counter] 0]
   save blog-counter blog-count
   cgi: construct/with decode-cgi read-cgi cgi-fields
   if cgi/view [show-blog to-integer cgi/view]
   if cgi/index [show-index]
   if cgi/reply [show-reply cgi/reply]
   if cgi/edit [show-edit cgi/edit]
   if cgi/find [show-search cgi/find]
   if cgi/save [
      show-blog save-blog cgi/save cgi/date cgi/title cgi/text
   ]
   if all [cmts-dir get in cgi 'cmt] [
      if not in cgi 'cancel [
         if any [
            empty? cgi/cmt
            empty? cgi/name
            empty? cgi/text
         ][
            show-error "Missing field in form. Go back and try again."
         ]
         if (length? cgi/text) > 4000 [
            show-error "Message is too long. Go back and trim it down."
         ]
         if any [ ; Qualify the comment id:
            find cgi/cmt #"/"
            not attempt [to-integer cgi/cmt]
            not exists? join blog-dir cgi/cmt
         ][
            show-error "Invalid comment submission"
         ]
         if find cgi/name "<" [
            show-error "Tags not allowed in name field. Go back and change it."
         ]
         if all [
            find-any cgi/name comment-name-restrict
            admin-ip admin-ip <> remote-ip
         ][
            show-error "Restricted name. Go back and use your name."
         ]
         if find-any cgi/text comment-restrict [
            show-error "Restricted words found in comment."
         ]
      ]
      if in cgi 'preview [
         preview-comment cgi/cmt cgi/name cgi/text
         show-page "Preview"
         
      ]
      if in cgi 'post [
         sum: checksum/secure rejoin [cgi/name cgi/text cgi/cmt]
         if abuse? remote-ip sum cgi/text [
            show-error ["Duplicate posting or abuse detected from" remote-ip]
         ]
         save-comment cgi/cmt cgi/name cgi/text
         note-comment cgi/cmt sum
         show-blog cgi/cmt
      ]
   ]

   if in cgi 'back [backup-blogs cgi/back]
   if in cgi 'restore [restore-blogs cgi/restore]
   if in cgi 'rebuild [rebuild-blogs]
   if in cgi 'source [show-source]
   show-main
]
Logged
jfdutcher
Jr. Member
**
Offline Offline

Posts: 95


View Profile
Re: Starting CGI blog.r script .........
« Reply #1 on: April 10, 2007, 08:15:25 PM »

I seem to have eliminated this problem....when I comment out the several lines of code in the "blog.r" scriptshown below .........the script runs properly in response to a URL of

        http://localhost/cgi-bin/blog.r

rather than needing: http://localhost/cgi-bin/blog.r?get-object  (or 'something'
following the ........blog.r  in the URL).

;-- Special shortcut needed to fetch source code text:
;if cgi-obj/request-method = "GET" [
;   cgi: decode-cgi cgi-obj/query-string
;   if find cgi to-set-word 'get-source [
;      print "content-type: text/plain^/"
;      print read %blog.r  ; use REBOL read url to save it
;      quit
;   ]
;]
Logged
Pages: [1] Print 
Rebol Talk Forum  |  Getting Started  |  Newbie Help  |  Topic: Starting CGI blog.r script .........
Jump to:  

  
Quick Search...

Advanced search
  
Welcome, Guest. Please login or register.
Did you miss your activation email?
September 07, 2008, 10:45:06 PM
Username: Password: Session Length:
  

News: 01-09-08

Alpha version of REBOL 3 has been released!


  
2233 Posts in 581 Topics by 1886 Members
Latest Member: antigopit

  Rebol Talk Forum | Powered by SMF 1.0.9.
© 2001-2005, Lewis Media. All Rights Reserved.

RT design by Defiant Pc