Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Apr 16, 2015
  1. @vinoski

    Fix #216: handle exhtml return values from out/1

    vinoski authored
    Do not crash if out/1 returns exhtml. Add a new regression test for
    this bug.
Commits on Apr 13, 2015
  1. @capflam

    Adapt previous Andrei patch to do more stuff during Yaws startup

    capflam authored
    And update the testsuite accordingly.
Commits on Jul 7, 2014
  1. Massive autotools refactoring & cleanup

    Christopher Faulet authored
    Now, all makefile are generated by automake. This way, many things are more
    configurable and maintainable.
    Main (visible) changes:
     * Now, you can configure and compile Yaws outside the source directory. It is
       also possible to generate an archive for distribution, using the 'dist' target
       (from now, 'distcheck' target should always pass).
     * We track .erl dependencies using '-M*' flags of ERLC.
     * generated header 'yaws_configure.hrl' disappears. HAVE_SENDFILE,
       HAVE_ERLANG_SENDFILE and HAVE_CRYPTO_HASH macros are defined in ERLC flags.
     * yaws_generated:localinstall/0 function disappears (see comment about local
     * To create a windows installer, we just need to run the 'mkinstaller'
       target. Read win32/README.developer for details.
     * We use standard Erlang installation path for Yaws, relative to the erlang
       library directory (/usr/lib/erlang/lib). Now, '$(libdir)/yaws' is a link. We
       do the same for yapp application.
     * "local install" was removed. Now, to do a "developer install", we just need
       to set a prefix during the project configuration using --prefix option. So,
       you need to install yaws to test it.
     * DESTDIR variable is still supported.
     * scripts/make-release was rewritten to use 'dist' and 'mkinstaller' targets.
     * Installation of Yaws applications has slightly changed. Now they are
       installed in their own directory, in '$(localstatedir)/yaws'. So, chat
       application will be installed in '$(localstatedir)/yaws/chat', with 'www' and
       'ebin' subdirs.
    Main targets (others than all/install/clean....):
      * all           : compile Yaws
      * debug         : compile Yaws with debug flags
      * clean         : remove files produced by all or debug target
      * install       : do a proper install of Yaws
      * doc or docs   : build the documentation
      * check or test : launch tests
      * cleantest     : remove files produced by check target
      * dialyzer      : run dialyzer on Yaws
      * mkinstaller   : build an installer for windows
      * cleaninstaller: remove files produced by mkinstaller target
      * apps          : compile Yaws applications (chat,mail,wiki,yapp)
      * cleanapps     : remove files produced by apps target
      * installapps   : install Yaws applications
      * fullinstall   : install + installapps
      * fullclean     : clean + cleantest + cleanapps + cleaninstaller
      To install an application, run: (cd application/{APP} && make install)
    Of course, many things can be customized during configuration and Rebar still
    works as expected. To do an install with (almost) the same tree than with
    previous of Yaws, do:
      $> ./configure yawsdir=${prefix}/lib/yaws yappdir=${prefix}/lib/yapp \
            --sysconfdir=/etc --localstatedir=/var
      $> make install
    Here is the default installation tree on my debian:
        ├── lib
        │   └── erlang
        │       └── lib
        │           ├── yapp-0.4.2
        │           │   ├── doc/
        │           │   ├── ebin/
        │           │   ├── examples/
        │           │   └── priv/docroot/
        │           └── yaws-1.98
        │               ├── ebin/
        │               ├── include/
        │               └── priv/
        │               ├── examples/
        ├── local/bin/yaws
        ├── local/etc/init.d/yaws
        ├── local/etc/yaws/
        ├── local/etc/mail/yaws-webmail.conf
        ├── local/lib/pkgconfig/yaws.pc
        ├── local/lib/yapp -> /usr/lib/erlang/lib/yapp-0.4.2
        ├── local/lib/yaws -> /usr/lib/erlang/lib/yaws-1.98
        ├── local/share/doc/yaws/yaws.pdf
        ├── local/share/man/{man1,man5}/
        ├── local/var/log/yaws
        ├── local/var/run/yaws
        └── local/var/yaws
            ├── chat/{ebin,www}
            ├── mail/{ebin,www}
            ├── wiki/{ebin,www}
            └── www
Commits on May 20, 2014
  1. @vinoski

    convert non-ASCII characters in json2 decoding

    vinoski authored
    Non-ASCII characters in JSON strings are now decoded to UTF-8.
Commits on Feb 24, 2014
  1. @vinoski

    replace charset.def with generated yaws_charset.hrl

    vinoski authored
    Richard Carlsson pointed out in a private email that having configure
    generate the priv/charset.def file to be read and interpreted by
    src/mime_type_c.erl was overly complicated.
    Modify configure script and rebar.config.script to instead generate
    src/yaws_charset.hrl, and include that into src/mime_type_c.erl. Thanks to
    Richard for suggesting these simplifications.
    Also, enhance rebar.config.script to be able to extract the desired charset
    from the YAWS_CHARSET OS environment variable if set, thus providing rebar
    users a way to set the charset, which they couldn't do before.
    Fix test/t2/app_test.erl to not fail on Content-Type header tests if the
    header value contains a charset specification.
Commits on Nov 8, 2013
  1. @vinoski
Commits on Jul 18, 2013
  1. @capflam
Commits on Jul 15, 2013
  1. @mdaguete @vinoski

    Incorrect X-Forwarded-For header

    mdaguete authored vinoski committed
    When X-Forwarded-For header appears multiple times in a request only the
    last value is supplied by yaws_api:headers_x_forwarded_for/1.
    RFC 2616 section 4.2 permits multiple headers with the same name as an
    equivalent of one header with a comma-separated list of values.
    Pound loadbalancer ( ) repeats the header.
    Change yaws to collect all values for this header and present them as a
    single comma-separated list. Add a regression test to test/t2.
Commits on Jun 20, 2013
  1. @vinoski

    changes for R16B01

    vinoski authored
    In R16B01, crypto:sha/1 is deprecated in favor of crypto:hash/2, but the
    latter is not available prior to R15B02. Change the configure script and
    rebar support to look for crypto:hash/2 and use it if found, otherwise fall
    back to crypto:sha/1.
    Also in R16B01 the public_key application, used by some of the tests, now
    requires the asn1 application to be started first. Change the tests to
    accommodate that.
Commits on Feb 11, 2013
  1. Refactor WebSockets and add support of optional callback functions

    Christopher Faulet authored
    Main changes:
      * Fix some bugs about UTF-8 encoding and messages fragmentation
      * Add support of optional callback functions
      * Add support of many startup options
      * Add support of outgoing fragmented messages
      * Add a websocket testsuite
                                     - * -
    *** bug fixes ***
    First of all, an huge part of yaws_websocket.erl was rewritten to fix bugs
    about the messages fragmentation and the UTF-8 encoding of incoming text
      * UTF-8 encoding
        before, when a text message was fragmented, only the first frame was
        checked and partial UTF-8 sequences were not supported. Now, checks
        are done on each message part and a partial UTF-8 sequence at the end
        of a frame is accumulated and checked with the next frame (for basic
        callback only).
      * Messages fragmentation
        for basic callback modules, because of a buggy mapping between frames
        and messages, the messages fragmentation was almost unusable. To fix
        this, the message handling was rewritten.
    Now, all tests in the autobahn testsuite[1] pass successfully.
                                     - * -
    *** Optional callback functions ***
    Then, from an idea of François de Metz[2], yaws_websocket module was
    extended to support optional callback functions. See the documentation for
    details (www/websockets.yaws).
    Quickly, optional callback functions are:
      * Module:init/1           (for basic and advanced callback modules)
      * Module:terminate/2      (for basic and advanced callback modules)
      * Module:handle_open/2    (for basic and advanced callback modules)
      * Module:handle_info/2    (for basic and advanced callback modules)
      * Module:handle_message/2 (for basic callback modules only, used in place
                                 of Module:handle_message/1)
    Thanks to Pablo Vieytes[3] which added handle_info to optional callback
                                     - * -
    *** Startup options ***
    To start a websocket process a script must return the following term from
    its out/1 function:
      {websocket, CallbackMod, Options}
    where 'Options' is a (possibly empty) proplist. Following parameters are
      * {origin, Orig}
      * {callback, Type}
      * {keepalive, Boolean}
      * {keepalive_timeout, Tout}
      * {keepalive_grace_period, Time}
      * {drop_on_timeout, Boolean}
      * {close_timeout, Tout}
      * {close_if_unmasked, Boolean}
      * {max_frame_size, Int}
      * {max_message_size, Int}
      * {auto_fragment_message, Boolean}
      * {auto_fragment_threshold, Int}
    See the documentation for details (www/websockets.yaws).
                                     - * -
    *** Outgoing fragmented messages ***
    A callback module can now send fragmented messages to clients using the
    record #ws_frame{}:
     #ws_frame{fin     = true,  %% true | false
               rsv     = 0,
               opcode,          %% text | binary | continuation...
               payload = <<>>}. %% binary(), unmasked data
    [2] #99
