[Webkit-unassigned] [Bug 28038] WebSocket API implementation

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 11 09:51:41 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=28038


Alexey Proskuryakov <ap at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #34548|review?                     |review-
               Flag|                            |




--- Comment #2 from Alexey Proskuryakov <ap at webkit.org>  2009-08-11 09:51:40 PDT ---
(From update of attachment 34548)
+    $(WebCore)/websockets \
     $(WebCore)/svg \
     $(WebCore)/websockets \

It's already there.

+    WebCore/websockets/WebSocketRequest.cpp \
+    WebCore/websockets/WebSocketRequest.h \
+    WebCore/websockets/WebSocketResponse.cpp \
+    WebCore/websockets/WebSocketResponse.h

This looks quite wrong - WebSocket does not use a request/response model, so
such class names are highly misguiding.

+#if ENABLE(WEB_SOCKETS)
+#include "JSWebSocket.h"
+#include "WebSocket.h"

In some places, generated files are included without guards, and in others,
with guards. The guards are only needed if the headers are not generated in
ports that do not have this feature enabled - otherwise, similar guards within
headers themselves would do the job.

There's never a need to protect e.g. WebSocket.h with external include guards.

+bool IsValidProtocolString(const WebCore::String& protocol)

This should be static, and inside the WebCore namespace. We don't normally use
anonymous namespaces.

+    // FIXME: need dispatchEvent?

Absolutely - it will dispatch to handlers installed via addEventListener(), as
opposed to setting socket.onopen or similar.

+bool CheckWebSocketHandshake(const WebCore::WebSocketRequest &req, const
WebCore::WebSocketResponse& resp)

Capitalization, argument naming, '&' positioning. This should also be static.

There are many style issues in protocol implementation, I'm not pointing out
most, because they are the same as in other patches.

+            // FIXME: handle overflow.

Please do!

+KURL WebSocketRequest::URLoverHTTP() const

In WebKit style, this would be urlOverHTTP. I'm not sure what this is use for
though, hopefully an even better name can be found.

+    if (url().hasFragmentIdentifier()) {
+        builder.append("#");
+        builder.append(url().fragmentIdentifier());
+    }

What are fragment identifiers good for when using WebSockets? Seems that they
should be forbidden, or dropped immediately when passed in.

+const char* WebSocketResponse::parseHeader(const char* start, const char* end,
Vector<std::pair<String, String> >* headers)

Are WebSockets headers case sensitive? Otherwise, it may be better to use
HTTPHeaderMap.

I didn't closely review all the code; please fix style, possibly using
check-webkit-style script. The direction looks good to me, except for
request/response classes.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list