1. 3 problems using CGI in Euphoria

Hi everyone. I encountered a few problems when using CGI. Can someone kindly
help?

Environment: Windows Server 2003, IIS6

1. exwc.exe keeps running after submiting a form until CGI Timeout. But when
compiled to exe it works as expected.

2. I found the postdata() in LibCGI v1.5 doesn't work correctly, to be specific
the "HEREHEREHEREHERE" part.

global function post_data()
  object in
  sequence buf  buf = {}
  while 1 do
    in = gets(0) --HEREHEREHEREHERE
    if equal(in, -1) then
      return buf
    else
      if in[length(in)] = '\n' then  -- strip \n
        in = in[1..length(in)-1]
      end if
      buf &= in
    end if
  end while
end function


And I change it according to the CGI Support Routines by Aku

global function post_data()
  object lenq
  lenq = getenv("CONTENT_LENGTH")
  if atom(lenq) or length(lenq) < 1 then
  return ""
  else
  return get_bytes(0, val(lenq))
  end if
end function


And it works. So why get_bytes() not gets()? 

3. I can't read data from a form enctype="multipart/form-data", neither
get_bytes() nor gets(). The LibCGI v1.5 routine doesn't work, and Aku's library
contains no routine for that.

Thanks in advance.

new topic     » topic index » view message » categorize

2. Re: 3 problems using CGI in Euphoria

Nemo wrote:
> Hi everyone. I encountered a few problems when using CGI. Can someone kindly
> help?
> 
> Environment: Windows Server 2003, IIS6
> 
> 1. exwc.exe keeps running after submiting a form until CGI Timeout. But when
> compiled to exe it works as expected.

Try: 
   without warning

I recall that in CGI apps exwc might not terminate if it
outputs warnings. It tries to say "Press Enter" and waits
for the user to press Enter (which never happens).

> 2. I found the postdata() in LibCGI v1.5 doesn't work correctly, to be
> specific
> the "HEREHEREHEREHERE" part.
> 
> }}}
<eucode>
> global function post_data()
>   object in
>   sequence buf  buf = {}
>   while 1 do
>     in = gets(0) --HEREHEREHEREHERE
>     if equal(in, -1) then
>       return buf
>     else
>       if in[length(in)] = '\n' then  -- strip \n
>         in = in[1..length(in)-1]
>       end if
>       buf &= in
>     end if
>   end while
> end function
> </eucode>
{{{

> 
> And I change it according to the CGI Support Routines by Aku
> 
> }}}
<eucode>
> global function post_data()
>   object lenq
>   lenq = getenv("CONTENT_LENGTH")
>   if atom(lenq) or length(lenq) < 1 then
>   return ""
>   else
>   return get_bytes(0, val(lenq))
>   end if
> end function
> </eucode>
{{{

> 
> And it works. So why get_bytes() not gets()? 
> 
> 3. I can't read data from a form enctype="multipart/form-data", neither
> get_bytes()
> nor gets(). The LibCGI v1.5 routine doesn't work, and Aku's library contains
> no routine for that.

I'm not sure if this affects you or not, but
on Windows, file input from standard input (file 0)
is always in text mode (\r\n is converted to \n), so there will be 
problems if you need binary input. Things work fine
on Linux/FreeBSD. There may be a way to deal with this, but
no one ever got around to doing it (e.g. adding some command
to switch Windows standard input to binary).

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

3. Re: 3 problems using CGI in Euphoria

Robert Craig wrote:
> 
> Nemo wrote:
> > Hi everyone. I encountered a few problems when using CGI. Can someone kindly
> > help?
> > 
> > Environment: Windows Server 2003, IIS6
> > 
> > 1. exwc.exe keeps running after submiting a form until CGI Timeout. But when
> > compiled to exe it works as expected.
> 
> Try: 
>    without warning
> 

This is where having a non executing (syntax testing only) 
version of Euphoria helps. I have several production scripts where 
I need to make a tweak from time to time,
but cannot effectively test it inside the production environment.
 I modified the ex.exw in a prior version, bound an executable from it
 and added the resulting syncheck executable to my "send to" menu 
so syntax testing is only a right click away.

For the above problem,
If it still hangs after turning off warnings then 
you need to search for an ex.err file, it will not neccesarily be in the 
same directory as your script,because of the executing environment.

 Alternately supply a hard coded crash file path.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu