akka / akka/akka-http

Clarify parsing / handling of `authority-form` of request target

Open
#189 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1 - triaged t:core t:model
Dominant language
Scala
Stars
1.4k
Forks
584
Avg merge
14h 33m
Merged PRs (30d)
24

Description

**Issue by [jrudolph](https://github.com/jrudolph)**
_Monday Oct 05, 2015 at 11:45 GMT_
_Originally opened as https://github.com/akka/akka/issues/18643_

---

As detected in https://github.com/akka/akka/pull/18642#issuecomment-145501475 it seems that akka-http doesn't parse request targets correctly if the target is given in [`authority-form`](http://tools.ietf.org/html/rfc7230#section-5.3.3) which is only valid for `CONNECT` requests (that aren't supported by akka-http) anyway.

In an [akka-user post](https://groups.google.com/d/topic/akka-user/eAgsGyUzMu4/discussion), the error message was

```
akka.http.scaladsl.model.IllegalUriException: 'Host' header value of request to `openoox.com:8080` doesn't match request target authority: Host header: Some(Host: openoox.com:8080) request target authority:
```

which translates to

```
uri.toString == "openoox.com:8080"
hostHeader.toString == "Some(Host: openoox.com:8080)"
uri.authority == ""
```

So, this means the request probably was a CONNECT request and looked like this:

```
CONNECT openoox.com:8080 HTTP/1.1
```

In this case the uri is parsed as

```
uri.scheme == openoox.com
uri.path == 8080
```

which doesn't make any sense.

akka-http should either properly parse this into a model representing the authority form or outright reject requests like this.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing akka-http’s request-target parsing for the CONNECT example and compare it with the RFC 7230 authority-form behavior described here. The issue names no files or tests; done means the implementation consistently represents or rejects authority-form targets instead of parsing `openoox.com:8080` as a scheme and path, with coverage for the chosen behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.