31 #include "ResourceHandleClient.h" |
31 #include "ResourceHandleClient.h" |
32 #include "Timer.h" |
32 #include "Timer.h" |
33 #include <algorithm> |
33 #include <algorithm> |
34 |
34 |
35 namespace WebCore { |
35 namespace WebCore { |
36 |
|
37 static const unsigned invalidPortNumber = 0xFFFF; |
|
38 |
36 |
39 ResourceHandle::ResourceHandle(const ResourceRequest& request, ResourceHandleClient* client, bool defersLoading, |
37 ResourceHandle::ResourceHandle(const ResourceRequest& request, ResourceHandleClient* client, bool defersLoading, |
40 bool shouldContentSniff, bool mightDownloadFromHandle) |
38 bool shouldContentSniff, bool mightDownloadFromHandle) |
41 : d(new ResourceHandleInternal(this, request, client, defersLoading, shouldContentSniff, mightDownloadFromHandle)) |
39 : d(new ResourceHandleInternal(this, request, client, defersLoading, shouldContentSniff, mightDownloadFromHandle)) |
42 { |
40 { |
165 993, // IMAP+SSL |
161 993, // IMAP+SSL |
166 995, // POP3+SSL |
162 995, // POP3+SSL |
167 2049, // NFS |
163 2049, // NFS |
168 4045, // lockd |
164 4045, // lockd |
169 6000, // X11 |
165 6000, // X11 |
170 6665, // Alternate IRC [Apple addition] |
|
171 6666, // Alternate IRC [Apple addition] |
|
172 6667, // Standard IRC [Apple addition] |
|
173 6668, // Alternate IRC [Apple addition] |
|
174 6669, // Alternate IRC [Apple addition] |
|
175 invalidPortNumber, // Used to block all invalid port numbers |
|
176 }; |
166 }; |
177 const unsigned short* const blockedPortListEnd = blockedPortList |
167 const unsigned short* const blockedPortListEnd = blockedPortList |
178 + sizeof(blockedPortList) / sizeof(blockedPortList[0]); |
168 + sizeof(blockedPortList) / sizeof(blockedPortList[0]); |
179 |
169 |
|
170 // fixme use the template |
180 #if PLATFORM(SYMBIAN) |
171 #if PLATFORM(SYMBIAN) |
181 bool found = false; |
172 return true; |
182 |
|
183 for (int i = 0; i < sizeof(blockedPortList) / sizeof(blockedPortList[0]); ++i) { |
|
184 if (blockedPortList[i] == port) { |
|
185 found = true; |
|
186 break; |
|
187 } |
|
188 } |
|
189 // If the port is not in the blocked port list, allow it. |
|
190 if(!found) return true; |
|
191 |
|
192 #else |
173 #else |
193 // If the port is not in the blocked port list, allow it. |
174 // If the port is not in the blocked port list, allow it. |
194 if (!std::binary_search(blockedPortList, blockedPortListEnd, port)) |
175 if (!std::binary_search(blockedPortList, blockedPortListEnd, port)) |
195 return true; |
176 return true; |
196 #endif |
|
197 |
177 |
198 // Allow ports 21 and 22 for FTP URLs, as Mozilla does. |
178 // Allow ports 21 and 22 for FTP URLs, as Mozilla does. |
199 if ((port == 21 || port == 22) && request.url().url().startsWith("ftp:", false)) |
179 if ((port == 21 || port == 22) && request.url().url().startsWith("ftp:", false)) |
200 return true; |
180 return true; |
201 |
181 |
202 // Allow any port number in a file URL, since the port number is ignored. |
182 // Allow any port number in a file URL, since the port number is ignored. |
203 if (request.url().url().startsWith("file:", false)) |
183 if (request.url().url().startsWith("file:", false)) |
204 return true; |
184 return true; |
205 |
185 |
206 return false; |
186 return false; |
|
187 #endif |
207 } |
188 } |
208 |
189 |
209 } // namespace WebCore |
190 } // namespace WebCore |