SWS Configuration document
==========================     [ pancake @ phreaker.net ]

As you see in sws.conf there'r a lot directives that you'll be able
to configure and tune your sws configuration.

Basically there's 2 ways to configure SWS:
  * command-line arguments
  * configuration file
  * "console" <- not yet implemented


command-line:
-------------
In the cmdline you could configure few options, the minimum ones:

$ ./screwsd -h
Usage: ./sws [options]                  pancake@phreaker.net - Copyleft 2003
 -c [cfgfile]   ::   Set configfile to read.
 -p [prgname]   ::   Set program name.
 -v #           ::   Verbose level.
 -s             ::   Be strict.
 -d             ::   Run as daemon, aka setsid.
 -h             ::   Show this helpy stuff.

A little explanation...

# -c "../conf/sws.conf"
    With this option you will be able to define what configuration
    file will be used in the load of the server.

# -p "prgname"
    This option allows you to reset the argv[0], just for nice
    name in a `ps aux` output.

# -v 4
    Verbose level...If you want more verbose data on your terminal
    type a large number ;)

# -s
    Strict mode. By default, if sws found an error or missconfiguration
    will ignore it and use the default option. Insted, if you set this
    mode, sws will return to the cmdline.

# -d
    Run in daemon mode, just make a new session, and allows you
    to quit from this user-session, and keep sws running in the
    background.

# -h
    Need an explanation?



configuration-file:
-------------------
The configuration file is almost the better way to configure SWS, inside
it you could redefine everything. Here there'r the directives supported:

listen <protocol> <listen-addr> <port> <thread-name>
    - Protocol is just "inet" or "inet6" for ip4 or ip6.
    - listen-addr is the IP address where sws will stand listening.
      If you want to listen to every access just type: "0.0.0.0" for ip4
    - port : ...the port that you want to listen there.
    - thread-name : is an aliasname that points to this listen entry.

maxthr [@?] <value>
    - Sets the maximum number of threads allowed for this thread, listen,
      or main-thread.

maxcpu [@?] <value>
    - Limits the maximum CPU usage for a *?* process, when the process
      overflows this limit, process will be killed.

maxmem [@?] <value>
    - Like maxcpu does, but limiting by memory usage. ( be alert here ;) )

prio [@?] <value>
    - Sets the process nice priority. ( Like (re)nice in cmdline )

chroot [@?] <string>
    - Chroots the process under the defined directory. This chroot call
      is safer under "linux" boxes, because patches the "../../" bug.
      Under BSDs or HURD it also works without problems and safer.
      PPID must have root priviledges or kernel could be patched to
      allow GID-specific to chroot, etc.

setuid [@?] <value>
    - Change current PID to the specific UID.

seteuid [@?] <value>
    - Same as before but with effective UID.

setgid [@?] <value>
    - Mmmh...the same, but with Group-ID

setegid [@?] <value>
    - Yes. that's for effective GID ;)

whitespace <char>
    - whitespace char, is used to allow write strings in the conf-file
      with spaces, because, every word in the configuration file is
      checked as a separated directive:

      i.e:
         whitespace @
	 env * HZZ Hello@World@!!
	 . . .
	 echo ${HZZ}
	 Hello World !!

exec [@?] <string>
    - Defines the exec program to be called when a petition is recived.

timeout [@?] <value>
    - Sets a time-out limit to get a connection.

chdir [@?] <string>
    - Change the current working directory of the current thread.

strict
    - This stand-alone word directive is equivalent to "-s"

daemon
    - The same as "-d"

verbose <value>
    - The same as "-v #"

backlog [@?] <value>
    - Sets a limit backlog of connections waiting for an accept() connection.
      (man 2 listen)

noargs
    - Ignores the ?r=4&b=2... string

falsetimeout
    - When this directive is set, every line typed into the incomming
      connection will reset the alarm timeout.

maxhdr
    - Limits the number of Header lines allowed to be input by client.

httplen
    - Limits the number of characters in the input request:
      By default is "-1", the same as MAX_INT #defined by arch.

notimeout
    - Disables the timeout on incomming connections.

usleep
    - Sets the usleep value. Just for while(1) loops.

nolock
    - Disable the fmutex feature.

directio
    - Uses direct IO between script and connection it speeds up
      ttr (time to reply) but takes less caution in signal handling, etc.

nopoll
    - Use Buffered IO instead of poll. Read "doc/io" file for more information.

logstr [string]
    - Defines the log string to be used in log files. This is like apache do:
      %a - User Agent
      %h - Host (http header)
      %i - remote_addr (IP)
      %t - hex time
      %d - human time
      %m - method used
      %f - file to get
      %c - argc
      %n - newline
      %r - referer

nologs
    - Disables the logs capabilites.

addssl [listed-id] [rsa-cert] [privkey]
    - Adds SSL to the listen ID created by "listen" directive.
      Read in "doc/ssl" for more information.

usessl3
    - Initializes SSLv3 instead of 2. (not recommended)

addmod [path/to/file]
    - Adds a new module to the core.

modopt [modulename] [string]
    - Adds an option to certain module. Read module source and doc of every
      module to use it.
