Fix UTF-8 routing with wide Char and FPC Radix callbacks - #556
Conversation
|
Obrigado pela correção e pela matriz de validação. A direção de trabalhar com bytes UTF-8 nos dois roteadores é coerente, e o bridge FPC elimina o cast de método incompatível. Antes da aprovação, porém, precisamos cobrir alguns pontos que os testes atuais — baseados principalmente em
Depois desses ajustes, poderemos validar novamente a compatibilidade Delphi/FPC e os dois roteadores para aprovação. |
|
Obrigado pela revisão detalhada. Apliquei todos os pontos:
Validei os dois roteadores com chamadas HTTP reais no Delphi 12.2 e os caminhos Tree, Radix e nested routing no MoonCompiler/FPC. |
d29ae3a to
5130782
Compare
|
Rebase realizado sobre o master atual (�3f3f69) e validação refeita.\n\nResultados:\n- Delphi 10, 11, 12 e 13: RouterTree 25/25, Radix 15/15 e integração HTTP AdvancedRouting 2/2 em cada versão;\n- FPC 3.2.2: harness independente passou para callback Radix ASCII e roteamento aninhado por OnRequest e PreValidation;\n- matriz estática: 64/64 cenários Delphi e 8/10 cenários FPC; somente Apache e Apache+Radix falharam por ausência das bibliotecas nativas httpd24/APR na imagem, igualmente fora deste PR.\n\nA suíte DUnitX completa entra em loop ativo também no master atual, portanto esse problema é da baseline e será tratado separadamente. Os fixtures alterados por este PR estão verdes e o PR permanece MERGEABLE/CLEAN. |
Problem
Horse parses request paths into UTF-8 byte slices, but its registered literal routes were still compared as character strings. With a wide
Char(SizeOf(Char) > 1), byte length and character length diverged and non-ASCII routes such as/ação/:idcould not match/ação/42.The optional Radix router had the same byte/character mismatch. Its FPC executor also stored the object method
DoPreValidationas a plain procedure callback, which violates the callback ABI: the route could match, but invoking the callback corrupted execution.Fix
Charis wide;TEncoding.UTF8;ASCII and single-byte
Charpaths keep their existing fast path.Validation
The focused runtime matrix passes with:
The matrix covers ASCII routes, UTF-8 literal and parameter routes, Radix static-route byte storage, byte-span decoding, and callback execution.