Question

Je me suis connecté avec succès à un serveur HTTP avec ActionScript 3 sur des sockets. Le seul problème est que le serveur envoie des HTTP tronqués. Existe-t-il une fonction générique dans un autre langage que je peux consulter qui montre clairement comment décoder la segmentation? Je suis à peu près sûr qu'il n'y a pas de bibliothèque ActionScript à ce sujet.

Était-ce utile?

La solution

La spécification HTTP 1.1 (ou à partir de W3C ) fournit un exemple de pseudocode expliquant comment décoder le codage de transfert en bloc :

length := 0
read chunk-size, chunk-extension (if any) and CRLF
while (chunk-size > 0) {
   read chunk-data and CRLF
   append chunk-data to entity-body
   length := length + chunk-size
   read chunk-size and CRLF
}
read entity-header
while (entity-header not empty) {
   append entity-header to existing header fields
   read entity-header
}
Content-Length := length
Remove "chunked" from Transfer-Encoding
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top