Now I am attempting this:
cgi.prg
function main(x,y)
OutStd("Content-type: text/html" + hb_eol() + hb_eol())
OutStd("<html><body><h1>It works! </h1>" + hb_eol()+ hb_eol())
OutStd("User: " + x + " test: " + y + "</body></html>" + hb_eol())
return nil
http://10.3.51.45/cgi-bin/cgi2?mario&teste
It outputs:It works!
Error BASE/1081 Argument error: + (Quit)
Parameters: a
Parameters: b
Parameters: c
Parameters: d
Parameters: e
Parameters: a
Parameters: b
Parameters: c
Parameters: d
Parameters: e
Method: GET
Accept lang: pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3
user agent: Mozilla/5.0 (Windows NT 6.1; rv:58.0) Gecko/20100101 Firefox/58.0
Connection: keep-alive
Apache ver: Apache/2.2.21 (Win32)
function main(...)
Local aParams := hb_aParams(),n:=0
OutStd("Content-type: text/html" + hb_eol() + hb_eol())
OutStd("<html><body><h1>It works! </h1>" + hb_eol()+ hb_eol())
OutStd("Len array of parameters: " , str( len( aParams ) ) + hb_eol()+ hb_eol())
do while n++ < len( aParams )
OutStd( "<p> Parameters: ", aParams[n] , "</p>")
enddo
OutStd("<p>Method: " , hb_getenv("REQUEST_METHOD") + hb_eol())
OutStd("<p>Accept lang: " , hb_getenv("HTTP_ACCEPT_LANGUAGE") + hb_eol())
OutStd("<p>user agent: " , hb_getenv("HTTP_USER_AGENT") + hb_eol())
OutStd("<p>Connection: " , hb_getenv("HTTP_CONNECTION") + hb_eol())
OutStd("<p>Apache ver: " , hb_getenv("SERVER_SOFTWARE") + hb_eol())
OutStd("</body></html>" + hb_eol())
Return nil
Best regards,
Itamar M. Lins Jr.
function main()
local Query := Replicate( " ", 255 )
collect(Query)
return nil
...
HB_FUNC(COLLECT) {
char *query;
// get the pre-allocated string buffer pointer
query = hb_parvcx(1);
...
For the record, I applied your changes and they worked also.
hb_storclen( query, nShortenToWant, 1 ) /* no hb:xfree() */
(**) hb_storclen_buffer( query, nShortenToWant, 1 ) /* includes an hb_xfree(query) */---as ultra-short intro for Harbour ITEM-API.general: be careful if you see an 'const char *' in the prototypes as param or return value.best regardsRolf
| SCRIPT NAME: | /cgi-bin/cgi4 |
| CRITICAL ERROR: | Bound error |
| OPERATION: | array access |
| OS ERROR: | 0 IN BASE/1132 |
| FILENAME: | |
| PROC/LINE: | (b)TIPCGI_NEW/99 |
| PROC/LINE: | MAIN/8 |