Index: net/http/http_network_transaction.cc |
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc |
index 4bd867d1432d96545f9b820f8c0c34126681c809..1cb5f579ef2b891c0eaa463a89f1185108abc953 100644 |
--- a/net/http/http_network_transaction.cc |
+++ b/net/http/http_network_transaction.cc |
@@ -519,6 +519,9 @@ int HttpNetworkTransaction::DoLoop(int result) { |
net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST, NULL); |
rv = DoSendRequest(); |
break; |
+ case STATE_SEND_REQUEST_INTERCEPT_COMPLETE: |
+ rv = DoSendRequestInterceptComplete(rv); |
+ break; |
case STATE_SEND_REQUEST_COMPLETE: |
rv = DoSendRequestComplete(rv); |
net_log_.EndEventWithNetErrorCode( |
@@ -666,33 +669,47 @@ int HttpNetworkTransaction::DoGenerateServerAuthTokenComplete(int rv) { |
} |
int HttpNetworkTransaction::DoSendRequest() { |
- next_state_ = STATE_SEND_REQUEST_COMPLETE; |
+ next_state_ = STATE_SEND_REQUEST_INTERCEPT_COMPLETE; |
- UploadDataStream* request_body = NULL; |
+ request_body_.reset(NULL); |
if (request_->upload_data) { |
int error_code; |
- request_body = UploadDataStream::Create(request_->upload_data, &error_code); |
- if (!request_body) |
+ request_body_.reset( |
+ UploadDataStream::Create(request_->upload_data, &error_code)); |
+ if (!request_body_.get()) |
return error_code; |
} |
+ headers_valid_ = false; |
+ |
// This is constructed lazily (instead of within our Start method), so that |
// we have proxy info available. |
if (request_headers_.IsEmpty()) { |
- bool using_proxy = (proxy_info_.is_http()|| proxy_info_.is_https()) && |
+ bool using_proxy = (proxy_info_.is_http() || proxy_info_.is_https()) && |
!is_https_request(); |
- HttpUtil::BuildRequestHeaders(request_, request_body, auth_controllers_, |
+ HttpUtil::BuildRequestHeaders(request_, request_body_.get(), |
+ auth_controllers_, |
ShouldApplyServerAuth(), |
ShouldApplyProxyAuth(), using_proxy, |
&request_headers_); |
+ } |
- if (session_->network_delegate()) |
- session_->network_delegate()->NotifySendHttpRequest(&request_headers_); |
+ if (session_->network_delegate()) { |
+ if (session_->network_delegate()->NotifyBeforeHttpRequest( |
rvargas (doing something else)
2011/03/17 19:40:20
For every cached request that ends up re-validated
Matt Perry
2011/03/17 19:52:18
Oh, I thought once HttpCache::Transaction::DoCache
|
+ request_->request_id, &request_headers_, &io_callback_)) |
willchan no longer on Chromium
2011/03/17 15:55:54
Isn't the use of io_callback here a bug? You don't
Matt Perry
2011/03/22 21:11:43
Done.
|
+ return ERR_IO_PENDING; |
} |
- headers_valid_ = false; |
- return stream_->SendRequest(request_headers_, request_body, &response_, |
- &io_callback_); |
+ return OK; |
+} |
+ |
+int HttpNetworkTransaction::DoSendRequestInterceptComplete(int result) { |
+ next_state_ = STATE_SEND_REQUEST_COMPLETE; |
+ if (result == net::OK) { |
+ return stream_->SendRequest( |
+ request_headers_, request_body_.release(), &response_, &io_callback_); |
+ } |
+ return result; |
} |
int HttpNetworkTransaction::DoSendRequestComplete(int result) { |
@@ -1239,6 +1256,7 @@ std::string HttpNetworkTransaction::DescribeState(State state) { |
STATE_CASE(STATE_CREATE_STREAM); |
STATE_CASE(STATE_CREATE_STREAM_COMPLETE); |
STATE_CASE(STATE_SEND_REQUEST); |
+ STATE_CASE(STATE_SEND_REQUEST_INTERCEPT_COMPLETE); |
STATE_CASE(STATE_SEND_REQUEST_COMPLETE); |
STATE_CASE(STATE_READ_HEADERS); |
STATE_CASE(STATE_READ_HEADERS_COMPLETE); |