Browse files


git-svn-id: 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information...
1 parent 2129adc commit e16ea1b99ffb0fb9978cdce5dceb19e949679fa8 @klacke committed May 30, 2002
Showing with 127 additions and 16 deletions.
  1. +1 −1 ebin/
  2. +9 −6 src/yaws_server.erl
  3. +1 −1
  4. +101 −7 www/configuration.yaws
  5. +3 −0 www/history.yaws
  6. +12 −0 www/index.yaws
  7. +0 −1 www/todo.yaws
@@ -1,6 +1,6 @@
[{description,"yaws WWW server"},
- {vsn,"0.34"},
+ {vsn,"0.40"},
{modules,[yaws, yaws_app, yaws_config, yaws_server, yaws_sup, yaws_api, yaws_log, yaws_ls, yaws_debug, yaws_compile, yaws_ctl, yaws_ssl]},
{registered, []},
@@ -1044,23 +1044,26 @@ deliver_dyn_file(CliSock, GC, SC, _Req, _Head,_UT,DC, _Bin, _Fd, [], _ARG) ->
skip_data(List, Fd, Sz) when list(List) ->
skip_data(list_to_binary(List), Fd, Sz);
skip_data(Bin, Fd, Sz) when binary(Bin) ->
- ?Debug("Skip data ~p bytes ", [Sz]),
+ ?Debug("Skip data ~p bytes from", [Sz]),
case Bin of
<<Head:Sz/binary ,Tail/binary>> ->
{Head, Tail};
_ ->
- case file:read(Fd, 4000) of
- {ok, Bin2} ->
+ case (catch file:read(Fd, 4000)) of
+ {ok, Bin2} when binary(Bin2) ->
Bin3 = <<Bin/binary, Bin2/binary>>,
skip_data(Bin3, Fd, Sz);
_Err ->
- ?Debug("EXIT in skip_data: ~p ~p~n", [Bin, Sz]),
+ ?Debug("EXIT in skip_data: ~p ~p ~p~n", [Bin, Sz, _Err]),
skip_data({bin, Bin}, _, Sz) ->
+ ?Debug("Skip bin data ~p bytes ", [Sz]),
<<Head:Sz/binary ,Tail/binary>> = Bin,
- {Head, {bin, Tail}}.
+ {Head, {bin, Tail}};
+skip_data({ok, X}, Fd, Sz) ->
+ skip_data(X, Fd, Sz).
@@ -1162,7 +1165,7 @@ do_tcp_close(Sock, SC) ->
ut_open(UT) ->
case of
undefined ->
- {ok, Fd} = file:open(UT#urltype.fullpath, [read, raw]),
+ {ok, Fd} = file:open(UT#urltype.fullpath, [read, raw, binary]),
B when binary(B) ->
{bin, B}
@@ -1 +1 @@
@@ -33,7 +33,7 @@ The above commands will
checkout the bleeding edge source, build it and install it at with the docroot set to the local documentation.
-<p>Just <tt>make</tt> (withou install)
+<p>Just <tt>make</tt> (without install)
will build the yaws system and do a local
install at This is the typical mode of operation
while either just trying out yaws, or hacking yaws. This will install
@@ -59,23 +59,46 @@ file in the the toplevel directory.
erlang system and instructs it to start yaws.
<p>The following command line flags are availiable:
<li> <tt>-d </tt> <br>
Debug mode.
<li> <tt>-i </tt> <br>
Interactive mode, this starts the yaws webserver with an erlang
shell. If this flag is not given, yaws will run as a daemon.
<li> <tt>-c File </tt><br>
Use an explicit yaws.conf file
<li> <tt>-t </tt><br>
Trace mode, write a trace of all traffic to a file called 'trace'
in the log directory.
-<h3>HUP the server </h3>
- <p> NYI
+<li> <tt>-T </tt><br>
+Trace mode, write a trace of all http traffic to a file called 'trace'
+in the log directory.
+<li> <tt>-D </tt><br>
+Daemon mode.
+<li> <tt>-h </tt><br>
+HUP the daemon, make it read a new config file and clear its
+internal content caches. When updating the content on the site
+it's always a good idea to HUP the yaws daemon.
+<li> <tt>-s </tt><br>
+Stop the daaemon.
<H2>Configuring Yaws</h2>
Web server configuration can be supplied to yaws
@@ -107,6 +130,8 @@ embedded application inside another Erlang program.
parts for each virtual host that is defined. A very simple
example config could look like:
out(A) -> yaws_api:pre_ssi_string("
@@ -195,8 +220,6 @@ Let the server listen to port number PortNum
Let the server listen to the address IpAddr.
<li> <tt> docroot = Directory </tt> <br>
Let the server serv its content from the directory Dir.
-<li> <tt>ssl = true | false </tt><br>
<li> <tt> default_server_on_this_ip = true|false </tt>
When virthosting more than one server on the same IP address, we must
indicate to the yaws server which one of the virtual servers is the default
@@ -231,10 +254,81 @@ out(A) -> yaws_api:pre_ssi_string("
+<h3> SSL </h3>
+Yaws has full SSL support. When we are running SSL it is not
+possible to combine that with virtual hosting on the same IP address.
+The reason for that is ofcource that the webserver needs to choose
+a certificate before it reads the Host: header.
+<p>The following config options are possible for an SSL server.
+<li> <tt> ssl = true | false </tt>
+Turns on SSL processing for a server
+<li> <tt> ssl_keyfile = File </tt>
+Specifies which file contains the private key for the certificate.
+<li> <tt> ssl_certfile = CertFile </tt>
+Specifies which file contains the certificate for the server.
+<li> <tt> ssl_caceretfile = CaCertFile </tt>
+If the server is setup to require client certificates. This file needs to
+contain all the certificates of the acceptable signers for the client certs.
+<li> <tt> ssl_verify = [1 | 2 | 3]</tt>
+Specifies the level of verification the server does on clinet certs.
+1 means nothing, 2 means the the server will ask the client for
+a cert but not fail if the client doesn't supply a client cert, 3 means that
+the server requires the client to supply a client cert.
+<li> <tt> ssl_depth = Int </tt>
+Specifies the depth of certificate chains the server is prepared to
+follow when verifying client certs.
+<li> <tt> ssl_password = String </tt>
+If the private key is encrypted on disc, this password is the 3des key
+to decrypt it.
+<li> <tt> ssl_ciphers = String </tt>
+This string specifies the ssl cipher string. The syntax of the ssl cipher
+string is a littele horrible sublanguage of its own.
+It is documented in the ssl man page for "ciphers".
+<p> In the yaws distribution, an example (self generated) certificate
+and key is included in the $YAWSSRC/ssl directory.
+<p>Extending one of the example from above for SSL usage, it could look
+out(A) -> yaws_api:pre_ssi_string("
+ port = 443
+ listen =
+ docroot = /var/yaws/www
+ ssl = true
+ ssl_keyfile = /etc/yaws.key
+ ssl_certfile = /etc/yaws.cert
<h3>Embedded mode</h3>
+Not documented.
@@ -11,6 +11,9 @@ out(A) ->
<table border="2">
+<tr><td> May 26, added SSL support 0.40 </td> </tr>
<tr><td> Mar 29, fixed a bug in the log wrapping which restarted the server</td></tr>
<tr><td> Mar 26, released 0.32 </tr>
<tr> <td> Mar 26, 2002. Fixed a bug where chunked encodings were
@@ -48,6 +48,18 @@ of cource, <a href=""></a> is itself
powered by Yaws.
+<p> <h2> News </h2>
+<div class="box">
+<li> Version 0.40 released. Contains bugfixes and full SSL support
+as well as an embryo to WWW-Authenticate support.
out(A) -> yaws_api:ssi(A#arg.docroot, ["/END"]).
@@ -11,7 +11,6 @@ out(A) ->
-<li> ssl
<li> handle the If-..... headers
<li> generate Etag for static content
<li> handle Range header

0 comments on commit e16ea1b

Please sign in to comment.