Commits on Jan 3, 2013
  1. Add support for deactivation of cache in reentrant calls

    Christopher Faulet authored
  2. Make be possible to chain appmods

    Christopher Faulet authored
    Before, all appmods were disabled during a reentrent call. So it was
    impossible to chain appmods. Now, it is possible. Only the current appmod
    is disabled for the next recursion (if we are inside an appmod of course).
    So if we have this configuration for appmods:
      appmods = </foo, foo> </bar, bar>
    When "/foo" is requested, the appmon "foo" is called. At this step, it is
    possible to call the appmod "bar" by returning {page, "/bar"}.
Commits on Nov 28, 2012
  1. @vinoski

    skip sslaccept_tout_test for R15B03

    vinoski authored
    An SSL bug introduced in R15B03 makes the sslaccept_tout_test fail. The bug
    is explained here:
    Check the Erlang version and skip that test for R15B03.
Commits on Nov 20, 2012
  1. Take care to preserve the query-string in yaws_server:deliver_302/4

    Christopher Faulet authored
    It is an old bug on the redirect made when the trailing slash is missing.
    The query-string was always missing from the redirect URL. So now, we add
    it explicitly.
Commits on Oct 23, 2012
  1. @leg0 @vinoski

    Fix bug #128 and add a new test case for it

    leg0 authored vinoski committed
  2. @vinoski

    ensure compatibility with Erlang R13B04

    vinoski authored
    For R13B04 compatibility, fix bare calls to integer_to_list and
    list_to_integer, and in yaws_davlock provide an alternative for pre-R14 for
    finding hwaddrs.
