Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Expand HTTP request response monitoring

Josh Matthews edited this pageSep 17, 2015 ·4 revisions

Expand HTTP request/response monitoring

Background information: Firefox supportsremote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by exposing further information about HTTP requests and responses that web content initiates.

Initial steps:

  • compile Servo and ensure that it runs ontests/html/about-mozilla.html
  • email themozilla.dev.servo mailing list introducing your group and your progress
  • find an interesting site that doesn't crash Servo andattach the developer tools; look for network requests that are logged when navigating, for example.
  • address the TODOs inhttp_loader.rs related to only sending messages if there is a PipelineId present (ie.LoadData::pipeline_id), and add a test for the new behaviour totests/unit/net/http_loader.rs
  • refactor duplicate calls tosend_request_to_devtools to avoid repetition
  • pass values tosend_request_to_devtools derived from the actual request (eg.req.headers_mut()), instead of the originalLoadData, and add a test for the new behaviour totests/unit/net/http_loader.rs
  • add anOption<PipelineId> argument toload_whole_resource and pass it to theLoadData constructor

Subsequent steps:

  • implement thegetRequestHeaders/getRequestPostData message handlers incomponents/devtools/actors/network_event.rs based on the values in theHttpReqest struct
  • add support for more flavours of thenetworkEventUpdate message than justresponseStart, by building theNetworkEventUpdateMsg` from a freeform JSON object instead of a serialized struct declaration
  • send real values for the fields ofResponseStartMsg (requires obtaining those values inhttp_loader.rs and sending them insend_response_to_devtools)
  • implement thegetRequestCookies andgetResponseCookies message handlers incomponents/devtools/actors/network_event.rs based on theCookie/Set-Cookie headers in theHttpRequest/HttpResponse structs
  • implement thegetResponseContent/getResponseHeaders message handlers based on the data obtained inadd_http_response
  • implement remaining flavours ofnetworkEventUpdate message
  • address the TODO forevent_actor innetwork_event.rs by providing the missing information as part of the original message transmitted bysend_request_to_devtools

Combined, all of these changes should improve the accuracy of the information displayed by the Firefox web console when looking at logged information about network requests.

Other useful informationLive packet dumps captured from a Firefox session. This is ideally what the messages that Servo's server sends to Firefox should resemble:

{  "from": "server1.conn0.consoleActor2",  "type": "networkEvent",  "eventActor": {    "actor": "server1.conn0.netEvent45",    "startedDateTime": "2015-04-22T20:47:08.545Z",    "url": "https://aus4.mozilla.org/update/3/Firefox/40.0a1/20150421152828/Darwin_x86_64-gcc3/en-US/default/Darwin%2013.4.0/default/default/update.xml?force=1",    "method": "GET",    "isXHR": true,    "private": false  }}{  "from": "server1.conn0.netEvent45",  "type": "networkEventUpdate",  "updateType": "requestCookies",  "cookies": 4}{  "from": "server1.conn0.netEvent45",  "type": "networkEventUpdate",  "updateType": "responseStart",  "response": {    "httpVersion": "HTTP/1.1",    "remoteAddress": "63.245.217.43",    "remotePort": 443,    "status": "200",    "statusText": "OK",    "headersSize": 337,    "discardResponseBody": true  }}{  "from": "server1.conn0.netEvent45",  "type": "networkEventUpdate",  "updateType": "securityInfo",  "state": "secure"}{  "from": "server1.conn0.netEvent45",  "type": "networkEventUpdate",  "updateType": "responseHeaders",  "headers": 9,  "headersSize": 337}{  "from": "server1.conn0.netEvent45",  "type": "networkEventUpdate",  "updateType": "responseCookies",  "cookies": 0}{  "from": "server1.conn0.netEvent45",  "type": "networkEventUpdate",  "updateType": "eventTimings",  "totalTime": 798}{  "from": "server1.conn0.netEvent45",  "type": "networkEventUpdate",  "updateType": "responseContent",  "mimeType": "text/xml; charset=utf-8",  "contentSize": 0,  "transferredSize": 42,  "discardResponseBody": true}

Clone this wiki locally


[8]ページ先頭

©2009-2025 Movatter.jp