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