Skip to content

Error to reload in the browser #18

@DaiMotoh

Description

@DaiMotoh

After POST the arc_challenge of the sample, will result in an error to reload in the browser.
But sometimes Does not result in an error to reload.
"response.html" specified in the "reply_page" exists under the "views" folder.
What's wrong?

  • Error display in the browser
There was an error processing your request.

Stack Trace

app/arc_challenge.lua:23: variable 'reply_page' is not declared

stack traceback:

    [C]: in function 'error'
    /usr/share/lua/5.1//tir/strict.lua:37: in function 
    app/arc_challenge.lua:23: in function 

Source Code

0013: local function arc(web, req)
0014:     local params = {}
0015:     
0016:     repeat
0017:         params = web:prompt(prompt_page {form = params})
0018:     until prompt_form:valid(params)
0019: 
0020:     web:page(link_page {})
0021:     web:click()
0022: 
0023:     web:page(reply_page {form=params})
0024: end

Request

"Request" 2 = {
  conn_id = "247"
  sender = "41307cd9-38e3-474c-8723-efd74797bcc1"
  path = "/Arc"
  session_id = "APP-0360dee5ad9e1bbff2496fc75750a459"
  body = ""
  data = {
  }
  headers = {
    connection = "keep-alive"
    x-forwarded-for = "192.168.1.2"
    host = "192.168.1.222:6767"
    accept-charset = "UTF-8,*;q=0.5"
    VERSION = "HTTP/1.1"
    METHOD = "GET"
    pragma = "no-cache"
    referer = "http://192.168.1.222:6767/Arc"
    accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
    PATH = "/Arc"
    cookie = "session="APP-0360dee5ad9e1bbff2496fc75750a459""
    cache-control = "no-cache"
    accept-language = "ja,en-US;q=0.8,en;q=0.6"
    accept-encoding = "gzip,deflate,sdch"
    PATTERN = "/Arc"
    URI = "/Arc"
    user-agent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"
  }
}
  • Log
[root@localhost arc_challenge]# tir start
Started app/arc_challenge.lua PID 31212
CONNECTING      /Two    6de504e5-ebef-4b83-9fc7-1a55274818b8    tcp://127.0.0.1:9982    tcp://127.0.0.1:9981
REQUEST /Arc:273        Mon Jun 25 17:10:22 2012        /Arc    GET     APP-0360dee5ad9e1bbff2496fc75750a459
REQUEST /Arc:277        Mon Jun 25 17:14:46 2012        /Arc    POST    APP-0360dee5ad9e1bbff2496fc75750a459
REQUEST /Arc:281        Mon Jun 25 17:14:51 2012        /Arc    GET     APP-0360dee5ad9e1bbff2496fc75750a459
REQUEST /Arc:285        Mon Jun 25 17:14:54 2012        /Arc    GET     APP-0360dee5ad9e1bbff2496fc75750a459
REQUEST /Arc:289        Mon Jun 25 17:14:56 2012        /Arc    GET     APP-0360dee5ad9e1bbff2496fc75750a459
REQUEST /Arc:293        Mon Jun 25 17:14:57 2012        /Arc    GET     APP-0360dee5ad9e1bbff2496fc75750a459
REQUEST /Arc:297        Mon Jun 25 17:14:58 2012        /Arc    GET     APP-0360dee5ad9e1bbff2496fc75750a459
REQUEST /Arc:301        Mon Jun 25 17:15:05 2012        /Arc    POST    APP-0360dee5ad9e1bbff2496fc75750a459
  • Conf
arc = Handler(send_spec='tcp://127.0.0.1:9990',
                send_ident='41307cd9-38e3-474c-8723-efd74797bcc1',
                recv_spec='tcp://127.0.0.1:9989', recv_ident='')

main = Server(
    uuid="f400bf85-4538-4f7a-8908-67e313d515c2",
    access_log="logs/access.log",
    error_log="logs/error.log",
    chroot="arc_challenge/",
    default_host="192.168.1.222",
    name="main",
    pid_file="run/main.pid",
    port=6767,
    hosts=[ Host(name="192.168.3.109", routes={ '/Arc': arc }) ]
)

settings = {"zeromq.threads": 5 }

servers = [main]
  • Source
require 'tir.engine'

-- local redis = require 'redis'
-- local client = redis.connect('127.0.0.1', 6379)
-- local response = client:ping()

local prompt_page = Tir.view("index.html")
local link_page = Tir.view("link.html")
local reply_page = Tir.view("response.html")

local prompt_form = Tir.form {'msg'}

local function arc(web, req)
    local params = {}

    repeat
        params = web:prompt(prompt_page {form = params})
    until prompt_form:valid(params)

    web:page(link_page {})
    web:click()

    web:page(reply_page {form=params})
end

Tir.start {route = '/Arc', main=arc}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions