| 291 | } |
| 292 | |
| 293 | void HttpRequest::readFromSocket(QTcpSocket* socket) |
| 294 | { |
| 295 | Q_ASSERT(status!=complete); |
| 296 | if (status==waitForRequest) |
| 297 | { |
| 298 | readRequest(socket); |
| 299 | } |
| 300 | else if (status==waitForHeader) |
| 301 | { |
| 302 | readHeader(socket); |
| 303 | } |
| 304 | else if (status==waitForBody) |
| 305 | { |
| 306 | readBody(socket); |
| 307 | } |
| 308 | if ((boundary.isEmpty() && currentSize>maxSize) || (!boundary.isEmpty() && currentSize>maxMultiPartSize)) |
| 309 | { |
| 310 | Logger::logger()->log(Logger::LANServer, "HttpRequest: received too many bytes"); |
| 311 | status=abort; |
| 312 | } |
| 313 | if (status==complete) |
| 314 | { |
| 315 | // Extract and decode request parameters from url and body |
| 316 | decodeRequestParams(); |
| 317 | // Extract cookies from headers |
| 318 | extractCookies(); |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | |
| 323 | HttpRequest::RequestStatus HttpRequest::getStatus() const |