1 // 2 // ======================================================================== 3 // Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd. 4 // ------------------------------------------------------------------------ 5 // All rights reserved. This program and the accompanying materials 6 // are made available under the terms of the Eclipse Public License v1.0 7 // and Apache License v2.0 which accompanies this distribution. 8 // 9 // The Eclipse Public License is available at 10 // http://www.eclipse.org/legal/epl-v10.html 11 // 12 // The Apache License v2.0 is available at 13 // http://www.opensource.org/licenses/apache2.0.php 14 // 15 // You may elect to redistribute this code under either of these licenses. 16 // ======================================================================== 17 // 18 19 module hunt.http.codec.http.model.HttpScheme; 20 21 // import hunt.container.ByteBuffer; 22 23 // import hunt.http.utils.collection.ArrayTrie; 24 // import hunt.http.utils.collection.Trie; 25 // import hunt.container.BufferUtils; 26 import hunt.util.traits; 27 28 struct HttpScheme { 29 enum HTTP = "http"; 30 enum HTTPS = "https"; 31 enum WS = "ws"; 32 enum WSS = "wss"; 33 34 __gshared string[] CACHE; 35 36 shared static this() { 37 // for (HttpScheme version : HttpScheme.values()) 38 // CACHE.insert(version.asString(), version); 39 CACHE ~= HTTP; 40 CACHE ~= HTTPS; 41 CACHE ~= WS; 42 CACHE ~= WSS; 43 } 44 45 // private string _string; 46 // private ByteBuffer buffer; 47 48 // this(string s) { 49 // _string = s; 50 // buffer = BufferUtils.toBuffer(s); 51 // } 52 53 // mixin GetEnumValues!(HttpScheme); 54 55 // ByteBuffer asByteBuffer() { 56 // return buffer.asReadOnlyBuffer(); 57 // } 58 59 // bool isSame(string s) { 60 // return s != null && std.string.icmp(_string, s) == 0; 61 // } 62 63 // string asString() { return _string; } 64 65 // override 66 // string toString() { 67 // return _string; 68 // } 69 70 }