Commits on Oct 9, 2012
  1. @vinoski

    add a configurable dispatch module

    vinoski authored
    Allow an application to supply its own dispatch module for a server by
    setting the new dispatchmod variable in the server config. The module is
    expected to export a dispatch/1 function that returns one of the following
    * done: this indicates the dispatch module has handled the request and sent
      the response, and Yaws should go look for a new request on this
    * closed: same as "done" but also indicates the dispatch module has closed
      the connection
    * continue: this tells Yaws to continue with the normal dispatch path
Commits on Oct 2, 2012
  1. @vinoski

    Fix SSL socket wrapping

    Christopher Faulet authored vinoski committed
    We must be careful when we rely on Arg#arg.clisock in Yaws modules
    because the socket is wrapped in case of SSL connections.
    Thanks to Jean-Charles Campagne.
Commits on Sep 18, 2012
  1. Parse extensions and trailing headers of chunked transfer encoded req…

    Christopher Faulet authored
    Chunk extensions and trailing headers are parsed but ignored in requests
    and are not supported in responses. It is a strange feature of the RFC-2619
    and would be hard to implement. Moreover, this feature is rarely supported
    by clients and servers and even less used.
    So, without any concrete use-case, no further work will be done on this
  2. Fix tests on Transfer-Encoding header to be case-insensitive

    Christopher Faulet authored
Commits on Aug 25, 2012
  1. @vinoski

    make sure "rebar eunit" passes

    vinoski authored
    When using yaws as an app dependency for another application built with
    rebar, I noticed that testing that application with "rebar eunit" would
    fail while testing yaws. It was easy to work around with "rebar eunit
    skip_deps=true" but yaws really should pass its tests when tested via
    Change rebar.config to add ibrowse as a dependency. It's used only for
    testing, but rebar doesn't support test-only dependencies, plus it's
    filtered out during release generation anyway.
    Modify some of the test files to be able to find ibrowse include files
    regardless of whether they're built via make or via rebar. Also rename all
    non-eunit test functions ending in "_test" so they don't confuse eunit. Also
    had to move the embedded_yaws_id_dir test from eunit to t2 because it fails
    under "rebar eunit" when yaws is a dependency for another app. It fails
    because it calls into the yaws_api:embedded_start_conf function which tries
    to call application:load(yaws), but paths aren't properly set up to allow
    that to work under these testing circumstances.
    Note that not all tests currently run under rebar; building with make and
    then running "make test" results in many more tests being executed. Fixing
    this will come later.
