aio-libs / aio-libs/yarl

Over-zealous empty query/fragment normalization like bpo-37969

Abierto
#332 2 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
1.5k
Forks
215
Merge medio
1 d 2 min
PR fusionados (30 d)
13

Descripción

I saw https://bugs.python.org/issue37969 and was curious how YARL handles an empty querystring given that [RFC 3986 § 6.2.3 says](https://tools.ietf.org/html/rfc3986?#section-6.2.3)

> Normalization should not remove delimiters when their associated component is empty unless licensed to do so by the scheme specification. For example, the URI "http://example.com/?" cannot be assumed to be equivalent to any of the examples ["http://example.com", "http://example.com/", "http://example.com:/", "http://example.com:80/"].

† Is there a separate spec for HTTP that says you can? Would this impact a generic URL parser anyways?

```
>>> yarl.URL("http://example.com/?#") == yarl.URL("http://example.com/")
True
```

And I can't see a way to `yarl.URL.build` to end up with a blank (but delimited) querystring/fragment

Wondering if this would just be a 'won't-fix' in YARL, or if there's some clean design solution. Also if any URL-savants wanted to render an opinion in the bugs.python.org issue.

---

⁂ even more niche "issue":
```
>>> yarl.URL("http://example.com:80/") == yarl.URL("http://example.com:/")
False
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.