Aller au contenu

Messages recommandés

Posté(e)

Bonjour à  tous,

 

Je rencontre une erreur LUA avec le HC2 Toolkit Framework et je suis à  court d'idée. Et vous ?

Je voudrais afficher le contenu du body.

[DEBUG] 15:59:04: -------------------------------------------------------------------------
[DEBUG] 15:59:04: -- HC2 Toolkit Framework version 1.0.3
[DEBUG] 15:59:04: -- Current interpreter version is Lua 5.1
[DEBUG] 15:59:04: -- Total memory in use by Lua: 213.90 Kbytes
[DEBUG] 15:59:04: -------------------------------------------------------------------------
[DEBUG] 15:59:04: Toolkit.Debug loaded in memory...
[DEBUG] 15:59:04: Benchmark [Toolkit.Debug lib]: elapsed time: 0.000 cpu secs
[DEBUG] 15:59:04: Toolkit.Collections.Queue loaded in memory...
[DEBUG] 15:59:04: Benchmark [Toolkit.Collections.Queue lib]: elapsed time: 0.010 cpu secs
[DEBUG] 15:59:04: Toolkit.Net loaded in memory...
[DEBUG] 15:59:04: Benchmark [Toolkit.Net lib]: elapsed time: 0.000 cpu secs
[DEBUG] 15:59:04: Toolkit.Crypto loaded in memory...
[DEBUG] 15:59:04: Benchmark [Toolkit.Crypto lib]: elapsed time: 0.000 cpu secs
[DEBUG] 15:59:04: Toolkit.Crypto.Sha1 loaded in memory...
[DEBUG] 15:59:04: Benchmark [Toolkit.Crypto.Sha1 lib]: elapsed time: 0.010 cpu secs
[DEBUG] 15:59:04: Toolkit.Crypto.Base64 loaded in memory...
[DEBUG] 15:59:04: Benchmark [Toolkit.Crypto.Base64 lib]: elapsed time: 0.000 cpu secs
[DEBUG] 15:59:04: Toolkit.Net.HttpRequest > Total memory in use by Lua: 217.26 Kbytes
[DEBUG] 15:59:04: Toolkit.Net.HttpRequest > Create Session on port: 80, host: gestionbbox.lan
[DEBUG] 15:59:04: Toolkit.Net.HttpRequest::setReadTimeout > Timeout set to 1000 ms
[DEBUG] 15:59:04: Toolkit.Net.HttpRequest::request > /admin/index.htm with method GET
[DEBUG] 15:59:04: Toolkit.Net.HttpRequest::request > Add header [GET /admin/index.htm HTTP/1.1]
[DEBUG] 15:59:04: Toolkit.Net.HttpRequest::request > Add header [Host: gestionbbox.lan:80]
[DEBUG] 15:59:04: Toolkit.Net.HttpRequest::request > Add header [Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4]
[DEBUG] 15:59:04: Toolkit.Net.HttpRequest::request > Add header [Accept: */*]
[DEBUG] 15:59:05: Toolkit.Net.HttpRequest::receive > Length of result: 10007
[DEBUG] 15:59:05: Toolkit.Net.HttpRequest::receive > Status 200
[DEBUG] 15:59:05: Toolkit.Net.HttpRequest::receive > Length of headers reponse 186
[DEBUG] 15:59:05: raw #1:HTTP/1.1 200 OK
[DEBUG] 15:59:05: raw #2:CONTENT-LANGUAGE: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4
[DEBUG] 15:59:05: raw #3:Content-type: text/html
[DEBUG] 15:59:05: raw #4:Transfer-Encoding: chunked
[DEBUG] 15:59:05: Toolkit.Net.HttpRequest::receive > Transfer-Encoding: chunked
[DEBUG] 15:59:05: raw #5:Date: Mon, 25 May 2015 14:00:36 GMT
[DEBUG] 15:59:05: raw #6:Server: Apache 1.3.29
[DEBUG] 15:59:05: Length of body reponse: 9820
[ERROR] 15:59:06: line 131: bad argument #2 to 'format' (no value)

 

à‡a coince dans cette fonction

  -- trace(value, args...)
  -- (string) value: value to trace (can be a string template if args)
  -- (various) args: data used with template (in value parameter)
  trace = (function(self, value, ...)
    if (self.isTraceEnabled) then
      if (value~=nil) then        
        return fibaro:debug(string.format(value, ...));
      end
    end
  end),

Et j'ai mis ça comme code :

  Toolkit.Net.isTraceEnabled = true;

	-- recuperation du token
  local HttpClient = Toolkit.Net.HttpRequest(BboxObject._host, 80);
  HttpClient:setReadTimeout(1000);
  local response, status, errorCode = HttpClient:request("GET", 
    "/admin/index.htm", {
		"Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4",
    "Accept: */*",
      }, nil);

  HttpClient:disconnect();
  HttpClient:dispose();
  HttpClient = nil;
  Toolkit.Net.isTraceEnabled = false;
  local _return = false;
×
×
  • Créer...