Commits on Jul 30, 2012
  1. @jbothma

    Add basic websocket test.

    jbothma authored
    It performs the handshake, then sends one text message and checks
    that it is echoed back correctly.
Commits on Jul 11, 2012
  1. Add index_files directive into the server part configuration

    Christopher Faulet authored
    This directive sets the list of resources to look for, when a directory is
    requested by the client. If the last entry begins with a "/", and none of
    the earlier resources are found, Yaws will perform a redirect to this uri.
    Default is:
      index_files = index.yaws index.html index.php
Commits on Jun 27, 2012
  1. @vinoski

    loosen docroot checking for certain server configs

    vinoski authored
    For server configurations that define a reverse proxy, redirection for the
    path "/", forward proxies, or appmods on "/", a docroot isn't
    needed. Change yaws_config to avoid errors for missing docroot settings for
    such servers. Add test/t6 to check these configurations.
Commits on Jun 21, 2012
  1. @vinoski
Commits on May 12, 2012
  1. @vinoski

    add new HTTP status codes from RFC 6585

    vinoski authored
    RFC 6585 added new HTTP status codes, so add them here.
    Also change the code that limits the number of incoming headers to return
    new status code 431 (Request Header Fields Too Large).
Commits on May 4, 2012
  1. @vinoski

    report uncaught exception as server error 500

    vinoski authored
    In yaws_server we used to catch exceptions thrown by application code and
    ignore them. Now, catch them and report a 500 error back to the client, and
    include an error message similar to what occurs for unexpected exits in
    application code. This makes debugging applications that unexpectedly throw
    exceptions much easier. Thanks to Richard Carlsson and Samuel Rivas for
    reporting this.
Commits on Apr 25, 2012
  1. Add options to configure deflate compression behaviour

    Christopher Faulet authored
    By adding "<deflate> ... </deflate>" structure in vhosts configuration,
    it is possible to configure how deflate compression will be applied
    and when it will come into effect. Now we can:
     * define the smallest response size that will be compressed
     * define the compression level to be used
     * specify the zlib compression window size
     * specify how much memory should be allocated for the internal
       compression state
     * choose the strategy used to tune the compression algorithm
    All these parameters are used when a zlib stream is initialized for
    It is also possible to define all compressible mime types.
    Here is an example:
    <server localhost>
      deflate = true
        min_compress_size = 4096
        compression_level = best_compression
        mime_types        = defaults, image/*
        mime_types        = application/xml, application/xhtml+xml, application/rss+xml
        mem_level         = 9
        strategy          = default
        window_size       = 15
Commits on Apr 1, 2012
  1. @vinoski

    fix tests due to ibrowse include file path change

    vinoski authored
    In the ibrowse sources ibrowse.hrl was moved from the src dir to the
    include dir. Change yaws tests where necessary to account for this change.
Commits on Feb 15, 2012
  1. Fix issue #88

    Christopher Faulet authored
    2 changes here:
     * Revert "Flush remaining data when dynamic content is delivered"
    This reverts commit d09ed3d.
    Systematically flushing data is not a good idea.
     * Add "flush" as possible return value of the out/1 function
    Some clients (eg. Firefox and google-chome...) do not handle connection
    close gracefully when the connection is closed during sending data; they
    do not read the server response. So, when the response is important, to
    warn the end-user that an error occured for example, we must be fair by
    flushing data before closing the connection.
Commits on Jan 9, 2012
  1. Add tests for flush mechanisms

    Christopher Faulet authored
  2. Update the testsuite accordingly

    Christopher Faulet authored
Commits on Oct 20, 2011
  1. @vinoski

    move some test files

    vinoski authored
    Relocate test files for some test/t2 tests to the new www directory
    underneath that directory, instead of reaching up and across to the
    top-level www directory. Change test code and config files as
    necessary to match.
  2. @vinoski

    fix CGI redirect HTTP status bug

    vinoski authored
    The CGI 1.1 spec (RFC 3875) requires a server to augment a CGI
    response with a 302 status code if that responses consists only of a
    HTTP Location header and optional CGI extension headers, but Yaws was
    not doing this. Fix this and add a unit test to verify it.
Something went wrong with that request. Please try again.