Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

R16 #1

Merged
merged 107 commits into from
@marutha
Owner

No description provided.

vinoski and others added some commits
@vinoski vinoski remove unnecessary inet:setopts from server-sent events example da6d73c
@vinoski vinoski remove duplicate entry from 1.94 news be0babd
@capflam capflam Fix parse_set_cookie/1 and format_set_cookie/1 functions
1. According to the RFCs 2109 and 2965, multiple cookies can be set in a
single 'Set-Cookie' header. So, yaws_api:parse_set_cookie/1 now returns a
list of #setcookie{} records. If no cookie was found or if an error occurred,
it returns []. The parsing is also improved.
Note that this fix breaks the compatibility with previous versions.

2. In yaws_api:format_set_cookie/1, options are now always formated as
quoted-strings.

3. 2 new functions are added, yaws_api:parse_cookie/1 and
yaws_api:format_cookie/1, to parse and format 'Cookie' headers. To let these
functions to work, the #cookie{} record was introduced.

Documentation and testsuite are updated accordingly.
3a8e071
@yushli

It seems commits like that change a lot of code. How can we ensure the quality of such large changes? I know there is unit test added. But maybe a more thorough test and code review would be necessary to guard any performance degradation and compatibility break before it is commited into main branch.
Also a suggestion: yaws_api:find_cookie_val accepts either Arg or a list as the second argument. But we can change them into two functions so that we don't need to get to pattern matching the first one during each tail recursion for a list. like adding a function yaws_api:find_cookie_val_from_list(Name,List).

First, about yaws_api:find_cookie_val/2, keeping API unchanged has advantage to not break backward compatibility. But, you're right, it's useless and inefficient to recurse on this function. find_cookie_val2 is a better choice for that. So, I will fix that quickly (I also found a small inconsistency in this function...).

Then, about this commit, changes are not so huge. The only thing that really changed is the function yaws_api:parse_set_cookie/1 that was buggy (according to the rfc2109 and rfc2965). yaws_api:find_cookie_val/2 will be slower and can be certainly improved. But, because the cookie parsing was improved, this function is less buggy (I hope so :). I've thought that changes was small enough to be merged in the master.

Steve and I should work again on this part to deal with rfc6265. So, discussions are always opened and all feedback are welcomed. Thanks for your comments.

Thanks for the quick response. That clears the things up.

I also opened another issue about the commit that adds an extra parameter IPPort to 'GET','POST' functions etc. Would you like to look into it as well? Thank you

kdcircle and others added some commits
@kdcircle kdcircle -fixed action header for soap12 requests to contain action rather tha…
…n operation;

-added namespace registry to allow for wsdl inline schemas in different namespaces
32d4de1
@tuncer tuncer Sync with upstream rebar node template 39aae44
@vinoski vinoski Merge pull request #113 from tuncer/reltool-update
Sync with upstream rebar node template
241ec4d
@vinoski vinoski minor changes to server-sent events
Change yaws_sse to send close connection header by default, and change the
example to return an Allow header if anything other than GET is requested.
a721cfc
@kdcircle kdcircle -enabled http client library options customization 2d33061
@kdcircle kdcircle added export for the newly introduced call/8 0c1112d
@kdcircle kdcircle added customization for ibrowse timeout parameter since it is not ove…
…rridable
caa121a
@capflam capflam Refactor Set-Cookie/Cookie header parsing to follow RFC6265
RFC6265 obsoletes RFC2965 and RFC2109. #setcookie{} and #cookie{} are
changed to reflect this new RFC. So, yaws_api:parse_set_cookie/1 and
yaws_api:parse_cookie/1 are refactored accordingly:

* yaws_api:parse_set_cookie/1: Because RFC2109 and RFC2965 are still used,
  we try to be backward compatible with these old RFCs. So this function
  returns a #setcookie{} record when only one cookie is found else it returns
  a list of #setcookie{} records.
  in RFC2109 and RFC2965, cookies are separated by comma. So, comma is
  forbidden in 'path-av' and 'extension-av' except for double-quoted value.
  The parsing are not really strict because of the compatibility and can lead
  to unwanted behaviors.
  Old attributes (like 'Comment' or 'Port') are still parsed and can be
  found into #setcookie.extensions field.

* yaws_api:parse_cookie/1: This function follows the RFC6265, so all cookie
  attributes (like '$Domain' or '$Path') are parsed like any other cookie.
ba07506
@capflam capflam Fix test on the return value of peername/2 in close_accepted_if_max/2 6561513
@vinoski vinoski wrap SSL sockets in tuple
Yaws previously internally used details of an SSL socket representation
that's supposed to be private/opaque to Erlang's SSL support. Encapsulate
SSL sockets within a {ssl, SslSocket} tuple and add the
yaws_api:get_sslsocket/1 function that returns a socket for SSL sockets or
undefined for non-SSL sockets. Also document the new get_sslsocket/1
function and other minor tweaks to SSL areas of the documentation.
5b34d48
@vinoski vinoski minor changes to server-sent events
Change yaws_sse to send close connection header by default, and change the
example to return an Allow header if anything other than GET is requested.
6948590
@capflam capflam Add index_files directive into the server part configuration
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
6c6f62f
@vinoski vinoski server_sent_events: end gen_server process if send fails 2ad166a
@klacke klacke Merge pull request #116 from sumup/feature/soap12_imports_namespaces
Feature/soap12 imports namespaces
c99d247
@tuncer tuncer Sync rel/files/yaws with upstream template ef5e555
@vinoski vinoski Merge pull request #117 from tuncer/noderunner
Sync rel/files/yaws with upstream template
ca7f85f
@capflam capflam Fix return value of yaws_server:is_auth/2 when no auth structure is f…
…ound
a5515f2
@capflam capflam Make the mime types mappings configurable
Now, it possible to customize the global mime types mappings and to overload
it for each virtual server. It can be done using following directives in the
global part or the server part of the configuration:

