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

Incorrect header created for payloads longer than 125 bytes using RFC6455 patch

Aperta
#52 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
php
Ambito
networking

Direzione di ricerca

Inizia individuando la funzione wrap di PHP e analizza come costruisce gli header WebSocket. Riproduci il problema con payload superiori a 125 byte, quindi verifica che i client decodifichino correttamente le lunghezze estese a 16 e 64 bit secondo RFC6455.

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

Descrizione

auto-migrated Priority-Medium Type-Defect
What steps will reproduce the problem?
1. Apply RFC6455 patch
2. Send a message with a payload larger than 125bytes
3. Websocket clients will not be able to correctly decode the length of the 
payload

The problem is with the wrap function not correctly implementing the payload 
length section of the web sockets standard. If the payload is longer than 
125bytes then a length of 126 or 127 bytes needs to be sent in the payload 
length section of the header and an additional 16 bit (with 126 sent in the 
length section) or 64 bit (with 127 sent in the length section) unsigned, big 
endian integer length also needs to be sent as part of the header. Here is a 
fix that works for payload lengths up to 4,294,967,295 or the maximum of a 
32-bit unsigned integer. A full implementation should be able to handle payload 
lengths up to the maximum of a 64-bit unsigned integer.

function    wrap($msg=""){
    $length=strlen($msg);
    if ($length<126)
        $header=chr(0x81).chr($length); 
    elseif ($length<65536)
        $header=chr(0x81).chr(126).pack("n",$length); 
    else
        $header=chr(0x81).chr(127).pack("N",$length); 
    $msg=$header.$msg;
    return $msg;
}


Original issue reported on code.google.com by [email protected] on 10 May 2012 at 3:04

Lingua principale
PHP
Stelle
0
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 et-nik/phpwebsocket

Tutte le issue di et-nik/phpwebsocket

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.