-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d07376e
Showing
13 changed files
with
220 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--------------------------------------------------------------------- | ||
|
||
HTTP Headers - https://www.paulhempshall.com/io/http-headers/ | ||
Copyright (C) 2016, Paul Hempshall. All rights reserved. | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
--------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# HTTP Headers  [](https://blockchain.info/address/1K1AhrU5JS8euypB3Vw2iGxXqsbwcf9kxN) | ||
|
||
A web browser extension that displays the current page's HTTP request and response. | ||
|
||
Currently available for Chrome | ||
|
||
## Installation | ||
|
||
Not available from the store. | ||
|
||
Download the latest package for your browser from the [releases](https://github.com/phempshall/http-headers/releases) page. | ||
|
||
|
||
|
||
## License | ||
|
||
HTTP Headers | ||
Copyright (C) 2016, Paul Hempshall. All rights reserved. | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
https://opensource.org/licenses/GPL-3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>HTTP Headers</title> | ||
</head> | ||
<body> | ||
<script src="fetchHeaders.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict'; | ||
|
||
var headers = {}; | ||
|
||
var filters = { | ||
urls: ["<all_urls>"], | ||
types: ["main_frame"] | ||
}; | ||
|
||
/* headers received */ | ||
chrome.webRequest.onHeadersReceived.addListener(function(details) { | ||
headers[details.tabId] = headers[details.tabId] || {}; | ||
headers[details.tabId].response = details; | ||
}, filters, ["responseHeaders"]); | ||
|
||
/* headers sent */ | ||
chrome.webRequest.onSendHeaders.addListener(function(details) { | ||
headers[details.tabId] = headers[details.tabId] || {}; | ||
headers[details.tabId].request = details; | ||
}, filters, ["requestHeaders"]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>HTTP Headers</title> | ||
<script src="headersPopup.js"></script> | ||
<style> | ||
body { | ||
min-width: 420px; | ||
max-height: 740px; | ||
overflow-y: auto; | ||
color: #383838; | ||
} | ||
p { | ||
word-break: break-all; | ||
margin: 0; | ||
background: #fcfcfc; | ||
padding: .25em .15em; | ||
border: 1px solid #e8e8e8; | ||
border-top: 0; | ||
} | ||
.error-text { | ||
font-weight: 700; | ||
color: #c03; | ||
border-top: 1px solid #e8e8e8; | ||
} | ||
h1{ | ||
border-bottom: 1px solid #f9f9f9; | ||
margin: 0 0 .5em; | ||
} | ||
h2 { | ||
margin: 1.25em 0 0 0; | ||
padding: 0 0 .75em 0; | ||
font-size: 1.4em; | ||
line-height: 1em; | ||
border-bottom: 1px solid #e8e8e8; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<h1> | ||
HTTP Headers | ||
</h1> | ||
|
||
<div id="results"></div> | ||
|
||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
'use strict'; | ||
|
||
chrome.tabs.query({active: true, currentWindow: true}, function(tab) { | ||
var results = document.getElementById('results'), | ||
headers = chrome.extension.getBackgroundPage().headers[tab[0].id]; | ||
|
||
function printError () { | ||
var error = { | ||
container: document.createElement('p'), | ||
text: document.createTextNode("Error: could not get http headers, please try refreshing the page.") | ||
} | ||
error.container.className = "error-text"; | ||
error.container.appendChild(error.text) | ||
results.appendChild(error.container); | ||
} | ||
|
||
function printResults () { | ||
Object.keys(headers).forEach(function(key) { | ||
console.log(headers[key]); | ||
headers[key][key + 'Headers'].sort(function(a,b) {return (a.name > b.name) ? 1 : ((b.name > a.name) ? -1 : 0);}); | ||
|
||
printHeading(key); | ||
|
||
for (var i = 0; i < headers[key][key + 'Headers'].length; i++) { | ||
printHeader(headers[key][key + 'Headers'][i]); | ||
} | ||
}); | ||
|
||
function printHeading (key) { | ||
var n = key[0].toUpperCase() + key.substring(1); | ||
var h = document.createElement('h2'), | ||
t = document.createTextNode(n); | ||
h.appendChild(t); | ||
results.appendChild(h); | ||
} | ||
|
||
function printHeader (obj) { | ||
var p = document.createElement('p'), | ||
b = document.createElement('b'), | ||
t_name = document.createTextNode(obj.name + ': '), | ||
t_value = document.createTextNode(obj.value); | ||
b.appendChild(t_name); | ||
|
||
p.appendChild(b); | ||
p.appendChild(t_value); | ||
results.appendChild(p); | ||
} | ||
} | ||
|
||
|
||
if (headers === undefined) { | ||
printError(); | ||
} | ||
else { | ||
printResults(); | ||
} | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"manifest_version": 2, | ||
"author": "Paul Hempshall", | ||
|
||
"name": "HTTP Headers", | ||
"version": "1.0.0", | ||
"description": "This extension will show you the current HTTP headers", | ||
|
||
"background": { | ||
"page": "fetchHeaders.html" | ||
}, | ||
|
||
"browser_action": { | ||
"default_title": "HTTP Headers", | ||
"default_popup": "headersPopup.html" | ||
}, | ||
|
||
"icons": { | ||
"16": "icon-16.png", | ||
"32": "icon-32.png", | ||
"48": "icon-48.png", | ||
"64": "icon-64.png", | ||
"128": "icon-128.png", | ||
"256": "icon-256.png" | ||
}, | ||
|
||
"permissions": [ | ||
"webRequest", | ||
"webRequestBlocking", | ||
"tabs", | ||
"*://*/*" | ||
] | ||
} |