summaryrefslogtreecommitdiffstats
path: root/net/socket_stream/socket_stream.h
diff options
context:
space:
mode:
authorukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-01 02:37:13 +0000
committerukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-01 02:37:13 +0000
commit6a2c3677f12c18bcc1b57c37becd4e1149f0c8e4 (patch)
treeb0c0a2218130e3ceda8d983b768d0b693513a795 /net/socket_stream/socket_stream.h
parent260ce69aad6758077a585ebe5f5c040960e506a0 (diff)
downloadchromium_src-6a2c3677f12c18bcc1b57c37becd4e1149f0c8e4.zip
chromium_src-6a2c3677f12c18bcc1b57c37becd4e1149f0c8e4.tar.gz
chromium_src-6a2c3677f12c18bcc1b57c37becd4e1149f0c8e4.tar.bz2
Support HttpOnly cookie on Web Socket
Web Socket should send "HttpOnly" cookie when handshaking. In WebKit/WebCore, WebSocketHandshake uses cookieRequestHeaderFieldValue() to get cookies including HttpOnly cookie. However, Chrome doesn't trunk renderer process, so we're not allowed to access HttpOnly cookie in WebCore. Thus, we handle HttpOnly cookies in browser process. Add SocketStreamJob as interface for protocol specific handling on SocketStream. WebSocketJob implements Web Socket specific handling. For now, it handles cookies in Web Socket. It checks Web Socket handshake request message from renderer process, and replaces Cookie: header to include HttpOnly cookies. It also checks Web Socket handshake response message, sets cookies if any, and strips Set-Cookie: header, so that renderer process couldn't see Set-Cookie: header. BUG=35660 TEST=net_unittests and layout_tests passes Review URL: http://codereview.chromium.org/601077 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40250 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket_stream/socket_stream.h')
-rw-r--r--net/socket_stream/socket_stream.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/net/socket_stream/socket_stream.h b/net/socket_stream/socket_stream.h
index 5b1ae3e..1334c15 100644
--- a/net/socket_stream/socket_stream.h
+++ b/net/socket_stream/socket_stream.h
@@ -101,6 +101,7 @@ class SocketStream : public base::RefCountedThreadSafe<SocketStream> {
void SetUserData(const void* key, UserData* data);
const GURL& url() const { return url_; }
+ bool is_secure() const;
const AddressList& address_list() const { return addresses_; }
Delegate* delegate() const { return delegate_; }
int max_pending_send_allowed() const { return max_pending_send_allowed_; }
@@ -112,28 +113,28 @@ class SocketStream : public base::RefCountedThreadSafe<SocketStream> {
// Opens the connection on the IO thread.
// Once the connection is established, calls delegate's OnConnected.
- void Connect();
+ virtual void Connect();
// Requests to send |len| bytes of |data| on the connection.
// Returns true if |data| is buffered in the job.
// Returns false if size of buffered data would exceeds
// |max_pending_send_allowed_| and |data| is not sent at all.
- bool SendData(const char* data, int len);
+ virtual bool SendData(const char* data, int len);
// Requests to close the connection.
// Once the connection is closed, calls delegate's OnClose.
- void Close();
+ virtual void Close();
// Restarts with authentication info.
// Should be used for response of OnAuthRequired.
- void RestartWithAuth(
+ virtual void RestartWithAuth(
const std::wstring& username,
const std::wstring& password);
// Detach delegate. Call before delegate is deleted.
// Once delegate is detached, close the socket stream and never call delegate
// back.
- void DetachDelegate();
+ virtual void DetachDelegate();
// Sets an alternative HostResolver. For testing purposes only.
void SetHostResolver(HostResolver* host_resolver);
@@ -142,6 +143,12 @@ class SocketStream : public base::RefCountedThreadSafe<SocketStream> {
// |factory|. For testing purposes only.
void SetClientSocketFactory(ClientSocketFactory* factory);
+ protected:
+ friend class base::RefCountedThreadSafe<SocketStream>;
+ ~SocketStream();
+
+ Delegate* delegate_;
+
private:
class RequestHeaders : public IOBuffer {
public:
@@ -201,8 +208,6 @@ class SocketStream : public base::RefCountedThreadSafe<SocketStream> {
typedef std::deque< scoped_refptr<IOBufferWithSize> > PendingDataQueue;
friend class RequestTracker<SocketStream>;
- friend class base::RefCountedThreadSafe<SocketStream>;
- ~SocketStream();
friend class WebSocketThrottleTest;
@@ -248,7 +253,6 @@ class SocketStream : public base::RefCountedThreadSafe<SocketStream> {
int HandleCertificateError(int result);
- bool is_secure() const;
SSLConfigService* ssl_config_service() const;
ProxyService* proxy_service() const;
@@ -258,7 +262,6 @@ class SocketStream : public base::RefCountedThreadSafe<SocketStream> {
scoped_refptr<LoadLog> load_log_;
GURL url_;
- Delegate* delegate_;
int max_pending_send_allowed_;
scoped_refptr<URLRequestContext> context_;