Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Commits on Jul 10, 2012
  1. @capflam

    Refactor Set-Cookie/Cookie header parsing to follow RFC6265

    capflam committed
    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.
Commits on Jul 4, 2012
  1. @capflam

    Fix parse_set_cookie/1 and format_set_cookie/1 functions

    capflam committed
    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
    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 May 24, 2011
  1. @capflam @vinoski

    arg_rewrite mods can now return HTTP responses (capflam)

    capflam committed with vinoski
    Module used to rewrite arg records can now return any HTTP
    response. This can be used to redirect requests or to return an
    error. To do so, such a module must set the element #arg.state using
    the record #rewrite_response{}. The record #rewrite_response{}
    contains 3 elements:
      status: any valid HTTP status code
      headers: a list of {header, H}
      content: an iolist
    For example, to do an unconditional redirect to,
    you can use the module simple_redir_mod.erl:
      arg_rewrite(Arg) ->
        L = "",
        H = [{header, {location, L}}],
        RwResp = #rewrite_response{status=301, headers=H}
Something went wrong with that request. Please try again.