cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2872
Views
11
Helpful
2
Replies

tcl - using http::geturl on tclsh

metalium2007
Level 3
Level 3

Hello guys,

I have a (simple?) doubt. Why can't I run http::geturl function on tclsh mode on router cli?

I always get invalid command.

What can I be missing? I see the package httpios builtin (running httpios:geturl doesnt work either).

Please can you point me in the right direction?

Thank you very much friends,

met

2 Replies 2

metalium2007
Level 3
Level 3

Hello,

Doesn't anyone has some hint about this question?

Thank you very much.

met

kamikatze
Level 1
Level 1

I know this is 4 years later, but you're the first google hit for

tclsh http::geturl

so i'm probably posting this more to help myself 4 years from now, when i'll have zero recollection about what i'm writing here, becoming someone else.

 

The problem you're facing here (read that: the problem you faced 4 years ago) was that you didn't have that namespace available to you in tclsh.

Cisco being Cisco, the master of consistency throughout the observational multiverse, and the accidental inventors of such things like security through unintentional diversity

 decided to use

source "tmpsys:lib/tcl/http.tcl"

instead of

package require http

which is what you would use in a "genuine" TCL shell.

 

So here it goes:

Indifferent-Bob(tcl)#dir tmpsys:/lib/tcl
Directory of tmpsys:/lib/tcl/

   48  -r--       19354                      auto.tcl
   58  -r--        2695                      base.tcl
   60  -r--        9371                      base64.tcl
   61  -r--       13395                      cli_lib.tcl
   62  -r--        2589                      context_lib.tcl
    3  drw-           0                      eem_scripts
   65  -r--         185                      email_template_cfg.tm
   66  -r--         147                      email_template_chs.tm
   67  -r--         154                      email_template_cmd.tm
   68  -r--         156                      email_template_dmp.tm
   69  -r--         144                      email_template_sl.tm
   70  -r--         325                      email_template_sm.tm
   71  -r--         135                      email_template_wd.tm
   49  -r--        9183                      history.tcl
   50  -r--       23558                      http.tcl
   54  -r--       17985                      init.tcl
   56  -r--        6980                      ldAout.tcl
   59  -r--       33266                      optparse.tcl


Indifferent-Bob(tcl)#dir tmpsys:/lib/tcl/http.tcl
Directory of tmpsys:/lib/tcl/http.tcl

   50  -r--       23558                      http.tcl


Indifferent-Bob(tcl)#source "tmpsys:lib/tcl/http.tcl"

Indifferent-Bob(tcl)#http::geturl http://im.just.a.gig/olo
Translating "im.just.a.gig"...domain server (8.8.8.8) [OK]
::http::3
Indifferent-Bob(tcl)#

-----
access.log on the other end:
   2a02:xxx:yyy:zzz::bc19:9979 im.just.a.gig - [19/Mar/2015:20:02:04 +0200] "GET /olo HTTP/1.0" 404 345 "-" "Tcl http client package 2.4.2"
-----

Here's a bit more insight from Ivan: http://blog.ipspace.net/2009/01/hidden-wealth-of-ios-tcl.html