Skip to content
Tcl Source Code Artifact [38f8b9dd84]
Login

Artifact [38f8b9dd84]

Artifact 38f8b9dd84308e4293d340da6d00fbb5d92b61df:

Ticket change [38f8b9dd84] - New ticket [420060ffffffffff|420060ffff] <i>Add -address option to http::geturl</i>. by bbeacham on 2001-04-30 04:13:40.
D 2001-04-30T04:13:40
J assignee nobody
J cmimetype text/plain
J comment \nIssue:\n\s\nLinux\sallows\smultiple\sIP\saddresses\sto\sbe\sbound\sto\sa\s\nsingle\sNIC\scard.\s\sThis\sgives\ssomeone\sthe\sability\sto\s\nwrite\sapplications\sthat\sappear\sto\sgenerate\straffic\s\nfrom\smultiple\sclients\sfrom\sa\ssingle\sPC.\n\s\nProblem:\n\s\nThe\sTCL\slibrary\sfunction\sHTTP::GETURL\sonly\suses\sthe\s\nfirst\sIP\sbound\sto\sthe\scomputer.\n\s\nSolution:\n\s\nHTTP::GETURL\suses\sthe\sTCL\ssocket\scommand\sto\ssetup\sthe\s\nconnection.\s\sSocket\shas\san\soption,\s-myaddr,\sthat\s\nallows\san\sIP\saddress\sto\sbe\spassed\sto\sthe\ssocket.\s\sThis\s\nwill\sbe\sthe\sIP\saddresses\sused\sfor\sthe\sconection.\n\s\nI\smodified\sHTTP::GETURL\sto\sallow\san\sIP\saddress\sto\sbe\s\npassed\sto\sit.\s\sIt\sthen\sgets\spassed\sto\ssocket.\s\sNow\sI\s\ncan\sgenerate\sHTTPS\sGETs\sfrom\sa\snumber\sof\sunique\s\nclients\swhile\susing\sa\ssingle\sPC.\n\nNote:\s\sAfter\sI\sposted\sthis\son\sUSENET\ssomeone\sshowed\s\nhow\sto\suse\shttp::register\sto\sset\sthe\ssystem\sIP\sto\sa\s\ndifferant\sIP\sand\sthen\sthat\swould\sbe\sthe\sIP\sused\sby\s\nhttp::geturl.\s\sHowever,\sthat\sis\snot\sas\sclean\sand\s\nsimple\sas\shaving\san\saddress\soption.\s\sAlso\sit\screates\sa\s\nlot\sof\sCPU\soverhead\shaving\sto\scall\sit\seach\stime\syou\s\nloop\sthrough\sa\srange\sof\sIP\saddresses.\n\nModified\sTCL\s8.3\s...../lib/tcl8.3/http2.3/http.tcl\s\n\nproc\shttp::geturl\s{\surl\sargs\s}\s{\n...deleted\sstuff....\n#\sProcess\scommand\soptions.\n\narray\sset\sstate\s{\n-blocksize\s\s\s\s\s\s8192\n-queryblocksize\s8192\n-validate\s\s\s\s\s\s\s0\n-headers\s\s\s\s\s\s\s\s{}\n-timeout\s\s\s\s\s\s\s\s0\n-type\s\s\s\s\s\s\s\s\s\s\sapplication/x-www-form-urlencoded\n-queryprogress\s\s{}\n-address\s\s\s\s\s\s\s\s{}\s\s\s\s\s\s\s;#\sadded\sto\sallow\saddresses\nstate\s\s\s\s\s\s\s\s\s\s\sheader\nmeta\s\s\s\s\s\s\s\s\s\s\s\s{}\ncurrentsize\s\s\s\s\s0\ntotalsize\s\s\s\s\s\s\s0\nquerylength\s\s\s\s\s0\nqueryoffset\s\s\s\s\s0\ntype\s\s\s\s\s\s\s\s\s\s\s\stext/html\nbody\s\s\s\s\s\s\s\s\s\s\s\s{}\nstatus\s\s\s\s\s\s\s\s\s\s""\nhttp\s\s\s\s\s\s\s\s\s\s\s\s""\n}\nset\soptions\s{-blocksize\s-channel\s-command\s-handler\s-\nheaders\s\\\n\s\s\s\s\s\s\s\s\s\s\s\s\s-progress\s-query\s-queryblocksize\s-\nquerychannel\s-queryprogress\\\n\s\s\s\s\s\s\s\s\s\s\s\s\s-validate\s-timeout\s-type\s-address}\n...deleted\sstuff......\n\n#\sthis\sis\swhere\sthe\senhancement\spatch\sexecutes\n#\sI\sam\sunsure\sif\sthe\sfirst\s"if"\sneeds\sto\sbe\smodified\s\nor\snot\n\n\sif\s{[info\sexists\sphost]\s&&\s[string\slength\s$phost]}\s{\n\sset\ssrvurl\s$url\n\sset\sconStat\s[catch\s{eval\s$defcmd\s$async\s{$phost\s\n$pport}}\ss]\n\s}\selseif\s{$state(-address)\s==\s""}\s{\s\s;#\schanged\selse\s\nto\selseif\s-\ssystem\sdefault\saddress,\soption\snot\sused\n\s\s\s\s\s\s\sset\sconStat\s[catch\s{eval\s$defcmd\s$async\s{$host\s\n$port}}\ss]\n\s\s\s}\selse\s{\s\s\s\s\s;#\sadded\selse,\sset\sstatement,\sand\s-\nmyaddr\s$state(-address)\n\s\s\s\s\s\s\s\s\sset\sconStat\s[catch\s{eval\s$defcmd\s$async\s{-\nmyaddr\s$state(-address)\s$host\s$port}}\ss]\n\s\s\s\s\s}\n\nExample:\n\nset\sresult\s[catch\s{http::geturl\s$url\s-timeout\s$TIMEOUT\s\n\\\s\n\s-headers\s"Cookie\s$cookie($localIp,$url)"\s\\\n\s-address\s$localIp}\stoken]\n\s\s\s\nDocumentation:\n\n::http::geturl\surl\s?options?\s\n\nThe\s::http::geturl\scommand\sis\sthe\smain\sprocedure\sin\s\nthe\spackage.\sThe\s-query\soption\scauses\sa\sPOST\soperation\s\nand\sthe\s-validate\soption\scauses\sa\sHEAD\soperation;\s\notherwise,\sa\sGET\soperation\sis\sperformed.\s\nThe\s::http::geturl\scommand\sreturns\sa\stoken\svalue\sthat\s\ncan\sbe\sused\sto\sget\sinformation\sabout\sthe\stransaction.\s\nSee\sthe\sSTATE\sARRAY\sand\sERRORS\ssection\sfor\sdetails.\s\nThe\s::http::geturl\scommand\sblocks\suntil\sthe\soperation\s\ncompletes,\sunless\sthe\s-command\soption\sspecifies\sa\s\ncallback\sthat\sis\sinvoked\swhen\sthe\sHTTP\stransaction\s\ncompletes.\s::http::geturl\stakes\sseveral\soptions:\s\n\n-address\saddr\s(borrowed\sfrom\sthe\s-myaddr\sdescription\s\nin\sthe\ssocket\sdocumentation\sand\sadded\sthis\spart:\s"or\s\nmultiple\saddresses\sbound\sto\sa\snetwork\sinterface")\n\nAddr\sgives\sthe\sdomain-style\sname\sor\snumerical\sIP\s\naddress\sof\sthe\sclient-side\snetwork\sinterface\sto\suse\s\nfor\sthe\sconnection.\sThis\soption\smay\sbe\suseful\sif\sthe\s\nclient\smachine\shas\smultiple\snetwork\sinterfaces,\sor\s\nmultiple\saddresses\sbound\sto\sa\snetwork\sinterface.\sIf\s\nthe\soption\sis\somitted\sthen\sthe\sclient-side\sinterface\s\nwill\sbe\schosen\sby\sthe\ssystem\ssoftware.\s\n\n\n
J foundin None
J priority 5\sMedium
J resolution None
J status Open
J submitter bbeacham
J subsystem 29.\shttp\sPackage
J title Add\s-address\soption\sto\shttp::geturl
J type Patch
K 420060ffffffffffffffffffffffffffffffffff
U bbeacham
Z 7c4dc028b20bf2dbe413e3136215eee8