`uri_builder` in `windows_request_context::read_headers_io_completion` throws web::uri_exception when the uri contains square brackets.
The encode_uri method handles square brackets as general delimiters and therefor will not encode them.
The encoded uri is passed to the uri_builder that throws the web::uri_exception.
The following code snippet reproduces the exception:
```cpp
auto encodedUri = uri::encode_uri(L"http://localhost/service[1]?param[]=123¶m[]=456");
// assert(encodedUri == L"http://localhost/service%5B1%5D?param%5B%5D=123¶m%5B%5D=456");
uri_builder builder(encodedUri);
```
In compare, the JavaScript `encodeURI` method encodes the square brackets as this exampel shows:
```javascript
console.log(encodeURI("http://localhost/service[1]?param[]=123¶m[]=456"));
// -> http://localhost/service%5B1%5D?param%5B%5D=123¶m%5B%5D=456
```
Is there a reason to keep the brackets unencoded and why is the behavior different to javascript?
The encode_uri method handles square brackets as general delimiters and therefor will not encode them.
The encoded uri is passed to the uri_builder that throws the web::uri_exception.
The following code snippet reproduces the exception:
```cpp
auto encodedUri = uri::encode_uri(L"http://localhost/service[1]?param[]=123¶m[]=456");
// assert(encodedUri == L"http://localhost/service%5B1%5D?param%5B%5D=123¶m%5B%5D=456");
uri_builder builder(encodedUri);
```
In compare, the JavaScript `encodeURI` method encodes the square brackets as this exampel shows:
```javascript
console.log(encodeURI("http://localhost/service[1]?param[]=123¶m[]=456"));
// -> http://localhost/service%5B1%5D?param%5B%5D=123¶m%5B%5D=456
```
Is there a reason to keep the brackets unencoded and why is the behavior different to javascript?