har 0.0.1.dev

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. data/.gitignore +4 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +24 -0
  5. data/README.mdown +36 -0
  6. data/Rakefile +28 -0
  7. data/bin/har +4 -0
  8. data/har.gemspec +27 -0
  9. data/lib/har.rb +32 -0
  10. data/lib/har/archive.rb +135 -0
  11. data/lib/har/page.rb +19 -0
  12. data/lib/har/schema_type.rb +78 -0
  13. data/lib/har/schemas/browserType +19 -0
  14. data/lib/har/schemas/cacheEntryType +25 -0
  15. data/lib/har/schemas/cacheType +15 -0
  16. data/lib/har/schemas/contentType +26 -0
  17. data/lib/har/schemas/cookieType +32 -0
  18. data/lib/har/schemas/creatorType +18 -0
  19. data/lib/har/schemas/entryType +46 -0
  20. data/lib/har/schemas/logType +40 -0
  21. data/lib/har/schemas/pageTimingsType +17 -0
  22. data/lib/har/schemas/pageType +29 -0
  23. data/lib/har/schemas/postDataType +38 -0
  24. data/lib/har/schemas/recordType +17 -0
  25. data/lib/har/schemas/requestType +53 -0
  26. data/lib/har/schemas/responseType +51 -0
  27. data/lib/har/schemas/timingsType +43 -0
  28. data/lib/har/serializable.rb +22 -0
  29. data/lib/har/version.rb +3 -0
  30. data/lib/har/viewer.rb +99 -0
  31. data/lib/har/viewer/css/SyntaxHighlighter.css +1 -0
  32. data/lib/har/viewer/css/aboutTab.css +1 -0
  33. data/lib/har/viewer/css/domTab.css +1 -0
  34. data/lib/har/viewer/css/domTree.css +1 -0
  35. data/lib/har/viewer/css/harPreview.css +1 -0
  36. data/lib/har/viewer/css/harView.css +1 -0
  37. data/lib/har/viewer/css/harViewer.css +1 -0
  38. data/lib/har/viewer/css/homeTab.css +1 -0
  39. data/lib/har/viewer/css/images/ajax-loader.gif +0 -0
  40. data/lib/har/viewer/css/images/bg-button.gif +0 -0
  41. data/lib/har/viewer/css/images/blank.gif +0 -0
  42. data/lib/har/viewer/css/images/button-background.png +0 -0
  43. data/lib/har/viewer/css/images/checkmark.gif +0 -0
  44. data/lib/har/viewer/css/images/checkmark.png +0 -0
  45. data/lib/har/viewer/css/images/close-sprites.png +0 -0
  46. data/lib/har/viewer/css/images/contextMenuTarget.png +0 -0
  47. data/lib/har/viewer/css/images/contextMenuTargetHover.png +0 -0
  48. data/lib/har/viewer/css/images/download-sprites.png +0 -0
  49. data/lib/har/viewer/css/images/downloadButtons-aero.png +0 -0
  50. data/lib/har/viewer/css/images/group.gif +0 -0
  51. data/lib/har/viewer/css/images/loading_16.gif +0 -0
  52. data/lib/har/viewer/css/images/menu/Thumbs.db +0 -0
  53. data/lib/har/viewer/css/images/menu/shadowAlpha.png +0 -0
  54. data/lib/har/viewer/css/images/menu/tabMenuCheckbox.png +0 -0
  55. data/lib/har/viewer/css/images/menu/tabMenuPin.png +0 -0
  56. data/lib/har/viewer/css/images/menu/tabMenuRadio.png +0 -0
  57. data/lib/har/viewer/css/images/netBarBlocking.gif +0 -0
  58. data/lib/har/viewer/css/images/netBarBlocking2.gif +0 -0
  59. data/lib/har/viewer/css/images/netBarCached.gif +0 -0
  60. data/lib/har/viewer/css/images/netBarConnecting.gif +0 -0
  61. data/lib/har/viewer/css/images/netBarLoaded.gif +0 -0
  62. data/lib/har/viewer/css/images/netBarReceiving.gif +0 -0
  63. data/lib/har/viewer/css/images/netBarResolving.gif +0 -0
  64. data/lib/har/viewer/css/images/netBarResponded.gif +0 -0
  65. data/lib/har/viewer/css/images/netBarSending.gif +0 -0
  66. data/lib/har/viewer/css/images/netBarWaiting.gif +0 -0
  67. data/lib/har/viewer/css/images/page-timeline.png +0 -0
  68. data/lib/har/viewer/css/images/save.png +0 -0
  69. data/lib/har/viewer/css/images/spriteArrows.gif +0 -0
  70. data/lib/har/viewer/css/images/spriteArrows.png +0 -0
  71. data/lib/har/viewer/css/images/tabEnabled.png +0 -0
  72. data/lib/har/viewer/css/images/timeline-sprites.png +0 -0
  73. data/lib/har/viewer/css/images/tooltipConnectorUp.png +0 -0
  74. data/lib/har/viewer/css/images/twisty-sprites.png +0 -0
  75. data/lib/har/viewer/css/images/twistyClosed.png +0 -0
  76. data/lib/har/viewer/css/images/twistyOpen.png +0 -0
  77. data/lib/har/viewer/css/infoTip.css +1 -0
  78. data/lib/har/viewer/css/pageList.css +1 -0
  79. data/lib/har/viewer/css/pageStats.css +1 -0
  80. data/lib/har/viewer/css/pageTimeline.css +1 -0
  81. data/lib/har/viewer/css/popupMenu.css +1 -0
  82. data/lib/har/viewer/css/previewTab.css +1 -0
  83. data/lib/har/viewer/css/requestBody.css +1 -0
  84. data/lib/har/viewer/css/requestList.css +1 -0
  85. data/lib/har/viewer/css/schemaTab.css +1 -0
  86. data/lib/har/viewer/css/tabView.css +1 -0
  87. data/lib/har/viewer/css/toolTip.css +1 -0
  88. data/lib/har/viewer/css/toolbar.css +1 -0
  89. data/lib/har/viewer/css/xhrSpy.css +1 -0
  90. data/lib/har/viewer/index.html +13 -0
  91. data/lib/har/viewer/scripts/app.build.js +0 -0
  92. data/lib/har/viewer/scripts/core/cookies.js +2 -0
  93. data/lib/har/viewer/scripts/core/lib.js +23 -0
  94. data/lib/har/viewer/scripts/core/trace.js +26 -0
  95. data/lib/har/viewer/scripts/domplate/domTree.js +5 -0
  96. data/lib/har/viewer/scripts/domplate/domplate.js +263 -0
  97. data/lib/har/viewer/scripts/domplate/infoTip.js +4 -0
  98. data/lib/har/viewer/scripts/domplate/popupMenu.js +14 -0
  99. data/lib/har/viewer/scripts/domplate/tabView.js +6 -0
  100. data/lib/har/viewer/scripts/domplate/toolTip.js +3 -0
  101. data/lib/har/viewer/scripts/domplate/toolbar.js +3 -0
  102. data/lib/har/viewer/scripts/downloadify/LICENSE.txt +22 -0
  103. data/lib/har/viewer/scripts/downloadify/README.textile +89 -0
  104. data/lib/har/viewer/scripts/downloadify/js/downloadify.min.js +6 -0
  105. data/lib/har/viewer/scripts/downloadify/js/swfobject.js +18 -0
  106. data/lib/har/viewer/scripts/downloadify/media/downloadify.swf +0 -0
  107. data/lib/har/viewer/scripts/downloadify/src/Downloadify.as +162 -0
  108. data/lib/har/viewer/scripts/downloadify/src/downloadify.js +6 -0
  109. data/lib/har/viewer/scripts/excanvas/excanvas.js +21 -0
  110. data/lib/har/viewer/scripts/harPreview.js +149 -0
  111. data/lib/har/viewer/scripts/harViewer.js +244 -0
  112. data/lib/har/viewer/scripts/jquery-plugins/jquery.json.js +6 -0
  113. data/lib/har/viewer/scripts/nls/harViewer.js +1 -0
  114. data/lib/har/viewer/scripts/nls/homeTab.js +1 -0
  115. data/lib/har/viewer/scripts/nls/pageStats.js +2 -0
  116. data/lib/har/viewer/scripts/nls/pageTimeline.js +1 -0
  117. data/lib/har/viewer/scripts/nls/previewTab.js +1 -0
  118. data/lib/har/viewer/scripts/nls/requestBody.js +1 -0
  119. data/lib/har/viewer/scripts/nls/requestList.js +2 -0
  120. data/lib/har/viewer/scripts/preview/harModel.js +7 -0
  121. data/lib/har/viewer/scripts/preview/harSchema.js +308 -0
  122. data/lib/har/viewer/scripts/preview/jsonSchema.js +7 -0
  123. data/lib/har/viewer/scripts/preview/pageList.js +4 -0
  124. data/lib/har/viewer/scripts/preview/ref.js +5 -0
  125. data/lib/har/viewer/scripts/preview/requestBody.js +11 -0
  126. data/lib/har/viewer/scripts/preview/requestList.js +27 -0
  127. data/lib/har/viewer/scripts/requireplugins-jquery-1.4.2.js +204 -0
  128. data/lib/har/viewer/scripts/syntax-highlighter/README.txt +9 -0
  129. data/lib/har/viewer/scripts/syntax-highlighter/shCore.js +20 -0
  130. data/lib/har/viewer/scripts/tabs/aboutTab.html +93 -0
  131. data/lib/har/viewer/scripts/tabs/aboutTab.js +2 -0
  132. data/lib/har/viewer/scripts/tabs/domTab.js +1 -0
  133. data/lib/har/viewer/scripts/tabs/homeTab.html +34 -0
  134. data/lib/har/viewer/scripts/tabs/homeTab.js +5 -0
  135. data/lib/har/viewer/scripts/tabs/pageStats.js +14 -0
  136. data/lib/har/viewer/scripts/tabs/pageTimeline.js +10 -0
  137. data/lib/har/viewer/scripts/tabs/previewTab.js +6 -0
  138. data/lib/har/viewer/scripts/tabs/schemaTab.js +2 -0
  139. data/lib/har/viewer/scripts/xhr-spy/spy.js +2 -0
  140. data/lib/har/viewer/scripts/xhr-spy/spy.php +13 -0
  141. data/lib/har/viewer/scripts/xhr-spy/xhr.js +6 -0
  142. data/lib/har/viewer/scripts/xhr-spy/xhrSpyBookmarklet.js +1 -0
  143. data/schema.json +201 -0
  144. data/spec/fixtures/entry1.json +124 -0
  145. data/spec/fixtures/hars/bad.har +2563 -0
  146. data/spec/fixtures/hars/browser-blocking-time.har +2567 -0
  147. data/spec/fixtures/hars/google.com.har +612 -0
  148. data/spec/fixtures/hars/inline-scripts-block.har +1066 -0
  149. data/spec/fixtures/hars/softwareishard.com.har +5323 -0
  150. data/spec/har/archive_spec.rb +130 -0
  151. data/spec/har/entry_spec.rb +16 -0
  152. data/spec/har/page_spec.rb +24 -0
  153. data/spec/har/viewer_spec.rb +17 -0
  154. data/spec/spec_helper.rb +34 -0
  155. metadata +283 -0
