1b3ac TCL http - The Tcl programming language
Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
TCL http

Posted by rome77 (rome77), 16 May 2006
Hello ALL!!!

I need to create the HTTP package :

POST /reset/index.html /HTTP/1.1\r\n
Request method: POST
Request URI: /reset/index.html
Request Version: HTTP/1.1
Host: 192.168.1.1\r\n
User-agent: Mozilla....
Referer: http://192.168.1.1/reset/\r\n
Authorization: Basic xxxxx
Credentials: admin:admin

My code is :

proc geturl_auth {url username password} {
   set auth "Basic [base64::encode $username:$password]"
   set ref "http://192.168.1.1/reset/\n"
   set zapros "reset/index.html"
   set headerl [list Authorization $auth Referer $ref]
   set tok [http::geturl $url -headers $headerl ?? -query ]
   set res [http::data $tok]
   http::cleanup $tok
   return $res
}

Without the -query option I have GET request. If I apply -query it insert "Line-based text data: application/x-www-form-url-encoded" in the package. In this case the device ( I need that for reset the ADSL modem ) answer - Bad request.

Could help me anyboby . Sorry for my english.



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2013: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho
0