* default_type: Defines the default mime type to be used where Yaws cannot
  determine it by its mime types mappings (default: text/plain).
  In the server part, this directive overloads the global one.

* default_charset: Defines the default charset to be added when a response
  content-type is text/* (default: none). In the server part, this directive
  overloads the global one.

* mime_types_file: Overrides the default mime.types file included with Yaws
  (default: ${PREFIX}/lib/yaws/priv/mime.types). In the server part, this
  directive overloads the global one but mappings defined in this file will
  not overload those defined by add_types directives in the global part.

* add_types: Specifies one or more mappings between mime types and file
  extensions. More than one extension can be assigned to a mime type. If a
  mapping is defined in the global part and redefined in a server part using
  this directive, then the later is used. Else the global one is kept.

* add_charsets: Specifies one or more mappings between charsets and file
  extensions. More than one extension can be assigned to a charset. If a
  mapping is defined in the global part and redefined in a server part using
  this directive, then the later is used. Else the global one is kept.

Here is an example:

  default_type = text/html

  <server localhost>
      port = 8000
      listen = 0.0.0.0
      docroot = /var/www
      # nothing is overloaded in the vhost
  </server>

  <server localhost>
      port = 8001
      listen = 0.0.0.0
      docroot = /var/www

      # overload global configuration:
      default_type    = text/plain
      mime_types_file = /etc/mime.types
      add_types       = <text/xhtml, yaws> <application/x-test, tst test>
      default_charset = UTF-8
      add_charsets    = <ISO-8859-1, php html yaws> <US-ASCII, tst>
  </server>

During Yaws compilation, a default module 'mime_types' is created using the
default mime.types file. Then, when yaws starts up, this module is
re-generated, re-compiled and loaded dynamically. The new module replaces the
default one but the .beam file is unchanged. So if one of these steps failed,
we fall back on the default module.
89a64ef
@capflam capflam Check missing fields in yaws_config:eq_sconfs/2 40d7acd
@capflam capflam Improve how Yaws is started in embedded mode
The main change concerns the function yaws:create_sconf/2. Now, this function
relies on yaws_config:make_default_sconf/2 to create a default #sconf record.
2f3a4bf
@jbothma jbothma Add basic websocket test.
It performs the handshake, then sends one text message and checks
that it is echoed back correctly.
940ea3a
@vinoski vinoski fix setting of yawsid_opts variable in OS X startup script 79ba3ba
@vinoski vinoski support Raspberry Pi in configure.in (Anders Nygren) 1c4d428
@vinoski vinoski Merge pull request #121 from jbothma/master
Add basic websocket test.
a1dbdc6
@vinoski vinoski add flexible variant of yaws_api:reformat_header
Add a new yaws_api:reformat_header/2 that takes a formatting function as
the second argument. The old reformat_header/1 now just calls this, passing
the original formatting function.
602dba7
@vinoski vinoski document the new yaws_api:reformat_header/2 function b415950
@vinoski vinoski make sure more modules are included in a release (issue #122)
The problem that caused issue #122 is that the yaws_outmod module, which
isn't directly referenced by any other yaws module, was not being included
in the application release. Change the mod_cond in rel/reltool.config to
all rather than app to ensure yaws_outmod gets included.
d990b30
@vinoski vinoski revert commit d990b30
Commit d990b30 was intended to fix issue #122 but my testing was flawed, so
I'm reverting it. The real issue seems to be a bug with reltool not
honoring app overrides of sys-level mod_cond settings.
d0a90a9
@vinoski vinoski make sure "rebar eunit" passes
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
rebar.

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.
66f50e6
@vinoski vinoski add startup script for FreeBSD 9 (Thomas Elsgaard)
Add scripts/freebsd/yaws for FreeBSD version 9 or later. The original
script at scripts/freebsd/yaws.sh is retained for use with FreeBSD versions
prior to 9.
d508c6b
@vinoski vinoski update mime.types file 2ff32fe
@jj1bdx jj1bdx Update Makefile and src/Makefile
* Targets in `Makefile` of `yaws.plt` and `dialyzer` calls
  dialyzer with two target directories, `ebin` and `src`;
  this causes the error of duplicate modules.
  Checking out the .beam files under `ebin` is sufficient
  for dialyzer; `src` is removed.

* Target `mime_type_c.beam` in `src/Makefile` is
  superfluous and generates a spurious .beam file in
  the `src` directory, so the target is removed.
  Also target `charset.def` in `src/Makefile` should be
  dependent on `../ebin/mime_type_c.beam`, so this is
  also changed from the previous target without the
  directory path.
9b86f4a
@klacke klacke Merge pull request #124 from jj1bdx/jj1bdx-dialyzer-fix
Update Makefile and src/Makefile
5f3ea37
@vinoski vinoski update known dialyzer warnings file 7688b46
@klacke klacke Added support to configure ciphers in ssl, previously the ciphers = V…
…al stricng in yaws.conf required the Val to be a string according the openssl cipher string spec language. Now we specify an erlang list instead, the list shall comply to the output of ssl:cipher_suites()
8551256
@klacke klacke Merge branch 'master' of github.com:klacke/yaws 3784dfb
@capflam capflam Optimize the ACL checks during the request's authentication
Now, in yaws_server:handle_auth/4, the client ip is no more converted into
integer. All ip addresses in #auth.acl are of the type ip_address(). That makes
easier the checking of the client ip.
To clean up the code, functions that parses and checks the allowed/denied ip
addresses with the client ip were moved into yaws.erl.
5101fde
@capflam capflam Fix tests on Transfer-Encoding header to be case-insensitive f3a31fe
@capflam capflam Parse extensions and trailing headers of chunked transfer encoded req…
…uests

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
subject.
a66f8a3
@capflam capflam update known dialyzer warnings file 77142a0
@vinoski vinoski add some missing HTTP status codes faef983
@capflam capflam Fix SSL socket wrapping
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.
ba34c61
@vinoski vinoski document 127.0.0.1 as the default listen interface
Fix the yaws.conf man page to state that 127.0.0.1 is the default listen
interface for a virtual server. Also document the same in the yaws.tex
file.
f6ba7ca
@vinoski vinoski some man page cleanup/repair 1e7a122
@saleyn saleyn Added RFC6265 compliant variant of setcookie.
The new set_cookie/3 function implements more complete RFC2109
cookie formatting than setcookie/6 and is 10x - 15x more efficient
than its old setcookie counterpart because of avoiding the use of
io_lib:format/2.  The setcookie/2 through setcookie/6 are marked
as deprecated.  The function is named set_cookie rather than setcookie
to facilitate the ease of depricating the old implementation.
00c152b
@saleyn saleyn Added test cases. 6abc02a
@saleyn saleyn Added more test cases. 5b7c019
@klacke klacke Merge pull request #127 from saleyn/set_cookie
Added RFC6265 compliant variant of yaws_api:set_cookie/3.
1615f7d
@vinoski vinoski add a configurable dispatch module
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
atoms:

* 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
  connection

* 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
75dbb60
@imtal imtal Added sorting of subconfigdir e662e51
@imtal imtal Follow structure of EHTML as stated in manual 00aa12d
@vinoski vinoski WebDAV compliancy rework (Tjeerd van der Laan)
The WebDAV support is reworked and adds class 1, 2 and 3 compliancy
which includes:

* XML request body parsing and  multistatus responses

* PROPFIND and PROPPATCH methods returning properties asked for

* all RFC4918 properties, the Apache executable property plus some
  Microsoft extensions

* locking mechanism (class 2 compliancy) on all destructive methods

* If header parsing
efa9eff
Steve Vinoski add missing make rule for davconf 039c300
@klacke klacke news e3c1631
@klacke klacke Merge branch 'master' of github.com:klacke/yaws 128b002
@vinoski vinoski more WebDAV fixes (lyk0rian) 3c36e2a
@klacke klacke Merge branch 'master' of github.com:klacke/yaws b731873
@klacke klacke The --heart option didn't work as expected when yaws ran out of filed…
…escriptors - capflam
0da0628
@klacke klacke prepare for 1.95 589b535
@klacke klacke make error reports for stats:sent() go away nd be ignored 1939b38
@capflam capflam Handle relative paths when Yaws is started in embedded mode
Now, following functions will throw an error if the docroot
directory does not exist:

  * yaws_api:embedded_start_conf/1,2,3,4
  * yaws:start_embedded/1,2,3,4
  * yaws:add_server/2
  * yaws:create_sconf/2
b3bc43c
@vinoski vinoski add comment to websocket example explaining {origin, any} fb4df1f
@vinoski vinoski keep websocket errors from crashing gen_server
Change websocket implementation to not stop abnormally or crash with noisy
logs if errors occur.
2a131ff
@vinoski vinoski fix call to file:read_file_info/1 in yaws_dav 06a2b0e
@vinoski vinoski fix dialyzer issue in yaws_dav and update known_dialyzer_warnings 0f41b7b
@vinoski vinoski ensure compatibility with Erlang R13B04
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.
954ccb1
@leg0 leg0 Fix bug #128 and add a new test case for it 0281736
@vinoski vinoski adjust line numbers in known_dialyzer_warnings file f496811
@vinoski vinoski add Ahti Legonkov to contributors file 7e5e673
@vinoski vinoski start crypto app for yaws_session_server_test for R13 b416f25
@capflam capflam Fix doc errors a8077fd
@capflam capflam Remove invalid macro in yaws.hrl
?sc_set_ssl is never used and rely on the undefined macro ?SC_SSL.
cda2a27
@klacke klacke handle case with DOS attack towards pam login with embedded NUL chars…
… in username or password. The protocol cannot handle NUL chars and Yaws dies
05be6e6
@capflam capflam Extend syntax of redirect block to allow an optional status code
Now, it is possible to change the HTTP status code used in redirect rules.
Supported formats are:

   Path = URL
   Path = code
   Path = code URL

* '==' syntax instead of '=' is always valid.
* If no status code is defined, Yaws will perform a 302 redirect.
* For 3xx status codes, the URL parameter must be present and will be used
  to build the new location.
* For other status codes (1xx, 2xx, 4xx and 5xx), it can be omitted. In the
  absence of URL, Yaws will return a generic response with the specified
  status code. Otherwise, the URL parameter must be a relative URL and will
  be used to customize the response.

For example:

  <redirect>
    /foo = http://yaws.hyber.org  # (1)
    /bar = 301 /foo               # (2)
    /baz = 404                    # (3)
    /qux = 403 /forbidden.yaws    # (4)
  </redirect>

(1) do a 302 redirect on 'http://yaws.hyber.org/foo/...';
(2) do a 301 redirect on 'scheme:host:port/bar/...'
(3) return a generic 404 error
(4) do a reentrant call to '/forbidden.yaws' by setting the status code
    to 403.

Note: this new feature is fully compatible with older one.
26e7ed2
@capflam capflam Take care to preserve the query-string in yaws_server:deliver_302/4
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.
0f6226d
@vinoski vinoski skip sslaccept_tout_test for R15B03
An SSL bug introduced in R15B03 makes the sslaccept_tout_test fail. The bug
is explained here:

http://erlang.org/pipermail/erlang-bugs/2012-November/003208.html
http://erlang.org/pipermail/erlang-bugs/2012-November/003209.html

Check the Erlang version and skip that test for R15B03.
dc424c8
@rambocoder

Imho its better to wait for otp patch otherwise using ssl introduces a denial of service vulnerability due to a bug in r15b3. This regression bug was introduced to otp when another ssl bug was being fixed: lots of sockets in time_wait state due to ssl connections not closing properly. I bet ya the otp team will pull the current release and patch it before rereleasing, at least I hope they will.

I know why the bug occurred in OTP. My patch only disables a single test so that regular Yaws development can continue as usual, the alternative being that collaborators and contributors simply avoid running the tests due to the known failure. I've already sent a warning about the SSL problem to the Yaws mailing list, and regardless, not including this patch in the code base is pretty unlikely to keep someone who really wants to run Yaws on R15B03 from doing so. If the OTP team does issue a new release quickly, then I'll simply undo this patch just as quickly.

capflam and others added some commits
@capflam capflam Fix compilation of mime_types.erl when working directory is not 'yaws'
When mime_types.erl is generated, we must check if it is done during a Yaws
compilation or a Yaws startup. In the first case, we must use a relative
path for includes. Else include_lib must be used.
This issue was reported by Andrei Zavada and avoid a compile error when the
working directory is not 'yaws'.

The mechanisms to generate and compile this file have also changed.

Then, to centralize calls to yaws_generated:is_local_install/0, following
functions was added in yaws.erl:
  get_app_dir/0, get_src_dir/0, get_ebin_dir/0, get_priv_dir/0, get_inc_dir/0
7061375
@olgeni olgeni Fix io:format call in yaws_compile.
Basically, yaws_compile was unable to process items in some "unlucky"
paths on Win32.

NTFS may generate filenames in an MS-DOS compatible format if the
original filename is not compatible with the legacy 8.3 notation;
these filenames often contain tilde characters, which are inserted
(unquoted) in the Format parameter of io:format by the string
concatenation.

These unquoted tilde characters are processed as usual, leading to
a badarg error as the Data parameter is always an empty list.
1cf4eeb
@capflam capflam Merge pull request #133 from olgeni/tilde_injection_fix
Fix io:format call in yaws_compile.
25b8e4c
@weisslj weisslj Support multipart/form-data "name" with backslash at the end.
Also add multipart/form-data tests ("name" with escaped characters).
ebe66b6
@capflam capflam Make be possible to chain appmods
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"}.
bb5124b
@capflam capflam Add a clause to yaws_api:url_encode to handle deep lists 0a2e565
@capflam capflam Keep info about the original request during a reentrant call
Some information must be preserved during a reentrant call. From the original
request, we keep:
  * buffered data (Arg#arg.clidata) and the number of bytes read
  * the request state (Arg#arg.cont & Arg#arg.state)
e7740bc
@capflam capflam Fix a bug: redirect URL must be url-encoded 4fed987
@capflam capflam Flush remaining data in case of 3xx redirect
When Yaws returns a 3xx response, if the client connection is kept alive,
the remaining data must be flushed. Else the next request on the same
connection cannot be handled.
f5343a3
@capflam capflam Update docs & testsuite accordingly fdc06fd
@capflam capflam Fix when 'Expires' and 'Cache-Control' headers are set
Because the content-type of the response may change many times during the
request handling process, we must wait the #outh{} serialization to set it.

Note: 'Last-modified' header is also managed in a same way because there is
no good reason to set it before.
89f3ea2
@capflam capflam Fix checks on the response content type when a charset is present
When we test if a response is compressible or not, or when 'Expires' and
'Cache-Control' headers are set, the charset must be removed from the
response content-type to only keep the response mime-type.
f5f62b6
@capflam capflam Add support of the 'Vary' header in response
With this patch, Yaws will add 'Accept-Encoding' in 'Vary' header if the
support of gzip compression is enabled or if the response is compressed.
The 'Vary' header can be set using 'yaws:outh_set_vary(Fields)' or by
returning '{header, {vary, Fields}}' from scripts (where Fields is a list
of header names).
d748f92
@capflam capflam Add support for deactivation of cache in reentrant calls 7da7481
@capflam capflam Add access functions for #gconf{} and #sconf{} records
Applications may want to retrieve information in it. yaws:gconf_*/1 and
yaws:sconf_*/1 should be used in preference to a direct access to reduce
the dependence of your code on these records. So internal modifications
could be done avoiding the need to update and recompile your application.

