Re: 3 problems using CGI in Euphoria
- Posted by Robert Craig <rds at Ra?idEupho?ia.com> Jan 13, 2008
- 570 views
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