Changeset 55505 in webkit


Ignore:
Timestamp:
Mar 3, 2010 10:10:16 PM (14 years ago)
Author:
ukai@chromium.org
Message:

2010-03-03 Yuta Kitamura <yutak@chromium.org>

Reviewed by Alexey Proskuryakov.

Add a new class that stores information about Web Socket handshake request.

Instances of this class contain the necessary information to send a Web Socket
handshake request. In the future, this class will provide request information
to the Web Inspector.

WebSocketHandshake needs to provide request information
https://bugs.webkit.org/show_bug.cgi?id=34784

No new tests, since the current tests will suffice (LayoutTests/websocket/*).

  • GNUmakefile.am:
  • WebCore.gypi:
  • WebCore.pro:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • websockets/WebSocketChannel.cpp:
  • websockets/WebSocketHandshake.cpp: (WebCore::WebSocketHandshake::clientHandshakeMessage): (WebCore::WebSocketHandshake::clientHandshakeRequest):
  • websockets/WebSocketHandshake.h:
  • websockets/WebSocketHandshakeRequest.cpp: Added. (WebCore::WebSocketHandshakeRequest::WebSocketHandshakeRequest): (WebCore::WebSocketHandshakeRequest::~WebSocketHandshakeRequest): (WebCore::WebSocketHandshakeRequest::addExtraHeaderField): (WebCore::WebSocketHandshakeRequest::headerFields): (WebCore::WebSocketHandshakeRequest::host):
  • websockets/WebSocketHandshakeRequest.h: Added.
Location:
trunk/WebCore
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r55504 r55505  
     12010-03-03  Yuta Kitamura  <yutak@chromium.org>
     2
     3        Reviewed by Alexey Proskuryakov.
     4
     5        Add a new class that stores information about Web Socket handshake request.
     6
     7        Instances of this class contain the necessary information to send a Web Socket
     8        handshake request. In the future, this class will provide request information
     9        to the Web Inspector.
     10
     11        WebSocketHandshake needs to provide request information
     12        https://bugs.webkit.org/show_bug.cgi?id=34784
     13
     14        No new tests, since the current tests will suffice (LayoutTests/websocket/*).
     15
     16        * GNUmakefile.am:
     17        * WebCore.gypi:
     18        * WebCore.pro:
     19        * WebCore.vcproj/WebCore.vcproj:
     20        * WebCore.xcodeproj/project.pbxproj:
     21        * websockets/WebSocketChannel.cpp:
     22        * websockets/WebSocketHandshake.cpp:
     23        (WebCore::WebSocketHandshake::clientHandshakeMessage):
     24        (WebCore::WebSocketHandshake::clientHandshakeRequest):
     25        * websockets/WebSocketHandshake.h:
     26        * websockets/WebSocketHandshakeRequest.cpp: Added.
     27        (WebCore::WebSocketHandshakeRequest::WebSocketHandshakeRequest):
     28        (WebCore::WebSocketHandshakeRequest::~WebSocketHandshakeRequest):
     29        (WebCore::WebSocketHandshakeRequest::addExtraHeaderField):
     30        (WebCore::WebSocketHandshakeRequest::headerFields):
     31        (WebCore::WebSocketHandshakeRequest::host):
     32        * websockets/WebSocketHandshakeRequest.h: Added.
     33
    1342010-03-03  Laszlo Gombos  <laszlo.1.gombos@nokia.com>
    235
  • trunk/WebCore/GNUmakefile.am

    r55485 r55505  
    34733473        WebCore/websockets/WebSocketChannelClient.h \
    34743474        WebCore/websockets/WebSocketHandshake.cpp \
    3475         WebCore/websockets/WebSocketHandshake.h
     3475        WebCore/websockets/WebSocketHandshake.h \
     3476        WebCore/websockets/WebSocketHandshakeRequest.cpp \
     3477        WebCore/websockets/WebSocketHandshakeRequest.h
    34763478
    34773479if ENABLE_WORKERS
  • trunk/WebCore/WebCore.gypi

    r55486 r55505  
    36253625            'websockets/WebSocketHandshake.cpp',
    36263626            'websockets/WebSocketHandshake.h',
     3627            'websockets/WebSocketHandshakeRequest.cpp',
     3628            'websockets/WebSocketHandshakeRequest.h',
    36273629            'websockets/WorkerThreadableWebSocketChannel.cpp',
    36283630            'websockets/WorkerThreadableWebSocketChannel.h',
  • trunk/WebCore/WebCore.pro

    r55485 r55505  
    26742674
    26752675contains(DEFINES, ENABLE_WEB_SOCKETS=1) {
    2676 HEADERS += \
    2677     platform/network/qt/SocketStreamHandlePrivate.h \
    2678 
    2679 SOURCES += \
    2680     websockets/WebSocket.cpp \
    2681     websockets/WebSocketChannel.cpp \
    2682     websockets/WebSocketHandshake.cpp \
    2683     websockets/ThreadableWebSocketChannel.cpp \
    2684     platform/network/SocketStreamErrorBase.cpp \
    2685     platform/network/SocketStreamHandleBase.cpp \
    2686     platform/network/qt/SocketStreamHandleQt.cpp \
    2687     bindings/js/JSWebSocketCustom.cpp \
    2688     bindings/js/JSWebSocketConstructor.cpp
    2689 
    2690 contains(DEFINES, ENABLE_WORKERS=1) {
    2691 SOURCES += \
    2692     websockets/WorkerThreadableWebSocketChannel.cpp
    2693 }
     2676    HEADERS += \
     2677        websockets/ThreadableWebSocketChannel.h \
     2678        websockets/ThreadableWebSocketChannelClientWrapper.h \
     2679        websockets/WebSocket.h \
     2680        websockets/WebSocketChannel.h \
     2681        websockets/WebSocketChannelClient.h \
     2682        websockets/WebSocketHandshake.h \
     2683        websockets/WebSocketHandshakeRequest.h \
     2684        platform/network/qt/SocketStreamHandlePrivate.h
     2685
     2686    SOURCES += \
     2687        websockets/WebSocket.cpp \
     2688        websockets/WebSocketChannel.cpp \
     2689        websockets/WebSocketHandshake.cpp \
     2690        websockets/WebSocketHandshakeRequest.cpp \
     2691        websockets/ThreadableWebSocketChannel.cpp \
     2692        platform/network/SocketStreamErrorBase.cpp \
     2693        platform/network/SocketStreamHandleBase.cpp \
     2694        platform/network/qt/SocketStreamHandleQt.cpp \
     2695        bindings/js/JSWebSocketCustom.cpp \
     2696        bindings/js/JSWebSocketConstructor.cpp
     2697
     2698    contains(DEFINES, ENABLE_WORKERS=1) {
     2699        HEADERS += \
     2700            websockets/WorkerThreadableWebSocketChannel.h
     2701
     2702        SOURCES += \
     2703            websockets/WorkerThreadableWebSocketChannel.cpp
     2704    }
    26942705}
    26952706
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r55485 r55505  
    2705027050                        </File>
    2705127051                        <File
     27052                                RelativePath="..\rendering\BidiRun.cpp"
     27053                                >
     27054                        </File>
     27055                        <File
     27056                                RelativePath="..\rendering\BidiRun.h"
     27057                                >
     27058                        </File>
     27059                        <File
    2705227060                                RelativePath="..\rendering\break_lines.cpp"
    2705327061                                >
     
    2705727065                                >
    2705827066                        </File>
    27059                         <File
    27060                                 RelativePath="..\rendering\BidiRun.cpp"
    27061                                 >
    27062                         </File>
    27063                         <File
    27064                                 RelativePath="..\rendering\BidiRun.h"
    27065                                 >
    27066                         </File>
    2706727067                        <File
    2706827068                                RelativePath="..\rendering\CounterNode.cpp"
     
    2712127121                                >
    2712227122                        </File>
    27123                         <File
     27123                        <File
    2712427124                                RelativePath="..\rendering\InlineIterator.h"
    2712527125                                >
     
    3425734257                                </File>
    3425834258                                <File
     34259                                        RelativePath="..\bindings\js\JavaScriptProfile.cpp"
     34260                                        >
     34261                                </File>
     34262                                <File
     34263                                        RelativePath="..\bindings\js\JavaScriptProfile.h"
     34264                                        >
     34265                                </File>
     34266                                <File
     34267                                        RelativePath="..\bindings\js\JavaScriptProfileNode.cpp"
     34268                                        >
     34269                                </File>
     34270                                <File
     34271                                        RelativePath="..\bindings\js\JavaScriptProfileNode.h"
     34272                                        >
     34273                                </File>
     34274                                <File
    3425934275                                        RelativePath="..\bindings\js\JSAbstractWorkerCustom.cpp"
    3426034276                                        >
     
    3994339959                                                />
    3994439960                                        </FileConfiguration>
    39945                                 </File>
    39946                                 <File
    39947                                         RelativePath="..\bindings\js\JavaScriptProfile.cpp"
    39948                                         >
    39949                                 </File>
    39950                                 <File
    39951                                         RelativePath="..\bindings\js\JavaScriptProfile.h"
    39952                                         >
    39953                                 </File>
    39954                                 <File
    39955                                         RelativePath="..\bindings\js\JavaScriptProfileNode.cpp"
    39956                                         >
    39957                                 </File>
    39958                                 <File
    39959                                         RelativePath="..\bindings\js\JavaScriptProfileNode.h"
    39960                                         >
    3996139961                                </File>
    3996239962                                <File
     
    4305743057                                </File>
    4305843058                                <File
     43059                                        RelativePath="..\inspector\front-end\textViewer.css"
     43060                                        >
     43061                                </File>
     43062                                <File
    4305943063                                        RelativePath="..\inspector\front-end\TextViewer.js"
    43060                                         >
    43061                                 </File>
    43062                                 <File
    43063                                         RelativePath="..\inspector\front-end\textViewer.css"
    4306443064                                        >
    4306543065                                </File>
     
    4348743487                        <File
    4348843488                                RelativePath="..\websockets\WebSocketHandshake.h"
     43489                                >
     43490                        </File>
     43491                        <File
     43492                                RelativePath="..\websockets\WebSocketHandshakeRequest.cpp"
     43493                                >
     43494                        </File>
     43495                        <File
     43496                                RelativePath="..\websockets\WebSocketHandshakeRequest.h"
    4348943497                                >
    4349043498                        </File>
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r55491 r55505  
    12651265                75793ED40D0CE85B007FC0AC /* DOMMessageEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = 75793ED10D0CE85B007FC0AC /* DOMMessageEvent.mm */; };
    12661266                75793ED50D0CE85B007FC0AC /* DOMMessageEventInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 75793ED20D0CE85B007FC0AC /* DOMMessageEventInternal.h */; };
     1267                7637C541112E7B74003D6CDC /* WebSocketHandshakeRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7637C540112E7B74003D6CDC /* WebSocketHandshakeRequest.cpp */; };
     1268                7637C543112E7B7E003D6CDC /* WebSocketHandshakeRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 7637C542112E7B7E003D6CDC /* WebSocketHandshakeRequest.h */; };
    12671269                7693BAD2106C2DCA007B0823 /* HaltablePlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 7693BACE106C2DCA007B0823 /* HaltablePlugin.h */; settings = {ATTRIBUTES = (Private, ); }; };
    12681270                7693BAD3106C2DCA007B0823 /* PluginHalter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7693BACF106C2DCA007B0823 /* PluginHalter.cpp */; };
     
    66996701                75793ED10D0CE85B007FC0AC /* DOMMessageEvent.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMMessageEvent.mm; sourceTree = "<group>"; };
    67006702                75793ED20D0CE85B007FC0AC /* DOMMessageEventInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMMessageEventInternal.h; sourceTree = "<group>"; };
     6703                7637C540112E7B74003D6CDC /* WebSocketHandshakeRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSocketHandshakeRequest.cpp; sourceTree = "<group>"; };
     6704                7637C542112E7B7E003D6CDC /* WebSocketHandshakeRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSocketHandshakeRequest.h; sourceTree = "<group>"; };
    67016705                7693BACE106C2DCA007B0823 /* HaltablePlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HaltablePlugin.h; sourceTree = "<group>"; };
    67026706                7693BACF106C2DCA007B0823 /* PluginHalter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginHalter.cpp; sourceTree = "<group>"; };
     
    1118011184                        isa = PBXGroup;
    1118111185                        children = (
     11186                                7637C542112E7B7E003D6CDC /* WebSocketHandshakeRequest.h */,
     11187                                7637C540112E7B74003D6CDC /* WebSocketHandshakeRequest.cpp */,
    1118211188                                5112247110CFB8C6008099D7 /* ThreadableWebSocketChannel.cpp */,
    1118311189                                5112247310CFB8D8008099D7 /* ThreadableWebSocketChannel.h */,
     
    1859918605                                E462A4A1113E71BE004A4220 /* IntPointHash.h in Headers */,
    1860018606                                CE172E011136E8CE0062A533 /* ZoomMode.h in Headers */,
     18607                                7637C543112E7B7E003D6CDC /* WebSocketHandshakeRequest.h in Headers */,
    1860118608                        );
    1860218609                        runOnlyForDeploymentPostprocessing = 0;
     
    2078820795                                596229781133EFD700DC4CBB /* GeolocationPositionCache.cpp in Sources */,
    2078920796                                0BC2C7771134A8FC000B2F61 /* CanvasSurface.cpp in Sources */,
     20797                                7637C541112E7B74003D6CDC /* WebSocketHandshakeRequest.cpp in Sources */,
    2079020798                        );
    2079120799                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/websockets/WebSocketChannel.cpp

    r54927 r55505  
    4545#include "StringHash.h"
    4646#include "WebSocketChannelClient.h"
     47#include "WebSocketHandshake.h"
    4748
    4849#include <wtf/Deque.h>
  • trunk/WebCore/websockets/WebSocketHandshake.cpp

    r54707 r55505  
    131131}
    132132
    133 void WebSocketHandshake::setSecure(bool secure)
    134 {
    135     m_secure = secure;
    136 }
    137 
    138133String WebSocketHandshake::clientOrigin() const
    139134{
     
    159154CString WebSocketHandshake::clientHandshakeMessage() const
    160155{
     156    // Keep the following consistent with clientHandshakeRequest().
    161157    StringBuilder builder;
    162158
     
    168164    builder.append("Host: ");
    169165    builder.append(m_url.host().lower());
    170     if (m_url.port()) {
    171         if ((!m_secure && m_url.port() != 80) || (m_secure && m_url.port() != 443)) {
    172             builder.append(":");
    173             builder.append(String::number(m_url.port()));
    174         }
     166    if (m_url.port() && ((!m_secure && m_url.port() != 80) || (m_secure && m_url.port() != 443))) {
     167        builder.append(":");
     168        builder.append(String::number(m_url.port()));
    175169    }
    176170    builder.append("\r\n");
     
    183177        builder.append("\r\n");
    184178    }
     179
    185180    KURL url = httpURLForAuthenticationAndCookies();
    186     // FIXME: set authentication information or cookies for url.
    187     // Set "Authorization: <credentials>" if authentication information exists for url.
    188181    if (m_context->isDocument()) {
    189182        Document* document = static_cast<Document*>(m_context);
     
    196189        // Set "Cookie2: <cookie>" if cookies 2 exists for url?
    197190    }
     191
    198192    builder.append("\r\n");
    199193    return builder.toString().utf8();
     194}
     195
     196WebSocketHandshakeRequest WebSocketHandshake::clientHandshakeRequest() const
     197{
     198    // Keep the following consistent with clientHandshakeMessage().
     199    WebSocketHandshakeRequest request(m_url, clientOrigin(), m_clientProtocol);
     200
     201    KURL url = httpURLForAuthenticationAndCookies();
     202    if (m_context->isDocument()) {
     203        Document* document = static_cast<Document*>(m_context);
     204        String cookie = cookieRequestHeaderFieldValue(document, url);
     205        if (!cookie.isEmpty())
     206            request.addExtraHeaderField("Cookie", cookie);
     207        // Set "Cookie2: <cookie>" if cookies 2 exists for url?
     208    }
     209
     210    return request;
    200211}
    201212
  • trunk/WebCore/websockets/WebSocketHandshake.h

    r52892 r55505  
    3636#include "KURL.h"
    3737#include "PlatformString.h"
     38#include "WebSocketHandshakeRequest.h"
    3839#include <wtf/Noncopyable.h>
    3940
     
    5960
    6061        bool secure() const;
    61         void setSecure(bool secure);
    6262
    6363        String clientOrigin() const;
     
    6565
    6666        CString clientHandshakeMessage() const;
     67        WebSocketHandshakeRequest clientHandshakeRequest() const;
    6768
    6869        void reset();
Note: See TracChangeset for help on using the changeset viewer.