« Back to TCL-API

httpios::geturl issue

Combination View Flat View Tree View
Threads [ Previous | Next ]
Hi all,
I'm experiencing an issue with the httpios::geturl method.
Each
time I call this method seems it's not able to complete, the callback
method is not called at all and I obtained a couple of traceback error
messages that, i figured out, are telling me that something with the
memory went wrong.
 
I constructed a simple script, just
to troubleshoot the issue, that don't anything, just download an URL
and display it each time is loaded in the router. Here the code:
 
----------------------------------------------------------------------------------------------------------------------------------------------------------------
 
proc init { } {



     #global token

   

     set event [infotag get evt_event]

    log "Service Successfully Loaded !!! $event"

   

    #httpios::config -accept "text/plain"

    set url "http://10.254.147.69/test.php"

    puts "Before httpios::geturl"  

    httpios::geturl "$url" -command act_RequestResult -timeout 1

    puts "After httpios::geturl"

}







proc act_RequestResult {token} {



    #global token 

 

    set res [http::data $token]

  

    puts "Capture Result: $res"

}



proc act_Cleanup { } {



    set evt_name [infotag get evt_event]

    call close

}



package require httpios 1.0



init

#----------------------------------

#   State Machine

#----------------------------------

set TopFSM(any_state,ev_disconnected)         "act_Cleanup, same_state"

set TopFSM(any_state,ev_destroy_done)         "act_Cleanup, same_state"

set TopFSM(CALL_INIT,ev_handoff)    "act_GetHTTP, GETTINGHTTP"

set TopFSM(any_state,ev_any_event) "act_LogState, same_state"

fsm define TopFSM CALL_INIT
 
--------------------------------------------------------------------------------------------------------------------------------------------------------
 
Here's the log collected from the IOS: an advanced ip services 12.4(24)T6 on a ISR 2811.
 
---------------------------------------------------------------------------------------------------------------------------------------------------------
#call appl voice load testurl



000897: *Dec 21 12:27:19.220: %AAA-3-BADSERVERTYPEERROR: Cannot process accounting server type tacacs+ (UNKNOWN)

000898: *Dec 21 12:27:19.244: //-1//HIFS:/hifs_ifs_cb: hifs ifs file
read succeeded. size=955, url=tftp://10.254.147.69/testurl.tcl

000899: *Dec 21 12:27:19.248: //-1//HIFS:/hifs_free_idata: hifs_free_idata: 0x489E0A18

000900: *Dec 21 12:27:19.248: //-1//HIFS:/hifs_hold_idata: hifs_hold_idata: 0x489E0A18

000901: *Dec 21 12:27:19.248: //-1//AFW_:EE48B8C9E4000:/Tcl_Link: Linking script testurl

000902: *Dec 21 12:27:19.256: //-1//PACK:EE48B8C9E4000:/tcl_packageObjCmd:  package require httpios 1.0

000903: *Dec 21 12:27:19.256: //-1//TCL :EE48B8C9E4000:/tcl_InfotagObjCmd:  infotag get evt_event

000904: *Dec 21 12:27:19.256: //-1//TCL :EE48B8C9E4000:/tcl_InfotagGetObjCmd: infotag get evt_event

000905: *Dec 21 12:27:19.256: //-1//AFW_:EE48B8C9E4000:/vtr_ev_event: argc 2

000906: *Dec 21 12:27:19.264: //-1//AFW_:EE48B8C9E4000:/vtr_ev_event: Event [ev_any_event]

000907: *Dec 21 12:27:19.264: //-1//TCL :EE48B8C9E4000:/tcl_LogObjCmd: log Service Successfully Loaded !!! ev_any_event

000908: *Dec 21 12:27:19.264: %IVR-3-APP_ERR: Service Successfully Loaded !!! ev_any_event



000909: *Dec 21 12:27:19.264: //-1//TCL :EE48B8C9E4000:/tcl_PutsObjCmd: Before httpios::geturl

000910: *Dec 21 12:27:19.264:

000911: *Dec 21 12:27:19.264:
//-1//PACK:EE48B8C9E4000:/tcl_httpiosGeturlObjCmd:  httpios::geturl
http://10.254.147.69/test.php -command act_RequestResult -timeout 1

000912: *Dec 21 12:27:19.268: //-1//PACK:EE48B8C9E4000:/tcl_httpiosGeturlObjCmd: Current NS: ::