Update www/internals.yaws accordingly and remove dependency on 'yaws.hrl'
in examples and applications. Add unit tests to check #gconf{} and #sconf{}
setup.
48c0510
@capflam capflam Adjust line numbers in known_dialyzer_warnings file c341c31
@capflam capflam Refactor WebSockets and add support of optional callback functions
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
messages:

  * 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
functions.
                                 - * -
*** 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
supported:

  * {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

--
[1] http://autobahn.ws/testsuite
[2] #99
[3] https://github.com/pvieytes
29a7989
@capflam capflam Fix typo in documentation 9975e7b
@klacke klacke spelling err a7acf19
@vinoski vinoski fix R16B dialyzer issue 6015755
@vinoski vinoski fix deprecated make_default_sconf/0 to return sconf, not gconf 1ec97b0
@vinoski vinoski fix issue #140 729b1e4
@vinoski vinoski fix overflowing line in yaws.tex 80b5767
@vinoski vinoski add yaws_api:merge_header/2 and yaws_api:merge_header/3 funs
The merge_header functions allow HTTP headers and their values to be set
and combined in a #headers{} record.
bead34b
@klacke klacke Slightly better error messages on failed startup 9acc88e
@klacke klacke preparing for yaws 1.96 19ad254
@vinoski vinoski add documentation of exhtml directive to yaws.tex (by tjeerd) b6b38a6
@vinoski vinoski Move WebDAV to an appmod, the locking server to a runmod (tjeerd)
All WebDAV functionality is moved to an appmod so the extension methods and
additional response headers are not part of yaws_server.erl and yaws.erl
anymore. Also the locking server is now a runmod so it is not started by
the supervisor and can be used only when needed.

Additionally the 100-Continue code is moved so it can be returned to all
requests that contain a body.

The WebDAV functionality is tested against the litmus test. All tests are
passed, except the ones that require unsupported properties. The test shows
this as a fail while returning 404 should be sufficient.
a6706eb
@marutha marutha merged commit a588db9 into marutha:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 29, 2012
  1. @vinoski
  2. @vinoski
Commits on Jul 4, 2012
  1. @capflam

    Fix parse_set_cookie/1 and format_set_cookie/1 functions

    capflam authored
    1. According to the RFCs 2109 and 2965, multiple cookies can be set in a
    single 'Set-Cookie' header. So, yaws_api:parse_set_cookie/1 now returns a
    list of #setcookie{} records. If no cookie was found or if an error occurred,
    it returns []. The parsing is also improved.
    Note that this fix breaks the compatibility with previous versions.
    
    2. In yaws_api:format_set_cookie/1, options are now always formated as
    quoted-strings.
    
    3. 2 new functions are added, yaws_api:parse_cookie/1 and
    yaws_api:format_cookie/1, to parse and format 'Cookie' headers. To let these
    functions to work, the #cookie{} record was introduced.
    
    Documentation and testsuite are updated accordingly.
Commits on Jul 6, 2012
  1. @kdcircle

    -fixed action header for soap12 requests to contain action rather tha…

    kdcircle authored
    …n operation;
    
    -added namespace registry to allow for wsdl inline schemas in different namespaces
  2. @tuncer
  3. @vinoski

    Merge pull request #113 from tuncer/reltool-update

    vinoski authored
    Sync with upstream rebar node template
  4. @vinoski

    minor changes to server-sent events

    vinoski authored
    Change yaws_sse to send close connection header by default, and change the
    example to return an Allow header if anything other than GET is requested.
Commits on Jul 9, 2012
  1. @kdcircle
  2. @kdcircle
  3. @kdcircle
Commits on Jul 10, 2012
  1. @capflam

    Refactor Set-Cookie/Cookie header parsing to follow RFC6265

    capflam authored
    RFC6265 obsoletes RFC2965 and RFC2109. #setcookie{} and #cookie{} are
    changed to reflect this new RFC. So, yaws_api:parse_set_cookie/1 and
    yaws_api:parse_cookie/1 are refactored accordingly:
    
    * yaws_api:parse_set_cookie/1: Because RFC2109 and RFC2965 are still used,
      we try to be backward compatible with these old RFCs. So this function
      returns a #setcookie{} record when only one cookie is found else it returns
      a list of #setcookie{} records.
      in RFC2109 and RFC2965, cookies are separated by comma. So, comma is
      forbidden in 'path-av' and 'extension-av' except for double-quoted value.
      The parsing are not really strict because of the compatibility and can lead
      to unwanted behaviors.
      Old attributes (like 'Comment' or 'Port') are still parsed and can be
      found into #setcookie.extensions field.
    
    * yaws_api:parse_cookie/1: This function follows the RFC6265, so all cookie
      attributes (like '$Domain' or '$Path') are parsed like any other cookie.
  2. @capflam
  3. @vinoski

    wrap SSL sockets in tuple

    vinoski authored
    Yaws previously internally used details of an SSL socket representation
    that's supposed to be private/opaque to Erlang's SSL support. Encapsulate
    SSL sockets within a {ssl, SslSocket} tuple and add the
    yaws_api:get_sslsocket/1 function that returns a socket for SSL sockets or
    undefined for non-SSL sockets. Also document the new get_sslsocket/1
    function and other minor tweaks to SSL areas of the documentation.
  4. @vinoski

    minor changes to server-sent events

    vinoski authored
    Change yaws_sse to send close connection header by default, and change the
    example to return an Allow header if anything other than GET is requested.
Commits on Jul 11, 2012
  1. @capflam

    Add index_files directive into the server part configuration

    capflam 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 Jul 12, 2012
  1. @vinoski
Commits on Jul 13, 2012
  1. @klacke

    Merge pull request #116 from sumup/feature/soap12_imports_namespaces

    klacke authored
    Feature/soap12 imports namespaces
  2. @tuncer
Commits on Jul 14, 2012
  1. @vinoski

    Merge pull request #117 from tuncer/noderunner

    vinoski authored
    Sync rel/files/yaws with upstream template
Commits on Jul 24, 2012
  1. @capflam
Commits on Jul 25, 2012
  1. @capflam

    Make the mime types mappings configurable

    capflam authored capflam committed
    Now, it possible to customize the global mime types mappings and to overload
    it for each virtual server. It can be done using following directives in the
    global part or the server part of the configuration:
    
    * default_type: Defines the default mime type to be used where Yaws cannot
      determine it by its mime types mappings (default: text/plain).
      In the server part, this directive overloads the global one.
    
    * default_charset: Defines the default charset to be added when a response
      content-type is text/* (default: none). In the server part, this directive
      overloads the global one.
    
    * mime_types_file: Overrides the default mime.types file included with Yaws
      (default: ${PREFIX}/lib/yaws/priv/mime.types). In the server part, this
      directive overloads the global one but mappings defined in this file will
      not overload those defined by add_types directives in the global part.
    
    * add_types: Specifies one or more mappings between mime types and file
      extensions. More than one extension can be assigned to a mime type. If a
      mapping is defined in the global part and redefined in a server part using
      this directive, then the later is used. Else the global one is kept.
    
    * add_charsets: Specifies one or more mappings between charsets and file
      extensions. More than one extension can be assigned to a charset. If a
      mapping is defined in the global part and redefined in a server part using
      this directive, then the later is used. Else the global one is kept.
    
    Here is an example:
    
      default_type = text/html
    
      <server localhost>
          port = 8000
          listen = 0.0.0.0
          docroot = /var/www
          # nothing is overloaded in the vhost
      </server>
    
      <server localhost>
          port = 8001
          listen = 0.0.0.0
          docroot = /var/www
    
          # overload global configuration:
          default_type    = text/plain
          mime_types_file = /etc/mime.types
          add_types       = <text/xhtml, yaws> <application/x-test, tst test>
          default_charset = UTF-8
          add_charsets    = <ISO-8859-1, php html yaws> <US-ASCII, tst>
      </server>
    
    During Yaws compilation, a default module 'mime_types' is created using the
    default mime.types file. Then, when yaws starts up, this module is
    re-generated, re-compiled and loaded dynamically. The new module replaces the
    default one but the .beam file is unchanged. So if one of these steps failed,
    we fall back on the default module.
Commits on Jul 26, 2012
  1. @capflam
  2. @capflam

    Improve how Yaws is started in embedded mode

    capflam authored
    The main change concerns the function yaws:create_sconf/2. Now, this function
    relies on yaws_config:make_default_sconf/2 to create a default #sconf record.
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 Aug 6, 2012
  1. @vinoski
Commits on Aug 7, 2012
  1. @vinoski
  2. @vinoski

    Merge pull request #121 from jbothma/master

    vinoski authored
    Add basic websocket test.
Commits on Aug 22, 2012
  1. @vinoski

    add flexible variant of yaws_api:reformat_header

    vinoski authored
    Add a new yaws_api:reformat_header/2 that takes a formatting function as
    the second argument. The old reformat_header/1 now just calls this, passing
    the original formatting function.
Commits on Aug 23, 2012
  1. @vinoski
Commits on Aug 24, 2012
  1. @vinoski

    make sure more modules are included in a release (issue #122)

    vinoski authored
    The problem that caused issue #122 is that the yaws_outmod module, which
    isn't directly referenced by any other yaws module, was not being included
    in the application release. Change the mod_cond in rel/reltool.config to
    all rather than app to ensure yaws_outmod gets included.
  2. @vinoski

    revert commit d990b30

    vinoski authored
    Commit d990b30 was intended to fix issue #122 but my testing was flawed, so
    I'm reverting it. The real issue seems to be a bug with reltool not
    honoring app overrides of sys-level mod_cond settings.
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
    rebar.
    
    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 Aug 26, 2012
  1. @vinoski

    add startup script for FreeBSD 9 (Thomas Elsgaard)

    vinoski authored
    Add scripts/freebsd/yaws for FreeBSD version 9 or later. The original
    script at scripts/freebsd/yaws.sh is retained for use with FreeBSD versions
    prior to 9.
Commits on Sep 1, 2012
  1. @vinoski

    update mime.types file

    vinoski authored
Commits on Sep 8, 2012
  1. @jj1bdx

    Update Makefile and src/Makefile

    jj1bdx authored
    * Targets in `Makefile` of `yaws.plt` and `dialyzer` calls
      dialyzer with two target directories, `ebin` and `src`;
      this causes the error of duplicate modules.
      Checking out the .beam files under `ebin` is sufficient
      for dialyzer; `src` is removed.
    
    * Target `mime_type_c.beam` in `src/Makefile` is
      superfluous and generates a spurious .beam file in
      the `src` directory, so the target is removed.
      Also target `charset.def` in `src/Makefile` should be
      dependent on `../ebin/mime_type_c.beam`, so this is
      also changed from the previous target without the
      directory path.
  2. @klacke

    Merge pull request #124 from jj1bdx/jj1bdx-dialyzer-fix

    klacke authored
    Update Makefile and src/Makefile
Commits on Sep 9, 2012
  1. @vinoski
Commits on Sep 10, 2012
  1. @klacke

    Added support to configure ciphers in ssl, previously the ciphers = V…

    klacke authored
    …al stricng in yaws.conf required the Val to be a string according the openssl cipher string spec language. Now we specify an erlang list instead, the list shall comply to the output of ssl:cipher_suites()
  2. @klacke
Commits on Sep 18, 2012
  1. @capflam

    Optimize the ACL checks during the request's authentication

    capflam authored
    Now, in yaws_server:handle_auth/4, the client ip is no more converted into
    integer. All ip addresses in #auth.acl are of the type ip_address(). That makes
    easier the checking of the client ip.
    To clean up the code, functions that parses and checks the allowed/denied ip
    addresses with the client ip were moved into yaws.erl.
  2. @capflam
  3. @capflam

    Parse extensions and trailing headers of chunked transfer encoded req…

    capflam authored
    …uests
    
    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
    subject.
  4. @capflam
Commits on Oct 1, 2012
  1. @vinoski
Commits on Oct 2, 2012
  1. @capflam @vinoski

    Fix SSL socket wrapping

    capflam 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 Oct 4, 2012
  1. @vinoski

    document 127.0.0.1 as the default listen interface

    vinoski authored
    Fix the yaws.conf man page to state that 127.0.0.1 is the default listen
    interface for a virtual server. Also document the same in the yaws.tex
    file.
  2. @vinoski

    some man page cleanup/repair

    vinoski authored
Commits on Oct 6, 2012
  1. @saleyn

    Added RFC6265 compliant variant of setcookie.

    saleyn authored
    The new set_cookie/3 function implements more complete RFC2109
    cookie formatting than setcookie/6 and is 10x - 15x more efficient
    than its old setcookie counterpart because of avoiding the use of
    io_lib:format/2.  The setcookie/2 through setcookie/6 are marked
    as deprecated.  The function is named set_cookie rather than setcookie
    to facilitate the ease of depricating the old implementation.
  2. @saleyn

    Added test cases.

    saleyn authored
  3. @saleyn

    Added more test cases.

    saleyn authored
Commits on Oct 7, 2012
  1. @klacke

    Merge pull request #127 from saleyn/set_cookie

    klacke authored
    Added RFC6265 compliant variant of yaws_api:set_cookie/3.
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
    atoms:
    
    * 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
      connection
    
    * 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 13, 2012
  1. @imtal @vinoski

    Added sorting of subconfigdir

    imtal authored vinoski committed
  2. @imtal @vinoski

    Follow structure of EHTML as stated in manual

    imtal authored vinoski committed
  3. @vinoski

    WebDAV compliancy rework (Tjeerd van der Laan)

    vinoski authored
    The WebDAV support is reworked and adds class 1, 2 and 3 compliancy
    which includes:
    
    * XML request body parsing and  multistatus responses
    
    * PROPFIND and PROPPATCH methods returning properties asked for
    
    * all RFC4918 properties, the Apache executable property plus some
      Microsoft extensions
    
    * locking mechanism (class 2 compliancy) on all destructive methods
    
    * If header parsing
Commits on Oct 14, 2012
  1. add missing make rule for davconf

    Steve Vinoski authored
Commits on Oct 15, 2012
  1. @klacke

    news

    klacke authored
  2. @klacke
Commits on Oct 17, 2012
  1. @vinoski

    more WebDAV fixes (lyk0rian)

    vinoski authored
  2. @klacke
  3. @klacke
  4. @klacke

    prepare for 1.95

    klacke authored
  5. @klacke
Commits on Oct 19, 2012
  1. @capflam

    Handle relative paths when Yaws is started in embedded mode

    capflam authored
    Now, following functions will throw an error if the docroot
    directory does not exist:
    
      * yaws_api:embedded_start_conf/1,2,3,4
      * yaws:start_embedded/1,2,3,4
      * yaws:add_server/2
      * yaws:create_sconf/2
Commits on Oct 22, 2012
  1. @vinoski
  2. @vinoski

    keep websocket errors from crashing gen_server

    vinoski authored
    Change websocket implementation to not stop abnormally or crash with noisy
    logs if errors occur.
Commits on Oct 23, 2012
  1. @vinoski
  2. @vinoski
  3. @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.
  4. @leg0 @vinoski

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

    leg0 authored vinoski committed
  5. @vinoski
  6. @vinoski
Commits on Oct 24, 2012
  1. @vinoski
Commits on Nov 9, 2012
  1. @capflam

    Fix doc errors

    capflam authored
  2. @capflam

    Remove invalid macro in yaws.hrl

    capflam authored
    ?sc_set_ssl is never used and rely on the undefined macro ?SC_SSL.
  3. @klacke

    handle case with DOS attack towards pam login with embedded NUL chars…

    klacke authored
    … in username or password. The protocol cannot handle NUL chars and Yaws dies
Commits on Nov 15, 2012
  1. @capflam @vinoski

    Extend syntax of redirect block to allow an optional status code

    capflam authored vinoski committed
    Now, it is possible to change the HTTP status code used in redirect rules.
    Supported formats are:
    
       Path = URL
       Path = code
       Path = code URL
    
    * '==' syntax instead of '=' is always valid.
    * If no status code is defined, Yaws will perform a 302 redirect.
    * For 3xx status codes, the URL parameter must be present and will be used
      to build the new location.
    * For other status codes (1xx, 2xx, 4xx and 5xx), it can be omitted. In the
      absence of URL, Yaws will return a generic response with the specified
      status code. Otherwise, the URL parameter must be a relative URL and will
      be used to customize the response.
    
    For example:
    
      <redirect>
        /foo = http://yaws.hyber.org  # (1)
        /bar = 301 /foo               # (2)
        /baz = 404                    # (3)
        /qux = 403 /forbidden.yaws    # (4)
      </redirect>
    
    (1) do a 302 redirect on 'http://yaws.hyber.org/foo/...';
    (2) do a 301 redirect on 'scheme:host:port/bar/...'
    (3) return a generic 404 error
    (4) do a reentrant call to '/forbidden.yaws' by setting the status code
        to 403.
    
    Note: this new feature is fully compatible with older one.
Commits on Nov 20, 2012
  1. @capflam

    Take care to preserve the query-string in yaws_server:deliver_302/4

    capflam 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 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:
    
    http://erlang.org/pipermail/erlang-bugs/2012-November/003208.html
    http://erlang.org/pipermail/erlang-bugs/2012-November/003209.html
    
    Check the Erlang version and skip that test for R15B03.
Commits on Nov 29, 2012
  1. @capflam

    Fix compilation of mime_types.erl when working directory is not 'yaws'

    capflam authored
    When mime_types.erl is generated, we must check if it is done during a Yaws
    compilation or a Yaws startup. In the first case, we must use a relative
    path for includes. Else include_lib must be used.
    This issue was reported by Andrei Zavada and avoid a compile error when the
    working directory is not 'yaws'.
    
    The mechanisms to generate and compile this file have also changed.
    
    Then, to centralize calls to yaws_generated:is_local_install/0, following
    functions was added in yaws.erl:
      get_app_dir/0, get_src_dir/0, get_ebin_dir/0, get_priv_dir/0, get_inc_dir/0
  2. @olgeni

    Fix io:format call in yaws_compile.

    olgeni authored
    Basically, yaws_compile was unable to process items in some "unlucky"
    paths on Win32.
    
    NTFS may generate filenames in an MS-DOS compatible format if the
    original filename is not compatible with the legacy 8.3 notation;
    these filenames often contain tilde characters, which are inserted
    (unquoted) in the Format parameter of io:format by the string
    concatenation.
    
    These unquoted tilde characters are processed as usual, leading to
    a badarg error as the Data parameter is always an empty list.
  3. @capflam

    Merge pull request #133 from olgeni/tilde_injection_fix

    capflam authored
    Fix io:format call in yaws_compile.
Commits on Dec 1, 2012
  1. @weisslj @vinoski

    Support multipart/form-data "name" with backslash at the end.

    weisslj authored vinoski committed
    Also add multipart/form-data tests ("name" with escaped characters).
Commits on Jan 3, 2013
  1. @capflam

    Make be possible to chain appmods

    capflam 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"}.
  2. @capflam
  3. @capflam

    Keep info about the original request during a reentrant call

    capflam authored
    Some information must be preserved during a reentrant call. From the original
    request, we keep:
      * buffered data (Arg#arg.clidata) and the number of bytes read
      * the request state (Arg#arg.cont & Arg#arg.state)
  4. @capflam
  5. @capflam

    Flush remaining data in case of 3xx redirect

    capflam authored
    When Yaws returns a 3xx response, if the client connection is kept alive,
    the remaining data must be flushed. Else the next request on the same
    connection cannot be handled.
  6. @capflam
  7. @capflam

    Fix when 'Expires' and 'Cache-Control' headers are set

    capflam authored
    Because the content-type of the response may change many times during the
    request handling process, we must wait the #outh{} serialization to set it.
    
    Note: 'Last-modified' header is also managed in a same way because there is
    no good reason to set it before.
  8. @capflam

    Fix checks on the response content type when a charset is present

    capflam authored
    When we test if a response is compressible or not, or when 'Expires' and
    'Cache-Control' headers are set, the charset must be removed from the
    response content-type to only keep the response mime-type.
  9. @capflam

    Add support of the 'Vary' header in response

    capflam authored
    With this patch, Yaws will add 'Accept-Encoding' in 'Vary' header if the
    support of gzip compression is enabled or if the response is compressed.
    The 'Vary' header can be set using 'yaws:outh_set_vary(Fields)' or by
    returning '{header, {vary, Fields}}' from scripts (where Fields is a list
    of header names).
  10. @capflam
  11. @capflam

    Add access functions for #gconf{} and #sconf{} records

    capflam authored
    Applications may want to retrieve information in it. yaws:gconf_*/1 and
    yaws:sconf_*/1 should be used in preference to a direct access to reduce
    the dependence of your code on these records. So internal modifications
    could be done avoiding the need to update and recompile your application.
    
    Update www/internals.yaws accordingly and remove dependency on 'yaws.hrl'
    in examples and applications. Add unit tests to check #gconf{} and #sconf{}
    setup.
  12. @capflam
Commits on Feb 11, 2013
  1. @capflam

    Refactor WebSockets and add support of optional callback functions

    capflam 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
    messages:
    
      * 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
    functions.
                                     - * -
    *** 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
    supported:
    
      * {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
    
    --
    [1] http://autobahn.ws/testsuite
    [2] #99
    [3] https://github.com/pvieytes
Commits on Feb 12, 2013
  1. @capflam

    Fix typo in documentation

    capflam authored
Commits on Feb 15, 2013
  1. @klacke

    spelling err

    klacke authored
Commits on Feb 27, 2013
  1. @vinoski

    fix R16B dialyzer issue

    vinoski authored
Commits on Mar 3, 2013
  1. @vinoski
Commits on Mar 8, 2013
  1. @vinoski

    fix issue #140

    vinoski authored
  2. @vinoski
Commits on Mar 15, 2013
  1. @vinoski

    add yaws_api:merge_header/2 and yaws_api:merge_header/3 funs

    vinoski authored
    The merge_header functions allow HTTP headers and their values to be set
    and combined in a #headers{} record.
Commits on Mar 19, 2013
  1. @klacke
  2. @klacke

    preparing for yaws 1.96

    klacke authored
Commits on Mar 25, 2013
  1. @vinoski
  2. @vinoski

    Move WebDAV to an appmod, the locking server to a runmod (tjeerd)

    vinoski authored
    All WebDAV functionality is moved to an appmod so the extension methods and
    additional response headers are not part of yaws_server.erl and yaws.erl
    anymore. Also the locking server is now a runmod so it is not started by
    the supervisor and can be used only when needed.
    
    Additionally the 100-Continue code is moved so it can be returned to all
    requests that contain a body.
    
    The WebDAV functionality is tested against the litmus test. All tests are
    passed, except the ones that require unsupported properties. The test shows
    this as a fail while returning 404 should be sufficient.
Something went wrong with that request. Please try again.