#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/power_monitor/power_observer.h"
-#include "net/base/filter.h"
#include "net/base/host_port_pair.h"
#include "net/base/load_states.h"
#include "net/base/net_export.h"
#include "net/base/request_priority.h"
#include "net/base/upload_progress.h"
#include "net/cookies/canonical_cookie.h"
+#include "net/url_request/redirect_info.h"
#include "url/gurl.h"
namespace net {
class AuthChallengeInfo;
class AuthCredentials;
class CookieOptions;
+class CookieStore;
+class Filter;
class HttpRequestHeaders;
class HttpResponseInfo;
class IOBuffer;
// The default implementation inspects the response_info_.
virtual bool IsRedirectResponse(GURL* location, int* http_status_code);
+ // Called to determine if it is okay to copy the reference fragment from the
+ // original URL (if existent) to the redirection target when the redirection
+ // target has no reference fragment.
+ //
+ // The default implementation returns true.
+ virtual bool CopyFragmentOnRedirect(const GURL& location) const;
+
// Called to determine if it is okay to redirect this job to the specified
// location. This may be used to implement protocol-specific restrictions.
// If this function returns false, then the URLRequest will fail
// Delegates to URLRequest::Delegate.
bool CanEnablePrivacyMode() const;
+ // Returns the cookie store to be used for the request.
+ CookieStore* GetCookieStore() const;
+
// Notifies the job that the network is about to be used.
void NotifyBeforeNetworkStart(bool* defer);
// the stream.
virtual void DoneReading();
+ // Called to tell the job that the body won't be read because it's a redirect.
+ // This is needed so that redirect headers can be cached even though their
+ // bodies are never read.
+ virtual void DoneReadingRedirectResponse();
+
// Informs the filter that data has been read into its buffer
void FilteredDataRead(int bytes_read);
// be destroyed so that statistics can be gathered while the derived class is
// still present to assist in calculations. This is used by URLRequestHttpJob
// to get SDCH to emit stats.
- void DestroyFilters() { filter_.reset(); }
+ void DestroyFilters();
// Provides derived classes with access to the request's network delegate.
NetworkDelegate* network_delegate() { return network_delegate_; }
// Set the status of the job.
void SetStatus(const URLRequestStatus& status);
+ // Set the proxy server that was used, if any.
+ void SetProxyServer(const HostPortPair& proxy_server);
+
// The number of bytes read before passing to the filter.
int prefilter_bytes_read() const { return prefilter_bytes_read_; }
// Called in response to a redirect that was not canceled to follow the
// redirect. The current job will be replaced with a new job loading the
// given redirect destination.
- void FollowRedirect(const GURL& location, int http_status_code);
+ void FollowRedirect(const RedirectInfo& redirect_info);
// Called after every raw read. If |bytes_read| is > 0, this indicates
// a successful read of |bytes_read| unfiltered bytes. If |bytes_read|
// The default implementation does nothing.
virtual void UpdatePacketReadTimes();
+ // Computes a new RedirectInfo based on receiving a redirect response of
+ // |location| and |http_status_code|.
+ RedirectInfo ComputeRedirectInfo(const GURL& location, int http_status_code);
+
// Indicates that the job is done producing data, either it has completed
// all the data or an error has been encountered. Set exclusively by
// NotifyDone so that it is kept in sync with the request.
int64 expected_content_size_;
// Set when a redirect is deferred.
- GURL deferred_redirect_url_;
- int deferred_redirect_status_code_;
+ RedirectInfo deferred_redirect_info_;
// The network delegate to use with this request, if any.
NetworkDelegate* network_delegate_;