000913: *Dec 21 12:27:19.268: //-1//PACK:EE48B8C9E4000:/tcl_httpiosGeturlObjCmd: URL: http://10.254.147.69/test.php

000914: *Dec 21 12:27:19.268: //-1//TCL :EE48B8C9E4000:/tcl_PutsObjCmd: After httpios::geturl

000915: *Dec 21 12:27:19.268:

000916: *Dec 21 12:27:19.268: //-1//TCL :EE48B8C9E4000:/tcl_FSMObjCmd:  fsm define TopFSM CALL_INIT

000917: *Dec 21 12:27:19.268: //-1//TCL :EE48B8C9E4000:/tcl_FSMDefineObjCmd: State Machine: Array TopFSM: Start State: CALL_INIT

000918: *Dec 21 12:27:19.268: //-1//TCL :EE48B8C9E4000:/tcl_FSMDefineObjCmd: FSM Data structure

000919: *Dec 21 12:27:19.268: (any_state(0), ev_destroy_done(37)--(act_Cleanup)-->(any_state(0))

000920: *Dec 21 12:27:19.268: (any_state(0), ev_disconnected(18)--(act_Cleanup)-->(any_state(0))

000921: *Dec 21 12:27:19.268: (any_state(0), ev_any_event(0)--(act_LogState)-->(any_state(0))

000922: *Dec 21 12:27:19.268: (CALL_INIT(1), ev_handoff(22)--(act_GetHTTP)-->(GETTINGHTTP(2))

000923: *Dec 21 12:27:19.268: FSM start state CALL_INIT(1)

000924: *Dec 21 12:27:19.268: //-1//AFW_:EE48B8C9E4000:/Tcl_Link: Script testurl succesfully linked.

000925: *Dec 21 12:27:19.280: //-1//PACK:/httpios_http_get_cb:

000926: *Dec 21 12:27:19.280: httpios_http_get_cb: status: 200

000927: *Dec 21 12:27:19.280: //-1//AFW_:/AFW_Instance_CheckType: 0:
NULL object -Traceback= 0x424097D0z 0x42416074z 0x424CE6F8z 0x41FDF854z
0x41FE5608z 0x41FE640Cz 0x41FE70DCz 0x4321A5B4z 0x4321A598z

000928: *Dec 21 12:27:19.284: %SCHED-7-WATCH: Attempt to enqueue
uninitialized watched queue (address 0). -Process= "http client
process", ipl= 0, pid= 235,  -Traceback= 0x4322E148z 0x424CE6F8z
0x41FDF854z 0x41FE5608z 0x41FE640Cz 0x41FE70DCz 0x4321A5B4z 0x4321A598z

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
As
you can see the callback method has not been called because in all the
trace I haven't the "Capture Result" message that should be shown by the
act_RequestResult method.
 
Here I also provide
the debug collected from the IOS for the http client system (debug http
client msg and debug http client error):
 
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
#call appl voice load testurl



000930: *Dec 21 12:30:38.925: //-1//HIFS:/hifs_ifs_cb: hifs ifs file
read succeeded. size=955, url=tftp://10.254.147.69/testurl.tcl

000931: *Dec 21 12:30:38.929: //-1//HIFS:/hifs_free_idata: hifs_free_idata: 0x489E0984

000932: *Dec 21 12:30:38.929: //-1//HIFS:/hifs_hold_idata: hifs_hold_idata: 0x489E0984

000933: *Dec 21 12:30:38.941: %IVR-3-APP_ERR: Service Successfully Loaded !!! ev_any_event



000934: *Dec 21 12:30:38.953: //0//HTTPC:/httpc_write_stream: Client write buffer fd(0):

GET /test.php HTTP/1.1

Host: 10.254.147.69

Content-Type: application/x-www-form-urlencoded

Connection: Keep-Alive

Accept: text/vxml, text/x-vxml, application/vxml, application/x-vxml,
application/voicexml, application/x-voicexml, text/plain, text/html,
audio/basic, audio/wav, multipart/form-data, application/octet-stream

User-Agent: Cisco-IOS-C2800NM/12.4





000935: *Dec 21 12:30:38.953: //0//HTTPC:/httpc_msg_read: Start processing 261 bytes data

000936: *Dec 21 12:30:38.957: //0//HTTPC:/httpc_msg_read: Ignored -
failed to decode message header (Server: Apache/2.2.20 (Ubuntu)) for
(msg(49E2CA9C)

000937: *Dec 21 12:30:38.957: //0//HTTPC:/httpc_msg_read: Ignored -
failed to decode message header (X-Powered-By: PHP/5.3.6-13ubuntu3.3)
for (msg(49E2CA9C)

000938: *Dec 21 12:30:38.957: //0//HTTPC:/httpc_msg_read: Ignored -
failed to decode message header (Vary: Accept-Encoding) for
(msg(49E2CA9C)

000939: *Dec 21 12:30:38.957: //0//HTTPC:/httpc_msg_read: Stored header at 0x48B7270C, len=249 stored

000940: *Dec 21 12:30:38.957: //0//HTTPC:/httpc_msg_read: Stored msg. body: len=12

000941: *Dec 21 12:30:38.957: processing server rsp msg: msg(49E2CA9C)URL:http://10.254.147.69/test.php, fd(0):

000942: *Dec 21 12:30:38.957: Request msg: GET /test.php HTTP/1.1

000943: *Dec 21 12:30:38.957: Message Response Code: 200

000944: *Dec 21 12:30:38.957: Message Rsp Decoded Headers:

000945: *Dec 21 12:30:38.957: Date:Wed, 21 Dec 2011 11:17:02 GMT

000946: *Dec 21 12:30:38.957: Content-Length:12

000947: *Dec 21 12:30:38.957: Content-Type:text/html

000948: *Dec 21 12:30:38.957: Connection:Keep-Alive

000949: *Dec 21 12:30:38.957: Keep-Alive:timeout=5, max=100

000950: *Dec 21 12:30:38.957: headers:

000951: *Dec 21 12:30:38.957: HTTP/1.1 200 OK

Date: Wed, 21 Dec 2011 11:17:02 GMT

Server: Apache/2.2.20 (Ubuntu)

X-Powered-By: PHP/5.3.6-13ubuntu3.3

Vary: Accept-Encoding

Content-Length: 12

Keep-Alive: timeout=5, max=100

Connection: Keep-Alive

Content-Type: text/html





000952: *Dec 21 12:30:38.961: body:

000953: *Dec 21 12:30:38.961: 1

2

3

4

5

6



000954: *Dec 21 12:30:38.961:

000955: *Dec 21 12:30:38.961: %SCHED-7-WATCH: Attempt to enqueue
uninitialized watched queue (address 0). -Process= "http client
process", ipl= 0, pid= 235,  -Traceback= 0x4322E148z 0x424CE6F8z
0x41FDF854z 0x41FE5608z 0x41FE640Cz 0x41FE70DCz 0x4321A5B4z 0x4321A598z

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
As you can see the page (that is a simple text file containing numbers from 1 to 6) is correctly downloaded.
 
Thanks in advance for any help.
 
Marco

Hi Marco,

From the debug logs provided we see there errors thrown as following

000897: *Dec 21 12:27:19.220: %AAA-3-BADSERVERTYPEERROR: Cannot process accounting server type tacacs+ (UNKNOWN)

Please check whether there are any mis-configurations of tacacs server.

Thanks,
Anusha

Hi Marco,

please move your http code from init procedure to act_GetHTTP procedure, you can only do initialization inside init procedure.

Thanks,
Raghavendra

RE: httpios::geturl issue
Answer
12/21/11 4:03 PM as a reply to Raghavendra Gutty Veeranagappa.
Hi Marco,

please move your http code from init procedure to act_GetHTTP procedure, you can only do initialization inside init procedure.

Thanks,
Raghavendra

 
You're totally right.
Now that I moved the geturl outside the init everything work fine.
 
Thanks a lot.
 
 
Marco

Hi Marco,

From the debug logs provided we see there errors thrown as following

000897: *Dec 21 12:27:19.220: %AAA-3-BADSERVERTYPEERROR: Cannot process accounting server type tacacs+ (UNKNOWN)

Please check whether there are any mis-configurations of tacacs server.

Thanks,
Anusha

You're right but I'm in a bank and they cannot subscribe me to their directory system so they temporarly removed the TACACS just to let me work without gimme an account.
 
Anyway thank you for your hint.
 
Marco