2 * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
26 #ifndef ResourceHandleInternal_h
27 #define ResourceHandleInternal_h
29 #include "ResourceHandle.h"
30 #include "ResourceRequest.h"
31 #include "AuthenticationChallenge.h"
35 #include <CFNetwork/CFURLConnectionPriv.h>
44 #include <curl/curl.h>
45 #include "FormDataStreamCurl.h"
49 #include <libsoup/soup.h>
56 class QNetworkReplyHandler
;
62 @
class NSURLAuthenticationChallenge
;
63 @
class NSURLConnection
;
65 class NSURLAuthenticationChallenge
;
66 class NSURLConnection
;
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).
80 class ResourceHandleClient
;
82 class ResourceHandleInternal
: Noncopyable
{
84 ResourceHandleInternal(ResourceHandle
* loader
, const ResourceRequest
& request
, ResourceHandleClient
* c
, bool defersLoading
, bool shouldContentSniff
, bool mightDownloadFromHandle
)
88 , m_defersLoading(defersLoading
)
89 , m_shouldContentSniff(shouldContentSniff
)
90 , m_mightDownloadFromHandle(mightDownloadFromHandle
)
95 , m_fileHandle(INVALID_HANDLE_VALUE
)
96 , m_fileLoadTimer(loader
, &ResourceHandle::fileLoadTimer
)
98 , m_secondaryHandle(0)
102 , m_formDataString(0)
103 , m_formDataLength(0)
104 , m_bytesRemainingToWrite(0)
105 , m_hasReceivedResponse(false)
113 , m_formDataStream(loader
)
131 , m_startWhenScheduled(false)
132 , m_currentMacChallenge(nil
)
134 , m_currentCFChallenge(0)
136 , m_failureTimer(loader
, &ResourceHandle::fireFailure
)
140 ~ResourceHandleInternal();
142 ResourceHandleClient
* client() { return m_client
; }
143 ResourceHandleClient
* m_client
;
145 ResourceRequest m_request
;
149 bool m_defersLoading
;
150 bool m_shouldContentSniff
;
151 bool m_mightDownloadFromHandle
;
153 RetainPtr
<CFURLConnectionRef
> m_connection
;
155 RetainPtr
<NSURLConnection
> m_connection
;
156 RetainPtr
<WebCoreResourceHandleAsDelegate
> m_delegate
;
157 RetainPtr
<id
> m_proxy
;
158 bool m_startWhenScheduled
;
162 Timer
<ResourceHandle
> m_fileLoadTimer
;
163 HINTERNET m_resourceHandle
;
164 HINTERNET m_secondaryHandle
;
168 char* m_formDataString
;
169 int m_formDataLength
;
170 int m_bytesRemainingToWrite
;
171 String m_postReferrer
;
172 bool m_hasReceivedResponse
;
178 struct curl_slist
* m_customHeaders
;
179 ResourceResponse m_response
;
182 FormDataStream m_formDataStream
;
183 Vector
<char> m_postBytes
;
187 ResourceResponse m_response
;
190 GInputStream
* m_input_stream
;
191 GCancellable
* m_cancellable
;
193 gsize m_bufsize
, m_total
;
197 #if QT_VERSION < 0x040400
198 QWebNetworkJob
* m_job
;
200 QNetworkReplyHandler
* m_job
;
205 NSURLAuthenticationChallenge
*m_currentMacChallenge
;
208 CFURLAuthChallengeRef m_currentCFChallenge
;
210 AuthenticationChallenge m_currentWebChallenge
;
212 ResourceHandle::FailureType m_failureType
;
213 Timer
<ResourceHandle
> m_failureTimer
;
216 } // namespace WebCore
218 #endif // ResourceHandleInternal_h