Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Allow the cURL transport to use native HTTP protocol negotiation

Aperta
#1,087 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 9 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
php
Ambito
api, networking

Direzione di ricerca

Inizia tracciando la gestione di protocol_version nei transport cURL e fsockopen, incluso il modo in cui viene impostato CURLOPT_HTTP_VERSION. Determina se una modalità auto o null debba lasciare a cURL la selezione del protocollo, preservando al contempo il comportamento HTTP/1.x per fsockopen. Convalida il risultato con CURLINFO_HTTP_VERSION utilizzando un server di test compatibile con HTTP/2 e conferma il fallback a HTTP/1.1.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Is your feature request related to a problem?

Requests defaults protocol_version to HTTP/1.1 and the cURL transport therefore explicitly sets:

CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1

This prevents libcurl from using its native HTTP protocol negotiation, even when both libcurl and the server support HTTP/2 or newer protocols.

This is related to #381 and PR #918, but is intentionally narrower. Instead of adding explicit HTTP/2 / HTTP/3 support, this issue is about allowing capable transports to choose the protocol themselves.

Describe the solution you'd like

Add a way to request transport-native protocol negotiation, for example with null or "auto".

Conceptually:

1.0  -> force HTTP/1.0
1.1  -> force HTTP/1.1
auto -> let the transport decide

For cURL, auto would mean not setting CURLOPT_HTTP_VERSION and letting libcurl negotiate the protocol.

For fsockopen, Requests could continue using the HTTP/1.x version it supports.

Describe alternatives you've considered

PR #918 adds explicit 2.0 and 3.0 protocol versions, but that also introduces questions around transport capabilities, HTTP/3 and testing infrastructure.

Another workaround is changing the cURL handle through hooks, but that requires downstream applications to know that Requests otherwise forces HTTP/1.1.

Additional context

This came up while investigating HTTP/2 support in WP-CLI.

A native-negotiation mode could be tested using CURLINFO_HTTP_VERSION against an HTTP/2-capable test server, while preserving HTTP/1.1 fallback when HTTP/2 is unavailable.

The main design question is whether protocol_version should always dictate the protocol for every transport, or whether protocol selection can remain a transport capability when the caller does not explicitly request a version.

Lingua principale
PHP
Stelle
3.6k
Fork
503
Merge medio
10g 23h
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di WordPress/Requests

Tutte le issue di WordPress/Requests

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.