1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef NET_HTTP_HTTP_RESPONSE_INFO_H_ 6 #define NET_HTTP_HTTP_RESPONSE_INFO_H_ 7 8 #include "base/time.h" 9 #include "net/base/auth.h" 10 #include "net/base/ssl_cert_request_info.h" 11 #include "net/base/ssl_info.h" 12 #include "net/http/http_response_headers.h" 13 #include "net/http/http_vary_data.h" 14 15 class Pickle; 16 17 namespace net { 18 19 class HttpResponseInfo { 20 public: 21 HttpResponseInfo(); 22 ~HttpResponseInfo(); 23 // Default copy-constructor and assignment operator are OK! 24 25 // The following is only defined if the request_time member is set. 26 // If this response was resurrected from cache, then this bool is set, and 27 // request_time may corresponds to a time "far" in the past. Note that 28 // stale content (perhaps un-cacheable) may be fetched from cache subject to 29 // the load flags specified on the request info. For example, this is done 30 // when a user presses the back button to re-render pages, or at startup, when 31 // reloading previously visited pages (without going over the network). 32 bool was_cached; 33 34 // True if the request was fetched over a SPDY channel. 35 bool was_fetched_via_spdy; 36 37 // The time at which the request was made that resulted in this response. 38 // For cached responses, this is the last time the cache entry was validated. 39 base::Time request_time; 40 41 // The time at which the response headers were received. For cached 42 // this is the last time the cache entry was validated. 43 base::Time response_time; 44 45 // If the response headers indicate a 401 or 407 failure, then this structure 46 // will contain additional information about the authentication challenge. 47 scoped_refptr<AuthChallengeInfo> auth_challenge; 48 49 // The SSL client certificate request info. 50 // TODO(wtc): does this really belong in HttpResponseInfo? I put it here 51 // because it is similar to |auth_challenge|, but unlike HTTP authentication 52 // challenge, client certificate request is not part of an HTTP response. 53 scoped_refptr<SSLCertRequestInfo> cert_request_info; 54 55 // The SSL connection info (if HTTPS). 56 SSLInfo ssl_info; 57 58 // The parsed response headers and status line. 59 scoped_refptr<HttpResponseHeaders> headers; 60 61 // The "Vary" header data for this response. 62 HttpVaryData vary_data; 63 64 // Initializes from the representation stored in the given pickle. 65 bool InitFromPickle(const Pickle& pickle, bool* response_truncated); 66 67 // Call this method to persist the response info. 68 void Persist(Pickle* pickle, 69 bool skip_transient_headers, 70 bool response_truncated) const; 71 }; 72 73 } // namespace net 74 75 #endif // NET_HTTP_HTTP_RESPONSE_INFO_H_ 76