ReadCGI() no return size
Posted: Tue Oct 28, 2025 11:17 am
Hello, from version 6.21, 630, readCGI no longer returns the size and no longer reads a Json sent via POST.
In version 6.20 it works perfectly.
ex:
In version 6.20 it works perfectly.
Code: Select all
curl --location 'https://site.com/rep-bin/get' \
--header 'Content-Type: application/json' \
--data '{
"rep": {
"data": ["2023-04-20"]
}
}'
Code: Select all
If Not InitCGI()
End
EndIf
Define BufferSize = ReadCGI()
Define httpContentLength = Val(Trim(CGIVariable(#PB_CGI_ContentLength)))
Define *buff=CGIBuffer()
WriteCGIHeader(#PB_CGI_HeaderContentType, "text/html", #PB_CGI_LastHeader) ; Write the headers to inform the browser of the content format
WriteCGIString("<html><title>PureBasic - raw buffer</title><body>")
If *buff
WriteCGIString("Raw buffer content: <br><pre>"+Str(*buff)+" > "+Str(httpContentLength)+" > " +Str(BufferSize)+" > "+ PeekS(*buff, BufferSize, #PB_Ascii) + "</pre>")
EndIf
WriteCGIString("</body></html>")