Computer Science Canada

Server a la beard0

Author:  beard0 [ Wed Nov 24, 2004 3:23 pm ]
Post subject:  Server a la beard0

Seeing the server stuff up reminded me of my own server that I have been working on. It is, in my opinion at least, quite good, so I'll post it here for everyone to take a look at. It should be remebered however, that it is not perfect. I have taken precautions to make sure that someone cant /../ out of your web directory, but don't count on it - cause I dont wanna get sued :D. I have been playing around too with authentication techniques, but running into problems. I've been doing actually a fair bit of reading up on http, so a better, more compatible version should be comming.
Enjoy!

Author:  wtd [ Wed Nov 24, 2004 6:51 pm ]
Post subject: 

A couple of things.

I see:

code:
var headername, headerval : array 1 .. 20 of string


And I think you need to use a record type.

code:
type Header :
   record
      name, value : string := ""
   end record


Then your array looks like:

code:
var headers : array 1 .. 20 of Header


Also, I noticed you using those arrays in functions and procedures without passing them in as arguments. You shouldn't do this. Instead of:

code:
proc headerreset
    for i : 1 .. 20
        headername (i) := ""
        headerval (i) := ""
    end for
    numh := 0
end headerreset


Use something like:

code:
procedure headerReset (var headers : array 1 .. * of Header)
   for i : 1 .. upper (headers)
      headers (i).name := ""
      headers (i).value := ""
   end for
end headerReset

Author:  r0ssar00 [ Tue Jan 18, 2005 10:58 am ]
Post subject: 

this is one helluva server, compared to others ive seen


: