{"action":"created","issue":{"url":"https://api.github.com/repos/pintsized/lua-resty-http/issues/78","repository_url":"https://api.github.com/repos/pintsized/lua-resty-http","labels_url":"https://api.github.com/repos/pintsized/lua-resty-http/issues/78/labels{/name}","comments_url":"https://api.github.com/repos/pintsized/lua-resty-http/issues/78/comments","events_url":"https://api.github.com/repos/pintsized/lua-resty-http/issues/78/events","html_url":"https://github.com/pintsized/lua-resty-http/issues/78","id":177790973,"number":78,"title":"simple post request does not work","user":{"login":"wanghaisheng","id":2363295,"avatar_url":"https://avatars.githubusercontent.com/u/2363295?v=3","gravatar_id":"","url":"https://api.github.com/users/wanghaisheng","html_url":"https://github.com/wanghaisheng","followers_url":"https://api.github.com/users/wanghaisheng/followers","following_url":"https://api.github.com/users/wanghaisheng/following{/other_user}","gists_url":"https://api.github.com/users/wanghaisheng/gists{/gist_id}","starred_url":"https://api.github.com/users/wanghaisheng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wanghaisheng/subscriptions","organizations_url":"https://api.github.com/users/wanghaisheng/orgs","repos_url":"https://api.github.com/users/wanghaisheng/repos","events_url":"https://api.github.com/users/wanghaisheng/events{/privacy}","received_events_url":"https://api.github.com/users/wanghaisheng/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-19T13:54:55Z","updated_at":"2016-09-19T15:13:49Z","closed_at":null,"body":"os:mac \r\n\r\ni am trying to build post request  using following code\r\n```\r\n\r\n      -- For simple singleshot requests, use the URI interface.\r\n      local http = require \"resty.http\"\r\n      local httpc = http.new()\r\n      local res, err = httpc:request_uri(\"http://wi.hit.edu.cn/cemr\", {\r\n        method = \"POST\",\r\n                headers = { [\"Upgrade-Insecure-Requests\"]=\"1\",\r\n                [\"accept\"]=\"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\",[\"Accept-Encoding\"]=\"gzip, deflate\",\r\n                [\"referer\"]=\"http://wi.hit.edu.cn/cemr/\",[\"cache-control\"]=\"max-age=0\",[\"connection\"]=\"keep-alive\",\r\n                [\"user-agent\"]=\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:48.0) Gecko/20100101 Firefox/48.0\",\r\n                [\"host\"]=\"wi.hit.edu.cn\",[\"Content-Length\"]=\"705\",[\"Content-Type\"] = \"application/x-www-form-urlencoded\" },\r\n                body = \"source=1. 患者既往有高血压病史,最高达180/100mmHg,口服北京降压灵、利血平治疗,有脑梗死病史,遗留语笨及左侧肢体无力.2. 门诊行头CT检查,显示左侧侧脑室体旁低密度病灶,以脑梗死收入我科.\"\r\n\r\n      })\r\n\r\n      if not res then\r\n        ngx.say(\"failed to request: \", err)\r\n        return\r\n      end\r\n\r\n      -- In this simple form, there is no manual connection step, so the body is read\r\n      -- all in one go, including any trailers, and the connection closed or keptalive\r\n      -- for you.\r\n\r\n      ngx.status = res.status\r\n\r\n      for k,v in pairs(res.headers) do\r\n          --\r\n      end\r\n\r\n      ngx.say(res.body)\r\n\r\n```\r\n\r\noutcome i am looking for is to realize post request in  the following  page \r\nhttp://wi.hit.edu.cn/cemr/,\r\nthe full request info i get from firefox debug tools is \r\n```\r\nHost: wi.hit.edu.cn\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:48.0) Gecko/20100101 Firefox/48.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3\r\nAccept-Encoding: gzip, deflate\r\nReferer: http://wi.hit.edu.cn/cemr/\r\nConnection: keep-alive\r\nUpgrade-Insecure-Requests: 1\r\nCache-Control: max-age=0\r\n\r\nform-data  \r\nsource:\"1.+患者既往有高血压病史,最高达180/100mmHg,口服\"北京降压灵、利血平\"治疗,有脑梗死病史,遗留语笨及左侧肢体无力.\r\n2.+门诊行头CT检查,显示左侧侧脑室体旁低密度病灶,以\"脑梗死\"收入我科.\"\r\n```\r\n\r\nfull error is like this \r\n```\r\n2016/09/19 21:51:58 [error] 28920#0: *31 lua tcp socket read timed out, client: 127.0.0.1, server: , request: \"GET /cemr HTTP/1.1\", host: \"localhost:8081\"\r\n\r\n```\r\n\r\nbut curl works\r\ncurl -d \"source=患者既往有高血压病史,最高达180/100mmHg,口服北京降压灵、 利血平治疗,有脑梗死病史,遗留语笨及左侧肢体无力.\" http://wi.hit.edu.cn/cemr/  > result.html\r\n"},"comment":{"url":"https://api.github.com/repos/pintsized/lua-resty-http/issues/comments/248022285","html_url":"https://github.com/pintsized/lua-resty-http/issues/78#issuecomment-248022285","issue_url":"https://api.github.com/repos/pintsized/lua-resty-http/issues/78","id":248022285,"user":{"login":"wanghaisheng","id":2363295,"avatar_url":"https://avatars.githubusercontent.com/u/2363295?v=3","gravatar_id":"","url":"https://api.github.com/users/wanghaisheng","html_url":"https://github.com/wanghaisheng","followers_url":"https://api.github.com/users/wanghaisheng/followers","following_url":"https://api.github.com/users/wanghaisheng/following{/other_user}","gists_url":"https://api.github.com/users/wanghaisheng/gists{/gist_id}","starred_url":"https://api.github.com/users/wanghaisheng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wanghaisheng/subscriptions","organizations_url":"https://api.github.com/users/wanghaisheng/orgs","repos_url":"https://api.github.com/users/wanghaisheng/repos","events_url":"https://api.github.com/users/wanghaisheng/events{/privacy}","received_events_url":"https://api.github.com/users/wanghaisheng/received_events","type":"User","site_admin":false},"created_at":"2016-09-19T15:13:48Z","updated_at":"2016-09-19T15:13:48Z","body":"after add \r\n```\r\n      httpc:set_timeout(60000)\r\n\r\n```\r\nor\r\n```\r\n      httpc:set_timeout(600)\r\n```\r\nstill the same error"}}
{"actor":{"display_login":"wanghaisheng"}}