| 1521 | } |
| 1522 | |
| 1523 | butil::intrusive_ptr<ProgressiveAttachment> |
| 1524 | Controller::CreateProgressiveAttachment(StopStyle stop_style) { |
| 1525 | if (has_progressive_writer()) { |
| 1526 | LOG(ERROR) << "One controller can only have one ProgressiveAttachment"; |
| 1527 | return NULL; |
| 1528 | } |
| 1529 | if (_request_protocol != PROTOCOL_HTTP) { |
| 1530 | LOG(ERROR) << "Only http supports ProgressiveAttachment now"; |
| 1531 | return NULL; |
| 1532 | } |
| 1533 | if (_current_call.sending_sock == NULL) { |
| 1534 | LOG(ERROR) << "sending_sock is NULL"; |
| 1535 | return NULL; |
| 1536 | } |
| 1537 | SocketUniquePtr httpsock; |
| 1538 | _current_call.sending_sock->ReAddress(&httpsock); |
| 1539 | |
| 1540 | if (stop_style == FORCE_STOP) { |
| 1541 | httpsock->fail_me_at_server_stop(); |
| 1542 | } |
| 1543 | _wpa.reset(new ProgressiveAttachment( |
| 1544 | httpsock, http_request().before_http_1_1())); |
| 1545 | return _wpa; |
| 1546 | } |
| 1547 | |
| 1548 | void Controller::ReadProgressiveAttachmentBy(ProgressiveReader* r) { |
| 1549 | if (r == NULL) { |