@@ -0,0 +1,15 @@
1
+ {
2
+ "id": "cacheType",
3
+ "description": "Info about a response coming from the cache.",
4
+ "properties": {
5
+ "beforeRequest": {
6
+ "$ref": "cacheEntryType"
7
+ },
8
+ "afterRequest": {
9
+ "$ref": "cacheEntryType"
10
+ },
11
+ "comment": {
12
+ "type": "string"
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "id": "contentType",
3
+ "description": "Response content",
4
+ "properties": {
5
+ "size": {
6
+ "type": "integer",
7
+ "required": true
8
+ },
9
+ "compression": {
10
+ "type": "integer"
11
+ },
12
+ "mimeType": {
13
+ "type": "string",
14
+ "required": true
15
+ },
16
+ "text": {
17
+ "type": "string"
18
+ },
19
+ "encoding": {
20
+ "type": "string"
21
+ },
22
+ "comment": {
23
+ "type": "string"
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "id": "cookieType",
3
+ "description": "Cookie description.",
4
+ "properties": {
5
+ "name": {
6
+ "type": "string",
7
+ "required": true
8
+ },
9
+ "value": {
10
+ "type": "string",
11
+ "required": true
12
+ },
13
+ "path": {
14
+ "type": "string"
15
+ },
16
+ "domain": {
17
+ "type": "string"
18
+ },
19
+ "expires": {
20
+ "type": "string"
21
+ },
22
+ "httpOnly": {
23
+ "type": "boolean"
24
+ },
25
+ "secure": {
26
+ "type": "boolean"
27
+ },
28
+ "comment": {
29
+ "type": "string"
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "id": "creatorType",
3
+ "description": "Name and version info of the log creator app.",
4
+ "type": "object",
5
+ "properties": {
6
+ "name": {
7
+ "type": "string",
8
+ "required": true
9
+ },
10
+ "version": {
11
+ "type": "string",
12
+ "required": true
13
+ },
14
+ "comment": {
15
+ "type": "string"
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "id": "entryType",
3
+ "description": "Request and Response related info",
4
+ "optional": true,
5
+ "properties": {
6
+ "pageref": {
7
+ "type": "string"
8
+ },
9
+ "startedDateTime": {
10
+ "type": "string",
11
+ "format": "date-time",
12
+ "pattern": "^(\\d{4})(-)?(\\d\\d)(-)?(\\d\\d)(T)?(\\d\\d)(:)?(\\d\\d)(:)?(\\d\\d)(\\.\\d+)?(Z|([+-])(\\d\\d)(:)?(\\d\\d))",
13
+ "required": true
14
+ },
15
+ "time": {
16
+ "type": "integer",
17
+ "min": 0,
18
+ "required": true
19
+ },
20
+ "request": {
21
+ "$ref": "requestType",
22
+ "required": true
23
+ },
24
+ "response": {
25
+ "$ref": "responseType",
26
+ "required": true
27
+ },
28
+ "cache": {
29
+ "$ref": "cacheType",
30
+ "required": true
31
+ },
32
+ "timings": {
33
+ "$ref": "timingsType",
34
+ "required": true
35
+ },
36
+ "serverIPAddress": {
37
+ "type": "string"
38
+ },
39
+ "connection": {
40
+ "type": "string"
41
+ },
42
+ "comment": {
43
+ "type": "string"
44
+ }
45
+ }
46
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "id": "logType",
3
+ "description": "HTTP Archive structure.",
4
+ "type": "object",
5
+ "properties": {
6
+ "log": {
7
+ "type": "object",
8
+ "properties": {
9
+ "version": {
10
+ "type": "string",
11
+ "required": true
12
+ },
13
+ "creator": {
14
+ "$ref": "creatorType",
15
+ "required": true
16
+ },
17
+ "browser": {
18
+ "$ref": "browserType",
19
+ "required": true
20
+ },
21
+ "pages": {
22
+ "type": "array",
23
+ "items": {
24
+ "$ref": "pageType"
25
+ }
26
+ },
27
+ "entries": {
28
+ "type": "array",
29
+ "items": {
30
+ "$ref": "entryType"
31
+ },
32
+ "required": true
33
+ },
34
+ "comment": {
35
+ "type": "string"
36
+ }
37
+ }
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "id": "pageTimingsType",
3
+ "description": "Timing info about page load",
4
+ "properties": {
5
+ "onContentLoad": {
6
+ "type": "number",
7
+ "min": -1
8
+ },
9
+ "onLoad": {
10
+ "type": "number",
11
+ "min": -1
12
+ },
13
+ "comment": {
14
+ "type": "string"
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "id": "pageType",
3
+ "description": "Exported web page",
4
+ "optional": true,
5
+ "properties": {
6
+ "startedDateTime": {
7
+ "type": "string",
8
+ "format": "date-time",
9
+ "pattern": "^(\\d{4})(-)?(\\d\\d)(-)?(\\d\\d)(T)?(\\d\\d)(:)?(\\d\\d)(:)?(\\d\\d)(\\.\\d+)?(Z|([+-])(\\d\\d)(:)?(\\d\\d))",
10
+ "required": true
11
+ },
12
+ "id": {
13
+ "type": "string",
14
+ "unique": true,
15
+ "required": true
16
+ },
17
+ "title": {
18
+ "type": "string",
19
+ "required": true
20
+ },
21
+ "pageTimings": {
22
+ "$ref": "pageTimingsType",
23
+ "required": true
24
+ },
25
+ "comment": {
26
+ "type": "string"
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "id": "postDataType",
3
+ "description": "Posted data info.",
4
+ "optional": true,
5
+ "properties": {
6
+ "mimeType": {
7
+ "type": "string",
8
+ "required": true
9
+ },
10
+ "text": {
11
+ "type": "string"
12
+ },
13
+ "params": {
14
+ "type": "array",
15
+ "properties": {
16
+ "name": {
17
+ "type": "string",
18
+ "required": true
19
+ },
20
+ "value": {
21
+ "type": "string"
22
+ },
23
+ "fileName": {
24
+ "type": "string"
25
+ },
26
+ "contentType": {
27
+ "type": "string"
28
+ },
29
+ "comment": {
30
+ "type": "string"
31
+ }
32
+ }
33
+ },
34
+ "comment": {
35
+ "type": "string"
36
+ }
37
+ }
38
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "id": "recordType",
3
+ "description": "Helper name-value pair structure.",
4
+ "properties": {
5
+ "name": {
6
+ "type": "string",
7
+ "required": true
8
+ },
9
+ "value": {
10
+ "type": "string",
11
+ "required": true
12
+ },
13
+ "comment": {
14
+ "type": "string"
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,53 @@
1
+ {
2
+ "id": "requestType",
3
+ "description": "Monitored request",
4
+ "properties": {
5
+ "method": {
6
+ "type": "string",
7
+ "required": true
8
+ },
9
+ "url": {
10
+ "type": "string",
11
+ "required": true
12
+ },
13
+ "httpVersion": {
14
+ "type": "string",
15
+ "required": true
16
+ },
17
+ "cookies": {
18
+ "type": "array",
19
+ "items": {
20
+ "$ref": "cookieType"
21
+ },
22
+ "required": true
23
+ },
24
+ "headers": {
25
+ "type": "array",
26
+ "items": {
27
+ "$ref": "recordType"
28
+ },
29
+ "required": true
30
+ },
31
+ "queryString": {
32
+ "type": "array",
33
+ "items": {
34
+ "$ref": "recordType"
35
+ },
36
+ "required": true
37
+ },
38
+ "postData": {
39
+ "$ref": "postDataType"
40
+ },
41
+ "headersSize": {
42
+ "type": "integer",
43
+ "required": true
44
+ },
45
+ "bodySize": {
46
+ "type": "integer",
47
+ "required": true
48
+ },
49
+ "comment": {
50
+ "type": "string"
51
+ }
52
+ }
53
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "id": "responseType",
3
+ "description": "Monitored Response.",
4
+ "properties": {
5
+ "status": {
6
+ "type": "integer",
7
+ "required": true
8
+ },
9
+ "statusText": {
10
+ "type": "string",
11
+ "required": true
12
+ },
13
+ "httpVersion": {
14
+ "type": "string",
15
+ "required": true
16
+ },
17
+ "cookies": {
18
+ "type": "array",
19
+ "items": {
20
+ "$ref": "cookieType"
21
+ },
22
+ "required": true
23
+ },
24
+ "headers": {
25
+ "type": "array",
26
+ "items": {
27
+ "$ref": "recordType"
28
+ },
29
+ "required": true
30
+ },
31
+ "content": {
32
+ "$ref": "contentType",
33
+ "required": true
34
+ },
35
+ "redirectURL": {
36
+ "type": "string",
37
+ "required": true
38
+ },
39
+ "headersSize": {
40
+ "type": "integer",
41
+ "required": true
42
+ },
43
+ "bodySize": {
44
+ "type": "integer",
45
+ "required": true
46
+ },
47
+ "comment": {
48
+ "type": "string"
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "id": "timingsType",
3
+ "description": "Info about request-response timing.",
4
+ "properties": {
5
+ "dns": {
6
+ "type": "integer",
7
+ "min": -1,
8
+ "required": true
9
+ },
10
+ "connect": {
11
+ "type": "integer",
12
+ "min": -1,
13
+ "required": true
14
+ },
15
+ "blocked": {
16
+ "type": "integer",
17
+ "min": -1,
18
+ "required": true
19
+ },
20
+ "send": {
21
+ "type": "integer",
22
+ "min": -1,
23
+ "required": true
24
+ },
25
+ "wait": {
26
+ "type": "integer",
27
+ "min": -1,
28
+ "required": true
29
+ },
30
+ "receive": {
31
+ "type": "integer",
32
+ "min": -1,
33
+ "required": true
34
+ },
35
+ "ssl": {
36
+ "type": "integer",
37
+ "min": -1
38
+ },
39
+ "comment": {
40
+ "type": "string"
41
+ }
42
+ }
43
+ }
@@ -0,0 +1,22 @@
1
+ module HAR
2
+ module Serializable
3
+ def inspect
4
+ '#<%s:0x%s>' % [self.class.name, self.hash.to_s(16)]
5
+ end
6
+
7
+ def ==(other)
8
+ other.kind_of?(self.class) && as_json == other.as_json
9
+ end
10
+
11
+ alias_method :eql?, :==
12
+
13
+ def as_json
14
+ @data
15
+ end
16
+
17
+ def to_json(*args)
18
+ as_json.to_json(*args)
19
+ end
20
+
21
+ end
22
+ end