Skip to content

Commit

Permalink
Add example to Overview section
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Scavo authored Jun 11, 2017
1 parent 51738e1 commit f4de339
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Note: Some OSes define `TMPDIR` and some do not. In any case, a temporary direct

## Logging

For convenience, we will log directly to the terminal:
For convenience, we will log directly to the terminal in the examples below:

```Shell
$ export LOG_FILE=/dev/tty
Expand All @@ -82,6 +82,50 @@ The default logging level is INFO (i.e., if you do not explicitly set the option

## Overview

First define a couple of HTTP resources and a cache:

```Shell
$ url1=http://md.incommon.org/InCommon/InCommon-metadata-preview.xml
$ url2=http://md.incommon.org/InCommon/InCommon-metadata-fallback.xml
$ export CACHE_DIR=/tmp/http_cache
```

### `request_http_resources.sh`

Bash script `request_http_resources.sh` issues a HEAD request for one or more HTTP resources:

```Shell
$ $BIN_DIR/request_http_resources.sh -d /tmp/out $url1 $url2
2017-06-11T02:26:26Z INFO request_http_resources.sh BEGIN
2017-06-11T02:26:26Z INFO request_http_resources.sh requesting resource: http://md.incommon.org/InCommon/InCommon-metadata-preview.xml
2017-06-11T02:26:26Z INFO request_http_resources.sh requesting resource: http://md.incommon.org/InCommon/InCommon-metadata-fallback.xml
2017-06-11T02:26:26Z INFO request_http_resources.sh writing output file: http_response_headers.json
2017-06-11T02:26:26Z INFO request_http_resources.sh moving output file to dir: /tmp/out
2017-06-11T02:26:26Z INFO request_http_resources.sh END
```

The script produces a JSON array containing objects such as the following:

```JavaScript
{
"successFlag": true,
"message": "Resource request successful",
"location": "http://md.incommon.org/InCommon/InCommon-metadata-preview.xml",
"ResponseCode": "200",
"Date": "Sun, 11 Jun 2017 02:16:44 GMT",
"LastModified": "Fri, 09 Jun 2017 19:05:16 GMT",
"ETag": "\"2a96bf6-5518ba65a0c50\"",
"ContentLength": "44657654",
"ContentType": "application/samlmetadata+xml"
}
```

See the inline help file for details:

```Shell
$ $BIN_DIR/request_http_resources.sh -h
```

### `cget.sh`

Bash script `cget.sh` retrieves and caches HTTP resources on disk. A previously cached resource is retrieved via HTTP Conditional GET [RFC 7232]. If the web server responds with HTTP 200 OK, the resource is cached and written to stdout. If the web server responds with 304 Not Modified, the cached resource is output instead.
Expand Down Expand Up @@ -182,6 +226,14 @@ See the inline help file for details:
$ $BIN_DIR/cget.sh -h
```

### `compute_md_vital_stats.sh`

TBD

### `test_compressed_resources.sh`

TBD

## Compatibility

Shell scripts are compatible with both GNU/Linux and Mac OS. XSLT scripts are written in XSLT 1.0.
Expand Down

0 comments on commit f4de339

Please sign in to comment.