]>
Commit | Line | Data |
---|---|---|
a90939db JF |
1 | /* |
2 | * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions | |
6 | * are met: | |
7 | * 1. Redistributions of source code must retain the above copyright | |
8 | * notice, this list of conditions and the following disclaimer. | |
9 | * 2. Redistributions in binary form must reproduce the above copyright | |
10 | * notice, this list of conditions and the following disclaimer in the | |
11 | * documentation and/or other materials provided with the distribution. | |
12 | * | |
13 | * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | |
14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | |
17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | |
21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
24 | */ | |
25 | ||
26 | #ifndef ResourceHandleInternal_h | |
27 | #define ResourceHandleInternal_h | |
28 | ||
29 | #include "ResourceHandle.h" | |
30 | #include "ResourceRequest.h" | |
31 | #include "AuthenticationChallenge.h" | |
32 | #include "Timer.h" | |
33 | ||
34 | #if USE(CFNETWORK) | |
35 | #include <CFNetwork/CFURLConnectionPriv.h> | |
36 | #endif | |
37 | ||
38 | #if USE(WININET) | |
39 | #include <winsock2.h> | |
40 | #include <windows.h> | |
41 | #endif | |
42 | ||
43 | #if USE(CURL) | |
44 | #include <curl/curl.h> | |
45 | #include "FormDataStreamCurl.h" | |
46 | #endif | |
47 | ||
48 | #if USE(SOUP) | |
49 | #include <libsoup/soup.h> | |
50 | #endif | |
51 | ||
52 | #if PLATFORM(QT) | |
53 | class QWebFrame; | |
54 | class QWebNetworkJob; | |
55 | namespace WebCore { | |
56 | class QNetworkReplyHandler; | |
57 | } | |
58 | #endif | |
59 | ||
60 | #if PLATFORM(MAC) | |
61 | #ifdef __OBJC__ | |
62 | @class NSURLAuthenticationChallenge; | |
63 | @class NSURLConnection; | |
64 | #else | |
65 | class NSURLAuthenticationChallenge; | |
66 | class NSURLConnection; | |
67 | #endif | |
68 | #endif | |
69 | ||
70 | #ifndef __OBJC__ | |
71 | class NSObject; | |
72 | #endif | |
73 | ||
74 | ||
75 | // The allocations and releases in ResourceHandleInternal are | |
76 | // Cocoa-exception-free (either simple Foundation classes or | |
77 | // WebCoreResourceLoaderImp which avoids doing work in dealloc). | |
78 | ||
79 | namespace WebCore { | |
80 | class ResourceHandleClient; | |
81 | ||
82 | class ResourceHandleInternal : Noncopyable { | |
83 | public: | |
84 | ResourceHandleInternal(ResourceHandle* loader, const ResourceRequest& request, ResourceHandleClient* c, bool defersLoading, bool shouldContentSniff, bool mightDownloadFromHandle) | |
85 | : m_client(c) | |
86 | , m_request(request) | |
87 | , status(0) | |
88 | , m_defersLoading(defersLoading) | |
89 | , m_shouldContentSniff(shouldContentSniff) | |
90 | , m_mightDownloadFromHandle(mightDownloadFromHandle) | |
91 | #if USE(CFNETWORK) | |
92 | , m_connection(0) | |
93 | #endif | |
94 | #if USE(WININET) | |
95 | , m_fileHandle(INVALID_HANDLE_VALUE) | |
96 | , m_fileLoadTimer(loader, &ResourceHandle::fileLoadTimer) | |
97 | , m_resourceHandle(0) | |
98 | , m_secondaryHandle(0) | |
99 | , m_jobId(0) | |
100 | , m_threadId(0) | |
101 | , m_writing(false) | |
102 | , m_formDataString(0) | |
103 | , m_formDataLength(0) | |
104 | , m_bytesRemainingToWrite(0) | |
105 | , m_hasReceivedResponse(false) | |
106 | , m_resend(false) | |
107 | #endif | |
108 | #if USE(CURL) | |
109 | , m_handle(0) | |
110 | , m_url(0) | |
111 | , m_customHeaders(0) | |
112 | , m_cancelled(false) | |
113 | , m_formDataStream(loader) | |
114 | #endif | |
115 | #if USE(SOUP) | |
116 | , m_msg(0) | |
117 | , m_cancelled(false) | |
118 | , m_gfile(0) | |
119 | , m_input_stream(0) | |
120 | , m_cancellable(0) | |
121 | , m_buffer(0) | |
122 | , m_bufsize(0) | |
123 | , m_total(0) | |
124 | , m_idleHandler(0) | |
125 | #endif | |
126 | #if PLATFORM(QT) | |
127 | , m_job(0) | |
128 | , m_frame(0) | |
129 | #endif | |
130 | #if PLATFORM(MAC) | |
131 | , m_startWhenScheduled(false) | |
132 | , m_currentMacChallenge(nil) | |
133 | #elif USE(CFNETWORK) | |
134 | , m_currentCFChallenge(0) | |
135 | #endif | |
136 | , m_failureTimer(loader, &ResourceHandle::fireFailure) | |
137 | { | |
138 | } | |
139 | ||
140 | ~ResourceHandleInternal(); | |
141 | ||
142 | ResourceHandleClient* client() { return m_client; } | |
143 | ResourceHandleClient* m_client; | |
144 | ||
145 | ResourceRequest m_request; | |
146 | ||
147 | int status; | |
148 | ||
149 | bool m_defersLoading; | |
150 | bool m_shouldContentSniff; | |
151 | bool m_mightDownloadFromHandle; | |
152 | #if USE(CFNETWORK) | |
153 | RetainPtr<CFURLConnectionRef> m_connection; | |
154 | #elif PLATFORM(MAC) | |
155 | RetainPtr<NSURLConnection> m_connection; | |
156 | RetainPtr<WebCoreResourceHandleAsDelegate> m_delegate; | |
157 | RetainPtr<id> m_proxy; | |
158 | bool m_startWhenScheduled; | |
159 | #endif | |
160 | #if USE(WININET) | |
161 | HANDLE m_fileHandle; | |
162 | Timer<ResourceHandle> m_fileLoadTimer; | |
163 | HINTERNET m_resourceHandle; | |
164 | HINTERNET m_secondaryHandle; | |
165 | unsigned m_jobId; | |
166 | DWORD m_threadId; | |
167 | bool m_writing; | |
168 | char* m_formDataString; | |
169 | int m_formDataLength; | |
170 | int m_bytesRemainingToWrite; | |
171 | String m_postReferrer; | |
172 | bool m_hasReceivedResponse; | |
173 | bool m_resend; | |
174 | #endif | |
175 | #if USE(CURL) | |
176 | CURL* m_handle; | |
177 | char* m_url; | |
178 | struct curl_slist* m_customHeaders; | |
179 | ResourceResponse m_response; | |
180 | bool m_cancelled; | |
181 | ||
182 | FormDataStream m_formDataStream; | |
183 | Vector<char> m_postBytes; | |
184 | #endif | |
185 | #if USE(SOUP) | |
186 | SoupMessage* m_msg; | |
187 | ResourceResponse m_response; | |
188 | bool m_cancelled; | |
189 | GFile* m_gfile; | |
190 | GInputStream* m_input_stream; | |
191 | GCancellable* m_cancellable; | |
192 | char* m_buffer; | |
193 | gsize m_bufsize, m_total; | |
194 | guint m_idleHandler; | |
195 | #endif | |
196 | #if PLATFORM(QT) | |
197 | #if QT_VERSION < 0x040400 | |
198 | QWebNetworkJob* m_job; | |
199 | #else | |
200 | QNetworkReplyHandler* m_job; | |
201 | #endif | |
202 | QWebFrame* m_frame; | |
203 | #endif | |
204 | #if PLATFORM(MAC) | |
205 | NSURLAuthenticationChallenge *m_currentMacChallenge; | |
206 | #endif | |
207 | #if USE(CFNETWORK) | |
208 | CFURLAuthChallengeRef m_currentCFChallenge; | |
209 | #endif | |
210 | AuthenticationChallenge m_currentWebChallenge; | |
211 | ||
212 | ResourceHandle::FailureType m_failureType; | |
213 | Timer<ResourceHandle> m_failureTimer; | |
214 | }; | |
215 | ||
216 | } // namespace WebCore | |
217 | ||
218 | #endif // ResourceHandleInternal_h |