1 /******************************************************************************* 2 3 Http Session "Cookie" Structure 4 5 Reference: RFC 2109 6 7 @see http://www.w3.org/Protocols/rfc2109/rfc2109.txt 8 @see http://www.servlets.com/rfcs/rfc2109.html 9 10 Copyright: 11 Copyright (c) 2009-2016 dunnhumby Germany GmbH. 12 All rights reserved. 13 14 License: 15 Boost Software License Version 1.0. See LICENSE_BOOST.txt for details. 16 Alternatively, this file may be distributed under the terms of the Tango 17 3-Clause BSD License (see LICENSE_BSD.txt for details). 18 19 ******************************************************************************/ 20 21 module ocean.net.http.cookie.HttpCookieParser; 22 23 24 import ocean.meta.types.Qualifiers; 25 import ocean.net.util.QueryParams: QueryParamSet; 26 27 version (unittest) import ocean.core.Test; 28 29 /******************************************************************************/ 30 31 class HttpCookieParser : QueryParamSet 32 { 33 this ( in istring[] cookie_names ... ) 34 { 35 super(';', '=', cookie_names); 36 } 37 } 38 39 /******************************************************************************/ 40 41 unittest 42 { 43 static immutable istring cookie_header_value = "test=2649113645; test-value=1383922851"; 44 45 static immutable istring[] cookie_names = 46 [ 47 "test", 48 "test-value" 49 ]; 50 51 scope cookie = new HttpCookieParser(cookie_names); 52 53 cookie.parse(cookie_header_value); 54 55 test (cookie["test"] == "2649113645"); 56 test (cookie["test-value"] == "1383922851"); 57 }