Remove Key3 and Challenge Response fields from Websocket implementation and Web Inspector.

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

Patch by Pan Deng <pan.deng@intel.com> on 2013-01-15
Reviewed by Kent Tamura.

Key3 and Challenge Response fields were obsoleted in IETF websocket spec, this patch removes related
code in Websocket and Web Inspector

No new tests as no new functionality added.

* Modules/websockets/WebSocketHandshakeRequest.cpp: remove Key3 related code
* Modules/websockets/WebSocketHandshakeRequest.h:
(WebSocketHandshakeRequest):
* Modules/websockets/WebSocketHandshakeResponse.cpp: remove Challenge response related code
* Modules/websockets/WebSocketHandshakeResponse.h:
(WebSocketHandshakeResponse):
* inspector/Inspector.json: remove Key3 and Challenge response fields definition
* inspector/InspectorResourceAgent.cpp: remove Key3 and Challenge response field from inspector agent
(WebCore):
(WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest):
(WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse):
* inspector/front-end/NetworkManager.js:
(WebInspector.NetworkDispatcher.prototype.webSocketWillSendHandshakeRequest):
(WebInspector.NetworkDispatcher.prototype.webSocketHandshakeResponseReceived):
* inspector/front-end/RequestHeadersView.js: remove Key3 and Challenge response item from front-end.
(WebInspector.RequestHeadersView.prototype._refreshRequestHeaders):
(WebInspector.RequestHeadersView.prototype._refreshResponseHeaders):
(WebInspector.RequestHeadersView.prototype._refreshHeaders):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139814 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 18ee0645
2013-01-15 Pan Deng <pan.deng@intel.com>
Remove Key3 and Challenge Response fields from Websocket implementation and Web Inspector.
https://bugs.webkit.org/show_bug.cgi?id=105738.
Reviewed by Kent Tamura.
Key3 and Challenge Response fields were obsoleted in IETF websocket spec, this patch removes related
code in Websocket and Web Inspector
No new tests as no new functionality added.
* Modules/websockets/WebSocketHandshakeRequest.cpp: remove Key3 related code
* Modules/websockets/WebSocketHandshakeRequest.h:
(WebSocketHandshakeRequest):
* Modules/websockets/WebSocketHandshakeResponse.cpp: remove Challenge response related code
* Modules/websockets/WebSocketHandshakeResponse.h:
(WebSocketHandshakeResponse):
* inspector/Inspector.json: remove Key3 and Challenge response fields definition
* inspector/InspectorResourceAgent.cpp: remove Key3 and Challenge response field from inspector agent
(WebCore):
(WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest):
(WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse):
* inspector/front-end/NetworkManager.js:
(WebInspector.NetworkDispatcher.prototype.webSocketWillSendHandshakeRequest):
(WebInspector.NetworkDispatcher.prototype.webSocketHandshakeResponseReceived):
* inspector/front-end/RequestHeadersView.js: remove Key3 and Challenge response item from front-end.
(WebInspector.RequestHeadersView.prototype._refreshRequestHeaders):
(WebInspector.RequestHeadersView.prototype._refreshResponseHeaders):
(WebInspector.RequestHeadersView.prototype._refreshHeaders):
2013-01-15 Antti Koivisto <antti@apple.com>
ASSERT(!m_queue.killed() && m_threadID) hit in StorageThread::scheduleTask on low memory warning
......@@ -40,16 +40,6 @@ using namespace std;
namespace WebCore {
WebSocketHandshakeRequest::Key3::Key3()
{
memset(value, 0, sizeof(value));
}
void WebSocketHandshakeRequest::Key3::set(const unsigned char key3[8])
{
memcpy(value, key3, sizeof(value));
}
WebSocketHandshakeRequest::WebSocketHandshakeRequest(const String& requestMethod, const KURL& url)
: HTTPRequest(requestMethod, url, HTTP_1_1)
{
......@@ -59,16 +49,6 @@ WebSocketHandshakeRequest::~WebSocketHandshakeRequest()
{
}
WebSocketHandshakeRequest::Key3 WebSocketHandshakeRequest::key3() const
{
return m_key3;
}
void WebSocketHandshakeRequest::setKey3(const unsigned char key3[8])
{
m_key3.set(key3);
}
} // namespace WebCore
#endif // ENABLE(WEB_SOCKETS)
......@@ -42,18 +42,8 @@ public:
static PassRefPtr<WebSocketHandshakeRequest> create(const String& requestMethod, const KURL& url) { return adoptRef(new WebSocketHandshakeRequest(requestMethod, url)); }
~WebSocketHandshakeRequest();
struct Key3 {
unsigned char value[8];
Key3();
void set(const unsigned char key3[8]);
};
Key3 key3() const;
void setKey3(const unsigned char key3[8]);
private:
WebSocketHandshakeRequest(const String& requestMethod, const KURL&);
Key3 m_key3;
};
} // namespace WebCore
......
......@@ -41,16 +41,6 @@ using namespace std;
namespace WebCore {
WebSocketHandshakeResponse::ChallengeResponse::ChallengeResponse()
{
memset(value, 0, sizeof(value));
}
void WebSocketHandshakeResponse::ChallengeResponse::set(const unsigned char challengeResponse[16])
{
memcpy(value, challengeResponse, sizeof(value));
}
WebSocketHandshakeResponse::WebSocketHandshakeResponse()
{
}
......@@ -95,16 +85,6 @@ void WebSocketHandshakeResponse::clearHeaderFields()
m_headerFields.clear();
}
const WebSocketHandshakeResponse::ChallengeResponse& WebSocketHandshakeResponse::challengeResponse() const
{
return m_challengeResponse;
}
void WebSocketHandshakeResponse::setChallengeResponse(const unsigned char challengeResponse[16])
{
m_challengeResponse.set(challengeResponse);
}
} // namespace WebCore
#endif // ENABLE(WEB_SOCKETS)
......@@ -52,20 +52,10 @@ public:
void addHeaderField(const AtomicString& name, const String& value);
void clearHeaderFields();
struct ChallengeResponse {
unsigned char value[16];
ChallengeResponse();
void set(const unsigned char challengeResponse[16]);
};
const ChallengeResponse& challengeResponse() const;
void setChallengeResponse(const unsigned char challengeResponse[16]);
private:
int m_statusCode;
String m_statusText;
HTTPHeaderMap m_headerFields;
ChallengeResponse m_challengeResponse;
};
} // namespace WebCore
......
......@@ -865,7 +865,6 @@
"description": "WebSocket request data.",
"hidden": true,
"properties": [
{ "name": "requestKey3", "type": "string", "description": "HTTP response status text." },
{ "name": "headers", "$ref": "Headers", "description": "HTTP response headers." }
]
},
......@@ -877,8 +876,7 @@
"properties": [
{ "name": "status", "type": "number", "description": "HTTP response status code." },
{ "name": "statusText", "type": "string", "description": "HTTP response status text." },
{ "name": "headers", "$ref": "Headers", "description": "HTTP response headers." },
{ "name": "challengeResponse", "type": "string", "description": "Challenge response." }
{ "name": "headers", "$ref": "Headers", "description": "HTTP response headers." }
]
},
{
......
......@@ -478,21 +478,6 @@ PassRefPtr<TypeBuilder::Network::Initiator> InspectorResourceAgent::buildInitiat
#if ENABLE(WEB_SOCKETS)
// FIXME: More this into the front-end?
// Create human-readable binary representation, like "01:23:45:67:89:AB:CD:EF".
static String createReadableStringFromBinary(const unsigned char* value, size_t length)
{
ASSERT(length > 0);
StringBuilder builder;
builder.reserveCapacity(length * 3 - 1);
for (size_t i = 0; i < length; ++i) {
if (i > 0)
builder.append(':');
appendByteAsHex(value[i], builder);
}
return builder.toString();
}
void InspectorResourceAgent::didCreateWebSocket(unsigned long identifier, const KURL& requestURL)
{
m_frontend->webSocketCreated(IdentifiersFactory::requestId(identifier), requestURL.string());
......@@ -501,7 +486,6 @@ void InspectorResourceAgent::didCreateWebSocket(unsigned long identifier, const
void InspectorResourceAgent::willSendWebSocketHandshakeRequest(unsigned long identifier, const WebSocketHandshakeRequest& request)
{
RefPtr<TypeBuilder::Network::WebSocketRequest> requestObject = TypeBuilder::Network::WebSocketRequest::create()
.setRequestKey3(createReadableStringFromBinary(request.key3().value, sizeof(request.key3().value)))
.setHeaders(buildObjectForHeaders(request.headerFields()));
m_frontend->webSocketWillSendHandshakeRequest(IdentifiersFactory::requestId(identifier), currentTime(), requestObject);
}
......@@ -511,8 +495,7 @@ void InspectorResourceAgent::didReceiveWebSocketHandshakeResponse(unsigned long
RefPtr<TypeBuilder::Network::WebSocketResponse> responseObject = TypeBuilder::Network::WebSocketResponse::create()
.setStatus(response.statusCode())
.setStatusText(response.statusText())
.setHeaders(buildObjectForHeaders(response.headerFields()))
.setChallengeResponse(createReadableStringFromBinary(response.challengeResponse().value, sizeof(response.challengeResponse().value)));
.setHeaders(buildObjectForHeaders(response.headerFields()));
m_frontend->webSocketHandshakeResponseReceived(IdentifiersFactory::requestId(identifier), currentTime(), responseObject);
}
......
......@@ -415,7 +415,6 @@ WebInspector.NetworkDispatcher.prototype = {
networkRequest.requestMethod = "GET";
networkRequest.requestHeaders = this._headersMapToHeadersArray(request.headers);
networkRequest.webSocketRequestKey3 = request.requestKey3;
networkRequest.startTime = time;
this._updateNetworkRequest(networkRequest);
......@@ -435,7 +434,6 @@ WebInspector.NetworkDispatcher.prototype = {
networkRequest.statusCode = response.status;
networkRequest.statusText = response.statusText;
networkRequest.responseHeaders = this._headersMapToHeadersArray(response.headers);
networkRequest.webSocketChallengeResponse = response.challengeResponse;
networkRequest.responseReceivedTime = time;
this._updateNetworkRequest(networkRequest);
......
......@@ -285,13 +285,10 @@ WebInspector.RequestHeadersView.prototype = {
_refreshRequestHeaders: function()
{
var additionalRow = null;
if (typeof this._request.webSocketRequestKey3 !== "undefined")
additionalRow = {name: "(Key3)", value: this._request.webSocketRequestKey3};
if (this._showRequestHeadersText)
this._refreshHeadersText(WebInspector.UIString("Request Headers"), this._request.sortedRequestHeaders, this._request.requestHeadersText, this._requestHeadersTreeElement);
else
this._refreshHeaders(WebInspector.UIString("Request Headers"), this._request.sortedRequestHeaders, additionalRow, this._requestHeadersTreeElement);
this._refreshHeaders(WebInspector.UIString("Request Headers"), this._request.sortedRequestHeaders, this._requestHeadersTreeElement);
if (this._request.requestHeadersText) {
var toggleButton = this._createHeadersToggleButton(this._showRequestHeadersText);
......@@ -304,13 +301,10 @@ WebInspector.RequestHeadersView.prototype = {
_refreshResponseHeaders: function()
{
var additionalRow = null;
if (typeof this._request.webSocketChallengeResponse !== "undefined")
additionalRow = {name: "(Challenge Response)", value: this._request.webSocketChallengeResponse};
if (this._showResponseHeadersText)
this._refreshHeadersText(WebInspector.UIString("Response Headers"), this._request.sortedResponseHeaders, this._request.responseHeadersText, this._responseHeadersTreeElement);
else
this._refreshHeaders(WebInspector.UIString("Response Headers"), this._request.sortedResponseHeaders, additionalRow, this._responseHeadersTreeElement);
this._refreshHeaders(WebInspector.UIString("Response Headers"), this._request.sortedResponseHeaders, this._responseHeadersTreeElement);
if (this._request.responseHeadersText) {
var toggleButton = this._createHeadersToggleButton(this._showResponseHeadersText);
......@@ -363,7 +357,7 @@ WebInspector.RequestHeadersView.prototype = {
headersTreeElement.listItemElement.appendChild(headerCount);
},
_refreshHeaders: function(title, headers, additionalRow, headersTreeElement)
_refreshHeaders: function(title, headers, headersTreeElement)
{
headersTreeElement.removeChildren();
......@@ -376,13 +370,6 @@ WebInspector.RequestHeadersView.prototype = {
headerTreeElement.selectable = false;
headersTreeElement.appendChild(headerTreeElement);
}
if (additionalRow) {
var headerTreeElement = new TreeElement(null, null, false);
headerTreeElement.title = this._formatHeader(additionalRow.name, additionalRow.value);
headerTreeElement.selectable = false;
headersTreeElement.appendChild(headerTreeElement);
}
},
_refreshHeadersText: function(title, headers, headersText, headersTreeElement)
......
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