Skip to content

Commit

Permalink
Adding some range request examples
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisguest75 committed Nov 27, 2023
1 parent 2bc1e63 commit f7643a1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
18 changes: 18 additions & 0 deletions 33_awscli/CLOUDFRONT.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,24 @@ aws --no-cli-pager cloudfront list-distributions | jq '.DistributionList.Items[]
aws --no-cli-pager cloudfront list-distributions | jq '.DistributionList.Items[2].Origins.Items[]'
```

## Range Requests

NOTE: `content-length` will be the full length of the binary.

```sh
# 1mb file
dd if=/dev/urandom of=random.bin bs=1024 count=1024
# upload to bucket
aws s3 cp ./random.bin s3://mybucket/random.bin
# pull a range of data
curl -s -H "Range: bytes=32-195" http://mybucket.s3-website-eu-west-1.am
azonaws.com/random.bin | xxd
# find distribution
aws --no-cli-pager cloudfront list-distributions | jq '.DistributionList.Items[] | [.DomainName, .Origins.Items[].DomainName ]'
# pull a range through cloudfront
curl -s -H "Range: bytes=32-195" http://mydistribution.cloudfront.net/random.bin | xxd
```

## Resources

* Force CloudFront distribution/file update [here](https://stackoverflow.com/questions/1268158/force-cloudfront-distribution-file-update)
Expand Down
10 changes: 10 additions & 0 deletions 61_curl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,20 @@ curl -H "Content-Type: application/json" -X POST -d '{"user":"bob","pass":"123"}
curl -vvvv -L http://0.0.0.0:8080/podinfo
```

### Range Requests

NOTE: `content-length` will be the full length of the binary.

```sh
# request a stream of bytes.
curl -s -H "Range: bytes=32-195" "http://mysite.com/random.bin" | xxd
```

## Resources

* stefanprodan/podinfo [repo](https://github.com/stefanprodan/podinfo)
* Avoiding the Top 10 NGINX Configuration Mistakes [here](https://www.nginx.com/blog/avoiding-top-10-nginx-configuration-mistakes/#analyzer)
* Installing NGINX Open Source [here](https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source)
* nginx documentation [here](https://nginx.org/en/docs/)
* How To Create Temporary and Permanent Redirects with Nginx [here](https://www.digitalocean.com/community/tutorials/how-to-create-temporary-and-permanent-redirects-with-nginx)
* HTTP range requests [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests)
1 change: 1 addition & 0 deletions 62_binary_files/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Working with binary files in shell.
TODO:

* hexdump, hexfiend, fq
* how can I create a file of little endian incrementing 16bit words?

## VSCode

Expand Down

0 comments on commit f7643a1

Please sign in to comment.