1 module hunt.http.server.Http1ServerTunnelConnection;
2 
3 import hunt.http.codec.http.model.HttpVersion;
4 import hunt.http.codec.http.stream.AbstractHttpConnection;
5 import hunt.http.codec.http.stream.HttpTunnelConnection;
6 
7 import hunt.net.ConnectionType;
8 import hunt.net.secure.SecureSession;
9 import hunt.net.Session;
10 // import hunt.net.buffer.FileRegion;
11 
12 import hunt.lang.common;
13 import hunt.util.functional;
14 
15 import hunt.container.ByteBuffer;
16 import hunt.container.Collection;
17 
18 /**
19  * 
20  */
21 class Http1ServerTunnelConnection : AbstractHttpConnection , HttpTunnelConnection {
22 
23     Action1!ByteBuffer content;
24 
25     this(SecureSession secureSession, TcpSession tcpSession, HttpVersion httpVersion) {
26         super(secureSession, tcpSession, httpVersion);
27     }
28 
29     override
30     void write(ByteBuffer byteBuffer, Callback callback) {
31         tcpSession.write(byteBuffer, callback);
32     }
33 
34     override
35     void write(ByteBuffer[] buffers, Callback callback) {
36         tcpSession.write(buffers, callback);
37     }
38 
39     override
40     void write(Collection!ByteBuffer buffers, Callback callback) {
41         tcpSession.write(buffers, callback);
42     }
43 
44     // override
45     // void write(FileRegion file, Callback callback) {
46     //     tcpSession.write(file, callback);
47     // }
48 
49     override
50     void receive(Action1!ByteBuffer content) {
51         this.content = content;
52     }
53 
54     // override
55     ConnectionType getConnectionType() {
56         return ConnectionType.HTTP_TUNNEL;
57     }
58 }