Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/integralist/bash-headers
A CLI HTTP Headers Filtering Tool (written in Bash)
https://github.com/integralist/bash-headers
bash bash-script bashrc cli cli-toolkit http http-client http-header http-response response tool
Last synced: about 1 month ago
JSON representation
A CLI HTTP Headers Filtering Tool (written in Bash)
- Host: GitHub
- URL: https://github.com/integralist/bash-headers
- Owner: Integralist
- License: mit
- Created: 2017-03-04T10:16:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-04-07T13:54:31.000Z (over 7 years ago)
- Last Synced: 2024-08-07T18:44:25.237Z (3 months ago)
- Topics: bash, bash-script, bashrc, cli, cli-toolkit, http, http-client, http-header, http-response, response, tool
- Language: Shell
- Size: 3.91 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bash Headers
A CLI HTTP Headers Filtering Tool (written in Bash)
> Note: before this I had built a Go version called "[carbon](https://github.com/Integralist/carbon)"
## Install
Either source this script within your `.bashrc` or copy/paste it directly
## Usage
Set endpoint and filter out specific HTTP response headers:
```bash
$ headers http://www.integralist.co.uk/ 'x-cache|x-timer'HTTP/1.1 200 OK
X-Cache-Hits: 1
X-Cache: HIT
X-Timer: S1488622963.657342,VS0,VE0
```Set endpoint but default to showing all the available HTTP response headers (sorted alphabetically):
```bash
$ headers http://www.integralist.co.uk/HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Age: 9
Cache-Control: max-age=600
Connection: keep-alive
Content-Length: 8165
Content-Type: text/html; charset=utf-8
Date: Sat, 04 Mar 2017 10:21:37 GMT
Expires: Sat, 04 Mar 2017 10:31:28 GMT
Fastly-Debug-Digest: 8e24d54087128488953c21c63c67485d543224e740f857d4e799563fb18db6fa
Fastly-Debug-Path: (D cache-lcy1120-LCY 1488622897) (F cache-lcy1137-LCY 1488622888)
Fastly-Debug-TTL: (H cache-lcy1120-LCY - - 9)
HTTP/1.1 200 OK
Last-Modified: Fri, 03 Mar 2017 08:33:36 GMT
Server: GitHub.com
Surrogate-Key: www_integralist_co_uk
Vary: Accept-Encoding
Via: 1.1 varnish
X-Cache-Hits: 1
X-Cache: HIT
X-Fastly-Request-ID: f44a92925b0203579bb51431f431ad056177a6d8
X-GitHub-Request-Id: 6564:04D4:2D3D0E:3D7C1C:58BA9525
X-Served-By: cache-lcy1120-LCY
X-Timer: S1488622897.811340,VS0,VE0
```No parameters will display general usage examples:
```bash
$ headersExamples:
headers https://www.buzzfeed.com/?country=us 'x-cache|x-timer|device' '-H User-Agent:iphone'
headers https://www.buzzfeed.com/?country=us '' '-H User-Agent:iphone -H X-Foo:bar'Help: headers -h
headers -help
```Help flag (`-h` or `-help`):
```bash
$ headers -h1st param: URL
2nd param: regex
3rd param: http request headerif you have no need for a regex
but need a http header
then just use an empty string ''
```