Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

user-agent headers are too eager in assuming data format #1137

Open
adamdecaf opened this issue Jun 28, 2018 · 0 comments
Open

user-agent headers are too eager in assuming data format #1137

adamdecaf opened this issue Jun 28, 2018 · 0 comments

Comments

@adamdecaf
Copy link

Spray's User-Agent header parsing assumes there will be data after a / inside a user-agent. A 200 OK is still returned, but an exception is thrown.

Running spray/spray-template shows this exception easily.

$ sbt
[info] Loading project definition from /Users/adam/code/src/github.com/spray/spray-template/project
[info] Set current project to spray-template (in build file:/Users/adam/code/src/github.com/spray/spray-template/)
> run
[info] Running com.example.Boot 
[INFO] [06/28/2018 11:33:57.674] [on-spray-can-akka.actor.default-dispatcher-4] [akka://on-spray-can/user/IO-HTTP/listener-0] Bound to localhost/127.0.0.1:8080
[WARN] [06/28/2018 11:34:12.347] [on-spray-can-akka.actor.default-dispatcher-2] [akka://on-spray-can/user/IO-HTTP/listener-0/1] Illegal request header: Illegal 'User-Agent' header: Unexpected end of input, expected Token (line 1, pos 12):
Prometheus/
           ^

// Via
$ curl -v -H "user-agent: Prometheus/" localhost:8080
...
< HTTP/1.1 200 OK
< Server: spray-can/1.3.3
...

RFC 2616 does specify User-Agent and this request is technically non-conforming.

token          = 1*<any CHAR except CTLs or separators>
product         = token ["/" product-version]
product-version = token
User-Agent     = "User-Agent" ":" 1*( product | comment )
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant