OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 2 Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
3 Copyright (C) 2007 Staikos Computing Services Inc. <info@staikos.net> | 3 Copyright (C) 2007 Staikos Computing Services Inc. <info@staikos.net> |
4 Copyright (C) 2008 Holger Hans Peter Freyther | 4 Copyright (C) 2008 Holger Hans Peter Freyther |
5 | 5 |
6 This library is free software; you can redistribute it and/or | 6 This library is free software; you can redistribute it and/or |
7 modify it under the terms of the GNU Library General Public | 7 modify it under the terms of the GNU Library General Public |
8 License as published by the Free Software Foundation; either | 8 License as published by the Free Software Foundation; either |
9 version 2 of the License, or (at your option) any later version. | 9 version 2 of the License, or (at your option) any later version. |
10 | 10 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 if (suggestedFilename.isEmpty()) | 262 if (suggestedFilename.isEmpty()) |
263 suggestedFilename = url.lastPathComponent(); | 263 suggestedFilename = url.lastPathComponent(); |
264 | 264 |
265 ResourceResponse response(url, mimeType, | 265 ResourceResponse response(url, mimeType, |
266 m_reply->header(QNetworkRequest::ContentLengthHead
er).toLongLong(), | 266 m_reply->header(QNetworkRequest::ContentLengthHead
er).toLongLong(), |
267 encoding, | 267 encoding, |
268 suggestedFilename); | 268 suggestedFilename); |
269 | 269 |
270 const bool isLocalFileReply = (m_reply->url().scheme() == QLatin1String("fil
e")); | 270 const bool isLocalFileReply = (m_reply->url().scheme() == QLatin1String("fil
e")); |
271 int statusCode = m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute
).toInt(); | 271 int statusCode = m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute
).toInt(); |
272 if (!isLocalFileReply) | 272 if (!isLocalFileReply) { |
273 response.setHTTPStatusCode(statusCode); | 273 response.setHTTPStatusCode(statusCode); |
| 274 response.setHTTPStatusText(m_reply->attribute(QNetworkRequest::HttpReaso
nPhraseAttribute).toByteArray().constData()); |
| 275 } |
274 else if (m_reply->error() == QNetworkReply::ContentNotFoundError) | 276 else if (m_reply->error() == QNetworkReply::ContentNotFoundError) |
275 response.setHTTPStatusCode(404); | 277 response.setHTTPStatusCode(404); |
276 | 278 |
277 | 279 |
278 /* Fill in the other fields | 280 /* Fill in the other fields |
279 * For local file requests remove the content length and the last-modified | 281 * For local file requests remove the content length and the last-modified |
280 * headers as required by fast/dom/xmlhttprequest-get.xhtml | 282 * headers as required by fast/dom/xmlhttprequest-get.xhtml |
281 */ | 283 */ |
282 foreach (QByteArray headerName, m_reply->rawHeaderList()) { | 284 foreach (QByteArray headerName, m_reply->rawHeaderList()) { |
283 | 285 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 | 428 |
427 if (m_shouldFinish) | 429 if (m_shouldFinish) |
428 finish(); | 430 finish(); |
429 } | 431 } |
430 | 432 |
431 } | 433 } |
432 | 434 |
433 #include "moc_QNetworkReplyHandler.cpp" | 435 #include "moc_QNetworkReplyHandler.cpp" |
434 | 436 |
435 #endif | 437 #endif |
OLD | NEW |