eclipse-vertx / eclipse-vertx/vert.x

Add per-connection attachment storage to HttpConnectionInternal

Open
#6,234 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
14.7k
Forks
2.1k
Avg merge
1d 10h
Merged PRs (30d)
27

Description

### Describe the feature

vert-x3/vertx-web#2910 needs per-connection state (announced Alt-Svc origins) that
must not leak after the connection closes. Current workaround lives entirely in
vertx-web: a `WeakHashMap` (see HttpConnectionLocal.java in that PR).
https://github.com/vert-x3/vertx-web/pull/2910#discussion_r3542072153 (comment by @vietj):
"actually I meant I would add a map like structure on vertx internal HTTP connection
object in vertx-core which would solve the issue more directly"

#### Proposal
Add attachment storage to the `HttpConnectionInternal` contract (new interface,
following the existing `HttpServerRequestInternal` / `HttpClientRequestInternal`
pattern in `io.vertx.core.internal.http`), scoped to the connection's lifecycle so
entries are cleared automatically on close:
```
T get(Object key);
void set(Object key, Object value);
```

Downstream modules (vertx-web, etc.) can then stash per-connection state via this
contract instead of each reinventing weak-map/close-handler bookkeeping.

### Contribution

Myself

Contributor guide

Open the contributing guide

Research direction

Start with the HttpServerRequestInternal and HttpClientRequestInternal patterns in io.vertx.core.internal.http, then trace the HttpConnectionInternal close lifecycle. Review HttpConnectionLocal.java in the linked vertx-web work as the usage reference; done means downstream code can attach per-connection state and entries are cleared when the connection closes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design, networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.