Skip to content

Commit

Permalink
Update example in overview section
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Scavo authored May 2, 2017
1 parent 64aa1e4 commit 0663d11
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ $ echo $?
$ ls -1 $CACHE_DIR
1e6b844a49d1850b82feded72cf83ed7_content
1e6b844a49d1850b82feded72cf83ed7_headers
cget_log.txt
$ cat $CACHE_DIR/1e6b844a49d1850b82feded72cf83ed7_headers
HTTP/1.1 200 OK
Date: Wed, 26 Apr 2017 16:29:44 GMT
Expand All @@ -93,29 +92,32 @@ Of course the ``-C`` option will fail if the resource is not cached:
```Shell
# illustrate "quiet failure mode"
$ $BIN_DIR/cget.sh -C $url2
2017-05-02T14:53:38Z INFO cget.sh requesting resource: http://md.incommon.org/InCommon/InCommon-metadata-fallback.xml
2017-05-02T14:53:38Z ERROR conditional_get: resource not cached: http://md.incommon.org/InCommon/InCommon-metadata-fallback.xml
$ echo $?
1
$ cat $CACHE_DIR/cget_log.txt | tail -n 2
2017-04-26T16:39:38Z INFO cget.sh requesting resource: http://md.incommon.org/InCommon/InCommon-metadata-fallback.xml
2017-04-26T16:39:38Z ERROR conditional_get: resource not cached: http://md.incommon.org/InCommon/InCommon-metadata-fallback.xml
```

OTOH, the ``-F`` option forces the return of a fresh resource from the server. If the resource is cached and unchanged on the server (304), such a request will fail, however:

```Shell
# again illustrate "quiet failure mode"
# further illustrate "quiet failure mode"
$ $BIN_DIR/cget.sh -F $url1
2017-05-02T14:54:37Z INFO cget.sh requesting resource: http://md.incommon.org/InCommon/InCommon-metadata-preview.xml
2017-05-02T14:54:38Z INFO conditional_get received response code: 304
2017-05-02T14:54:38Z ERROR conditional_get: resource not modified: http://md.incommon.org/InCommon/InCommon-metadata-preview.xml
$ echo $?
1
$ cat $CACHE_DIR/cget_log.txt | tail -n 2
2017-04-26T16:41:55Z INFO conditional_get received response code: 304
2017-04-26T16:41:55Z ERROR conditional_get: resource not modified: http://md.incommon.org/InCommon/InCommon-metadata-preview.xml
```

The ``-F`` option will work on the other URL, however:

```Shell
$ $BIN_DIR/cget.sh -F $url2 > /dev/null
2017-05-02T14:55:24Z INFO cget.sh requesting resource: http://md.incommon.org/InCommon/InCommon-metadata-fallback.xml
2017-05-02T14:55:30Z INFO conditional_get received response code: 200
2017-05-02T14:55:30Z INFO conditional_get writing cached content file: /tmp/http_cache/1727196e5b7593f3b7528c539e7169d2_content
2017-05-02T14:55:30Z INFO conditional_get reading cached content file: /tmp/http_cache/1727196e5b7593f3b7528c539e7169d2_content
$ echo $?
0
$ ls -1 $CACHE_DIR
Expand Down

0 comments on commit 0663d11

Please sign in to comment.