OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/ocsp/nss_ocsp.h" | 5 #include "net/ocsp/nss_ocsp.h" |
6 | 6 |
7 #include <certt.h> | 7 #include <certt.h> |
8 #include <certdb.h> | 8 #include <certdb.h> |
9 #include <ocsp.h> | 9 #include <ocsp.h> |
10 #include <nspr.h> | 10 #include <nspr.h> |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 293 |
294 virtual void OnResponseStarted(URLRequest* request) OVERRIDE { | 294 virtual void OnResponseStarted(URLRequest* request) OVERRIDE { |
295 DCHECK_EQ(request, request_); | 295 DCHECK_EQ(request, request_); |
296 DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_); | 296 DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_); |
297 | 297 |
298 int bytes_read = 0; | 298 int bytes_read = 0; |
299 if (request->status().is_success()) { | 299 if (request->status().is_success()) { |
300 response_code_ = request_->GetResponseCode(); | 300 response_code_ = request_->GetResponseCode(); |
301 response_headers_ = request_->response_headers(); | 301 response_headers_ = request_->response_headers(); |
302 response_headers_->GetMimeType(&response_content_type_); | 302 response_headers_->GetMimeType(&response_content_type_); |
303 request_->Read(buffer_, kRecvBufferSize, &bytes_read); | 303 request_->Read(buffer_.get(), kRecvBufferSize, &bytes_read); |
304 } | 304 } |
305 OnReadCompleted(request_, bytes_read); | 305 OnReadCompleted(request_, bytes_read); |
306 } | 306 } |
307 | 307 |
308 virtual void OnReadCompleted(URLRequest* request, | 308 virtual void OnReadCompleted(URLRequest* request, |
309 int bytes_read) OVERRIDE { | 309 int bytes_read) OVERRIDE { |
310 DCHECK_EQ(request, request_); | 310 DCHECK_EQ(request, request_); |
311 DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_); | 311 DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_); |
312 | 312 |
313 do { | 313 do { |
314 if (!request_->status().is_success() || bytes_read <= 0) | 314 if (!request_->status().is_success() || bytes_read <= 0) |
315 break; | 315 break; |
316 data_.append(buffer_->data(), bytes_read); | 316 data_.append(buffer_->data(), bytes_read); |
317 } while (request_->Read(buffer_, kRecvBufferSize, &bytes_read)); | 317 } while (request_->Read(buffer_.get(), kRecvBufferSize, &bytes_read)); |
318 | 318 |
319 if (!request_->status().is_io_pending()) { | 319 if (!request_->status().is_io_pending()) { |
320 delete request_; | 320 delete request_; |
321 request_ = NULL; | 321 request_ = NULL; |
322 g_ocsp_io_loop.Get().RemoveRequest(this); | 322 g_ocsp_io_loop.Get().RemoveRequest(this); |
323 { | 323 { |
324 base::AutoLock autolock(lock_); | 324 base::AutoLock autolock(lock_); |
325 finished_ = true; | 325 finished_ = true; |
326 io_loop_ = NULL; | 326 io_loop_ = NULL; |
327 } | 327 } |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 void SetURLRequestContextForNSSHttpIO(URLRequestContext* request_context) { | 965 void SetURLRequestContextForNSSHttpIO(URLRequestContext* request_context) { |
966 pthread_mutex_lock(&g_request_context_lock); | 966 pthread_mutex_lock(&g_request_context_lock); |
967 if (request_context) { | 967 if (request_context) { |
968 DCHECK(!g_request_context); | 968 DCHECK(!g_request_context); |
969 } | 969 } |
970 g_request_context = request_context; | 970 g_request_context = request_context; |
971 pthread_mutex_unlock(&g_request_context_lock); | 971 pthread_mutex_unlock(&g_request_context_lock); |
972 } | 972 } |
973 | 973 |
974 } // namespace net | 974 } // namespace net |
OLD | NEW |