Skip to content
This repository has been archived by the owner on Mar 13, 2021. It is now read-only.

grpc only: error-client-content-type-unsupported on "Content-Type:text/plain; charset=utf-8" #29

Closed
jldec opened this issue Feb 19, 2018 · 0 comments
Assignees
Labels

Comments

@jldec
Copy link
Contributor

jldec commented Feb 19, 2018

The grpc protocol handler is rejecting requests with Content-Type:text/plain; charset=utf-8

$ curl -H "Content-Type:text/plain; charset=utf-8" -d "should work" http://192.168.99.100:32300/requests/t1 -v

*   Trying 192.168.99.100...
* TCP_NODELAY set
* Connected to 192.168.99.100 (192.168.99.100) port 32300 (#0)
> POST /requests/t1 HTTP/1.1
> Host: 192.168.99.100:32300
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Type:text/plain; charset=utf-8
> Content-Length: 11
> 
* upload completely sent off: 11 out of 11 bytes
< HTTP/1.1 500 Internal Server Error
< Date: Mon, 19 Feb 2018 18:59:29 GMT
< Content-Length: 0
< Content-Type: text/plain; charset=utf-8
[sidecar]: 2018/02/19 18:59:28 Sidecar for function 't1' (t1->replies) using grpc dispatcher starting
[sidecar]: 2018/02/19 18:59:28 Rebalanced: &{Type:rebalance start Claimed:map[] Released:map[] Current:map[]}
[sidecar]: 2018/02/19 18:59:28 Rebalanced: &{Type:rebalance OK Claimed:map[t1:[0]] Released:map[] Current:map[t1:[0]]}
[main]: Node started in 76ms
[main]: gRPC loaded in 94ms
[main]: HTTP loaded in 98ms
[main]: gRPC running on localhost:10382
[main]: HTTP running on http://localhost:8080
[main]: Function invoker started in 276ms
[sidecar]: 2018/02/19 18:59:29 <<< Message{, map[error:[error-client-content-type-unsupported] correlationId:[e2e941b9-68fa-4dd8-860e-ae399a55b974]]}

The same message sent with the http protocol is handled ok.

$ curl -H "Content-Type:text/plain; charset=utf-8" -d "should work" http://192.168.99.100:32300/requests/t1 -v
*   Trying 192.168.99.100...
* TCP_NODELAY set
* Connected to 192.168.99.100 (192.168.99.100) port 32300 (#0)
> POST /requests/t1 HTTP/1.1
> Host: 192.168.99.100:32300
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Type:text/plain; charset=utf-8
> Content-Length: 11
> 
* upload completely sent off: 11 out of 11 bytes
< HTTP/1.1 200 OK
< Content-Type: text/plain; charset=utf-8
< Date: Mon, 19 Feb 2018 19:06:15 GMT
< Content-Length: 22
< 
[sidecar]: 2018/02/19 19:06:15 Sidecar for function 't1' (t1->replies) using http dispatcher starting
[sidecar]: 2018/02/19 19:06:15 Waiting for function to accept connection on localhost:8080
[sidecar]: 2018/02/19 19:06:15 Waiting for function to accept connection on localhost:8080
[sidecar]: 2018/02/19 19:06:15 Rebalanced: &{Type:rebalance start Claimed:map[] Released:map[] Current:map[]}
[sidecar]: 2018/02/19 19:06:15 Rebalanced: &{Type:rebalance OK Claimed:map[t1:[0]] Released:map[] Current:map[t1:[0]]}
[sidecar]: 2018/02/19 19:06:15 Waiting for function to accept connection on localhost:8080
[sidecar]: 2018/02/19 19:06:15 Wrapper received Message{should work, map[Content-Type:[text/plain; charset=utf-8] Accept:[*/*] correlationId:[0f4f98eb-55f1-47ca-92e3-5dd457e8fe90]]}
[sidecar]: 2018/02/19 19:06:15 Wrapper about to forward Message{should workshould work, map[Date:[Mon, 19 Feb 2018 19:06:15 GMT] Connection:[keep-alive] X-Powered-By:[Express] Content-Type:[text/plain; charset=utf-8] Content-Length:[22] Etag:[W/"16-weTPpPtGiPf2MRJe2B4n0af2bac"] correlationId:[0f4f98eb-55f1-47ca-92e3-5dd457e8fe90]]}
[sidecar]: 2018/02/19 19:06:15 <<< Message{should workshould work, map[Date:[Mon, 19 Feb 2018 19:06:15 GMT] Connection:[keep-alive] X-Powered-By:[Express] Content-Type:[text/plain; charset=utf-8] Content-Length:[22] Etag:[W/"16-weTPpPtGiPf2MRJe2B4n0af2bac"] correlationId:[0f4f98eb-55f1-47ca-92e3-5dd457e8fe90]]}
@scothis scothis added the bug label Feb 20, 2018
scothis added a commit to scothis/node-function-invoker that referenced this issue Feb 20, 2018
The Content-Type header can also contain a charset param.

```http
Content-Type: text/plain; charset=utf-8
```

Previously this would cause the gRPC handler to choke. Now the charset
is ignored. In the future we should correctly parse the charset and
decode the payload accordingly. For now, all text content is assumed to
be utf-8.

Fixes: projectriff#29
scothis added a commit that referenced this issue Feb 20, 2018
The Content-Type header can also contain a charset param.

```http
Content-Type: text/plain; charset=utf-8
```

Previously this would cause the gRPC handler to choke. Now the charset
is ignored. In the future we should correctly parse the charset and
decode the payload accordingly. For now, all text content is assumed to
be utf-8.

Fixes: #29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants