Commit 1c773ea1 authored by willchan@chromium.org's avatar willchan@chromium.org

Refactor HttpNetworkTransaction to remove side effects in some member functions.

I'm preparing to move some of this functionality out to a HttpStream object or something.  I'm hindered here by the mutation of state in functions that seemingly should be const.  I've refactored some code into non-member functions to make the dependencies more explicit.  This will make it easier for me to pull some of this code out.
Also dropped the net:: qualifiers in the unittest.
TESTED=Ran net_unittests

Review URL: http://codereview.chromium.org/100001

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14772 0039d316-1c4b-4281-b951-d872f2087c98
parent 14beb55a
This diff is collapsed.
......@@ -55,8 +55,6 @@ class HttpNetworkTransaction : public HttpTransaction {
private:
FRIEND_TEST(HttpNetworkTransactionTest, ResetStateForRestart);
void BuildRequestHeaders();
void BuildTunnelRequest();
void DoCallback(int result);
void OnIOComplete(int result);
......@@ -119,10 +117,13 @@ class HttpNetworkTransaction : public HttpTransaction {
// is returned.
int HandleIOError(int error);
// Called when we reached EOF or got an error. If we should resend the
// request, sets next_state_ and returns true. Otherwise, does nothing and
// returns false.
bool ShouldResendRequest();
// Called when we reached EOF or got an error. Returns true if we should
// resend the request.
bool ShouldResendRequest() const;
// Resets the connection and the request headers for resend. Called when
// ShouldResendRequest() is true.
void ResetConnectionAndRequestForResend();
// Called when we encounter a network error that could be resolved by trying
// a new proxy configuration. If there is another proxy configuration to try
......@@ -155,12 +156,15 @@ class HttpNetworkTransaction : public HttpTransaction {
// Resets the members of the transaction so it can be restarted.
void ResetStateForRestart();
// Attach any credentials needed for the proxy server or origin server.
void ApplyAuth();
// Returns true if we should try to add a Proxy-Authorization header
bool ShouldApplyProxyAuth() const;
// Returns true if we should try to add an Authorization header.
bool ShouldApplyServerAuth() const;
// Helper used by ApplyAuth(). Adds either the proxy auth header, or the
// origin server auth header, as specified by |target|
void AddAuthorizationHeader(HttpAuth::Target target);
// Builds either the proxy auth header, or the origin server auth header,
// as specified by |target|.
std::string BuildAuthorizationHeader(HttpAuth::Target target) const;
// Returns a log message for all the response headers related to the auth
// challenge.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment