| 128 | } |
| 129 | |
| 130 | void QHttpResponse::writeHead(int status) |
| 131 | { |
| 132 | if (m_finished) { |
| 133 | #ifdef DEBUG |
| 134 | qWarning() << "QHttpResponse::writeHead() Cannot write headers after response has finished."; |
| 135 | #endif |
| 136 | return; |
| 137 | } |
| 138 | |
| 139 | if (m_headerWritten) { |
| 140 | #ifdef DEBUG |
| 141 | qWarning() << "QHttpResponse::writeHead() Already called once for this response."; |
| 142 | #endif |
| 143 | return; |
| 144 | } |
| 145 | |
| 146 | m_connection->write( |
| 147 | QString::fromUtf8("HTTP/1.1 %1 %2\r\n").arg(status).arg(STATUS_CODES[status]).toLatin1()); |
| 148 | writeHeaders(); |
| 149 | m_connection->write("\r\n"); |
| 150 | |
| 151 | m_headerWritten = true; |
| 152 | } |
| 153 | |
| 154 | void QHttpResponse::writeHead(StatusCode statusCode) |
| 155 | { |