]>
Commit | Line | Data |
---|---|---|
bac41a7b A |
1 | /* |
2 | * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved. | |
3 | * | |
4 | * The contents of this file constitute Original Code as defined in and are | |
5 | * subject to the Apple Public Source License Version 1.2 (the 'License'). | |
6 | * You may not use this file except in compliance with the License. Please obtain | |
7 | * a copy of the License at http://www.apple.com/publicsource and read it before | |
8 | * using this file. | |
9 | * | |
10 | * This Original Code and all software distributed under the License are | |
11 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS | |
12 | * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT | |
13 | * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | |
14 | * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the | |
15 | * specific language governing rights and limitations under the License. | |
16 | */ | |
17 | ||
18 | ||
19 | // | |
20 | // https-proxy - CONNECT style transparent proxy connection to SSL host | |
21 | // | |
22 | #ifndef _H_HTTPS_PROXY_PROTOCOL | |
23 | #define _H_HTTPS_PROXY_PROTOCOL | |
24 | ||
25 | #include "https-protocol.h" | |
26 | ||
27 | ||
28 | namespace Security { | |
29 | namespace Network { | |
30 | ||
31 | ||
32 | // | |
33 | // The CONNECT protocol is a subclass of the secure (SSL) HTTP protocol. | |
34 | // | |
35 | class ConnectHTTPProtocol : public SecureHTTPProtocol { | |
36 | class ConnectHTTPTransfer; | |
37 | public: | |
38 | ConnectHTTPProtocol(Manager &mgr, const HostTarget &proxy); | |
39 | ||
40 | public: | |
41 | ConnectHTTPTransfer *makeTransfer(const Target &target, Operation operation); | |
42 | ||
43 | private: | |
44 | // | |
45 | // Our persistent connection object | |
46 | // | |
47 | class ConnectHTTPConnection : public SecureHTTPConnection { | |
48 | public: | |
49 | ConnectHTTPConnection(Protocol &proto, const HostTarget &tgt); | |
50 | ~ConnectHTTPConnection(); | |
51 | ||
52 | enum { | |
53 | connectConnecting, // TCP layer connecting pending | |
54 | connectStartup, // starting conversation | |
55 | connectPrimaryResponse, // sent CONNECT, waiting for primary response | |
56 | connectReadHeaders, // reading proxy headers | |
57 | connectReady // in transparent mode | |
58 | } connectState; | |
59 | ||
60 | void connectRequest(); | |
61 | ||
62 | protected: | |
63 | void transit(Event event, char *input, size_t inputLength); | |
64 | }; | |
65 | ||
66 | ||
67 | // | |
68 | // A generic Transfer object. All HTTP transfers are transactional (headers in, optional data in, | |
69 | // headers out, optional data out), so there's no reason to distinguish subclasses. | |
70 | // | |
71 | class ConnectHTTPTransfer : public SecureHTTPTransfer { | |
72 | public: | |
73 | ConnectHTTPTransfer(Protocol &proto, | |
74 | const Target &tgt, Operation operation, IPPort defaultPort); | |
75 | ||
76 | protected: | |
77 | void start(); | |
78 | ||
79 | bool useProxyHeaders() const; | |
80 | }; | |
81 | ||
82 | public: | |
83 | bool isProxy() const; | |
84 | const HostTarget &proxyHost() const; | |
85 | ||
86 | private: | |
87 | const HostTarget host; | |
88 | }; | |
89 | ||
90 | ||
91 | } // end namespace Network | |
92 | } // end namespace Security | |
93 | ||
94 | ||
95 | #endif //_H_HTTPS_PROXY_PROTOCOL |