Page 1 of 1

Problem with webserver

Posted: Thu Jun 22, 2006 5:01 pm
by Dave Zowasky
Hello All,

It seems I am having a problem with the webserv program.

I am on a version that was out in oct 2004.

When It goes to send a page, the receiving page never gets to the browser, and the page sent does not show in the log. When I ask for an invalid page I do get the error on the browser.

I have tested the same code on FW, FWPP and it works fine on those installs. I even installed the last version of FWH I have on a PC fresh and it still gets the same results.

Any Ideas?


Thanks

Figured out part of the problem

Posted: Fri Jun 23, 2006 2:43 am
by Dave Zowasky
I decided to create a new class from a copy of the twebserv class and as
I was debugging it I got to this section.

HtmlRead( cFileName ) CLASS TWebServer

hFile = LOpen( cFileName, "r" )

nSize = FSeek( hFile, 0, 2 ) // FS_END


It appears the nsize is coming back 0

I decided to plug in my own code:

hFile = fopen( cFileName, 0 )
nSize = FSeek( hFile, 0, 2 ) // FS_END
FSeek( hFile, 0, 0 ) // FS_SET
tbuf=" "
cbuffer:=""
y:=0
do while y<nsize
fx:=fseek(hfile,y,0)
fx=ferror()
if fx#0
info="Cfile <ERROR> FC-Seek #"+str(fx,2)
?info
endif
fx:=fread(hfile,@tbuf,1)
fx=ferror()
if fx#0
info="Cfile <ERROR> FC-Fread #"+str(fx,2)
?info
endif
cbuffer:=cbuffer+chr(asc(tbuf))
y:=y+1
enddo
fclose( hFile )


The server works nice and I am looking forward adding and playing with my new class.

Just wanted to pass on what I found.


Thanks

Posted: Fri Jun 23, 2006 8:35 am
by Antonio Linares
Dave,

Please try this change. Instead of:

Code: Select all

   hFile = LOpen( cFileName, "r" )

   nSize = FSeek( hFile, 0, 2 )  // FS_END
   FSeek( hFile, 0, 0 )          // FS_SET

   cBuffer = Space( nSize )
   FRead( hFile, @cBuffer, nSize )
   LClose( hFile )
just use:

Code: Select all

   cBuffer = MemoRead( cFileName )
Please let us know if it works for you. Thanks,