[AOLSERVER] qsset argument within ns_httpspost

39 views
Skip to first unread message

Iuri Sampaio

unread,
Mar 17, 2013, 7:58:02 AM3/17/13
to aolserv...@lists.sourceforge.net
Hi there,

I created the code bellow that calls httpspost to authenticates against a https url with a few arguments (user, password, skin, dest). In order to pass arguments through via post they must be within a set structure. 

*** I believe I didn't even need  the first line becasue ns_getform already returns the identical set structure needed as argument for qsset on httpspost. However I added it just to stay o the right side.  The TCL script is bellow.

## script.tcl

ns_set create qsset [ns_getform]

set result [ns_httpspost "https://acesso.uol.com.br/login.html" {} {$qsset} {multipart/form-data} {} {30} {}]

##


However [ns_httpspost] returns an error  regarding the  command [ns_set size $qsset] at line 250

[17/Mar/2013:11:42:46][30452.3039562608][-default:10-] Error: POST http://206.192.23.166:8050/natopia-core/invite/invite-uol?
no such set: $qsset
    while executing
"ns_set size $qsset"
    (procedure "ns_httpspost" line 46)
    invoked from within
"ns_httpspost "https://acesso.uol.com.br/login.html" {} {$qsset} {multipart/form-data} {} {30} {}"
    invoked from within
"set result [ns_httpspost "https://acesso.uol.com.br/login.html" {} {$qsset} {multipart/form-data} {} {30} {}]"
    ("uplevel" body line 38)
    invoked from within
"uplevel {
ad_page_contract {}



I went to ns_httpspost source code and I placed a ns_log within it. 

ns_log Notice "$url \n $rqset \n $qsset \n $type "

Curiously It doesn't show the content of qsset but its label "$qsset"  
  
[17/Mar/2013:11:42:46][30452.3039562608][-default:10-] Notice: https://acesso.uol.com.br/login.html

 $qsset
 multipart/form-data
[17/Mar/2013:11:42:46][30452.3039562608][-default:10-] Warn...


Does it have any relation with the error?
How do I make qsset variable to be recognizable within the procedure ns_httpspost


Cheers,
Iuri

Iuri Sampaio

unread,
Mar 17, 2013, 7:11:52 PM3/17/13
to aolserv...@lists.sourceforge.net
So far,

The dummy mistake was in the curly braquets.

set result [ns_httpspost "https://acesso.uol.com.br/login.html" {} {$qsset} {} {} 30 {}]

After I took them out it worked fine.

set result [ns_httpspost "https://acesso.uol.com.br/login.html" {} $qsset {} {} 30 {}]


I can connect through and the post result the session code value 


Now, I have a problem with requesting data I need. With the result of httpspost I create  new ns_set and tried to get the http result:

set qsset [ns_set create qsset $url $arg]
set result [ns_httpget "http://mail.uol.com.br/addressbook" 30 0 $qsset]

But somehow if kicks me out telling the session was expired. 

Is there a way to keep connected not loosing the auths values and sessions variables and then get the data I need?


Cheers,
Iuri 
Reply all
Reply to author
Forward
0 new messages