Skip to content

Commit aec8bd0

Browse files
authored
Merge pull request #77 from vic-ma/update-stage-10
Update stage 10 instructions
2 parents dea1d6a + a7a2c63 commit aec8bd0

File tree

1 file changed

+28
-35
lines changed

1 file changed

+28
-35
lines changed

course-definition.yml

Lines changed: 28 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -727,65 +727,58 @@ stages:
727727
name: "Multiple compression schemes"
728728
difficulty: medium
729729
description_md: |
730-
In this stage, you'll add support for choosing a compression scheme when multiple values are passed in via the `Accept-Encoding` header.
730+
In this stage, you'll add support for `Accept-Encoding` headers that contain multiple compression schemes.
731731
732-
### Tests
733-
734-
The tester will execute your program like this:
732+
### Multiple compression schemes
735733
736-
```bash
737-
./your_server.sh
734+
A client can specify that it supports multiple compression schemes by setting `Accept-Encoding` to a comma-separated list:
735+
```
736+
Accept-Encoding: encoding-1, encoding-2, encoding-3
738737
```
739738
740-
It'll then send an HTTP `GET` request to the `/echo/<a-random-string>` endpoint. In the request, it'll include an Accept-Encoding header set to multiple values, like: `Accept-Encoding: encoding-1, gzip, encoding-2`.
741-
One of the values in the list will be `gzip`, but the other values will be invalid encoding names.
739+
For this extension, assume that your server only supports the `gzip` compression scheme.
742740
743-
As an example, here's a request you might receive:
741+
For this stage, you don't need to compress the body. You'll implement compression in a later stage.
744742
743+
### Tests
744+
745+
The tester will execute your program like this:
745746
```
746-
GET /echo/foo HTTP/1.1
747-
Host: localhost:4221
748-
User-Agent: curl/7.64.1
749-
Accept-Encoding: encoding-1, gzip, encoding-2
747+
$ ./your_server.sh
750748
```
751749
752-
Your server must respond with a `200 OK` response. The response should have a `Content-Encoding: gzip` header present. The response body will not be tested in this stage. (We will tackle the actual compression in a later stage)
753-
Here's the response you're expected to send back:
750+
The tester will then send two `GET` requests to the `/echo/{str}` endpoint on your server.
751+
752+
#### First request
754753
754+
For the first request, the `Accept-Encoding` header will contain `gzip`, along with some invalid encodings:
755+
```
756+
$ curl -v -H "Accept-Encoding: invalid-encoding-1, gzip, invalid-encoding-2" http://localhost:4221/echo/abc
755757
```
758+
759+
Your server's response must contain this header: `Content-Encoding: gzip`.
760+
```javascript
756761
HTTP/1.1 200 OK
757-
Content-Encoding: gzip
758762
Content-Type: text/plain
759-
Content-Length: 3
763+
Content-Encoding: gzip
760764
761-
foo
765+
// Body omitted.
762766
```
763767
764-
It'll then send another HTTP `GET` request to the `/echo/<a-random-string>` endpoint. In the request, it'll include an Accept-Encoding header like: `Accept-Encoding: encoding-1, encoding-2`.
765-
But this time the Accept-Encoding header will not contain gzip, it'll only contain invalid values (i.e. encodings that your server doesn't support).
766-
As an example, here's a request you might receive:
768+
#### Second request
767769
770+
For the second request, the `Accept-Encoding` header will only contain invalid encodings:
768771
```
769-
GET /echo/bar HTTP/1.1
770-
Host: localhost:4221
771-
User-Agent: curl/7.64.1
772-
Accept-Encoding: encoding-1, encoding-2
772+
$ curl -v -H "Accept-Encoding: invalid-encoding-1, invalid-encoding-2" http://localhost:4221/echo/abc
773773
```
774774
775-
Your server must respond with a `200 OK` response. The response should NOT have a `Content-Encoding` header present. The response body will not be tested in this stage.
776-
Here's the response you're expected to send back:
777-
778-
```
775+
Your server's response must not contain a `Content-Encoding` header:
776+
```javascript
779777
HTTP/1.1 200 OK
780778
Content-Type: text/plain
781-
Content-Length: 3
782779
783-
bar
780+
// Body omitted.
784781
```
785-
786-
### Notes
787-
788-
1. Header names are case-insensitive, i.e. `accept-encoding: gzip` and `Accept-Encoding: gzip` are equivalent. We won't test this explicitly in this challenge, but it's a good practice to lowercase your header names before comparison.
789782
marketing_md: |
790783
In this stage, you'll add support for reading multiple compression values from `Accept-Encoding` header sent by clients, and respond with `Content-Encoding` header in your response.
791784

0 commit comments

Comments
 (0)