Httprot
** TODO: Add description **
Prot prot prot.
** TODO: Add description **
I'm pretty new to elixir so please excuse me if my question are silly.
I'm trying to use cauldron
With an exemple found here
defmodule Foo do
# respond to a GET / request with "Hello, World!"
def handle("GET", %URI{path: "/file"}, req) do
req.reply(200, "Hello, World!")
end
end
Cauldron.start Foo, port: 7786
But i have this error message when i head up to the page localhost:7786/file
21:54:11.719 [error] Error in process <0.247.0> with exit value: {{badmatch,[<<9 bytes>>,<<44 bytes>>,<<1 byte>>]},[{'Elixir.HTTProt.Headers','-from_string/2-lc$^1/1-0-',1,[{file,"lib/httprot/headers.ex"},{line,142}]},{'Elixir.HTTProt.Headers','-from_string/2-lc$^1/1-0-',1,[{file,"lib/httprot/headers.ex"},{line,141}]},{'Elixir.HTTProt.Headers'...
Is there something that i'm missing ?
I m using httprot with cauldron
Hi.
If I do:
> {:ok, resp} = HTTProt.get("http://www.bajenfans.se/feed/")
{:ok,
%HTTProt.Response{headers: %HTTProt.Headers{list: [{"accept-ranges",
"Accept-Ranges", "bytes"},
{"cache-control", "Cache-Control",
["no-store", "no-cache", "must-revalidate", "post-check=0",
"pre-check=0"]}, {"connection", "Connection", "close"},
{"content-type", "Content-Type", "text/xml; charset=UTF-8"},
{"date", "Date", "Thu, 06 Aug 2015 12:40:58 GMT"},
{"etag", "Etag", "\"5245a34f9d1ad8a1bf4d978228f64c75\""},
{"expires", "Expires", "Thu, 19 Nov 1981 08:52:00 GMT"},
{"last-modified", "Last-Modified", "Thu, 06 Aug 2015 04:49:33 GMT"},
{"pragma", "Pragma", "no-cache"}, {"server", "Server", "LiteSpeed"},
{"set-cookie", "Set-Cookie",
"PHPSESSID=2c3fb246d66d5179c321c0d9f8171607; path=/"},
{"x-pingback", "X-Pingback", "http://www.bajenfans.se/xmlrpc.php"},
{"x-powered-by", "X-Powered-By", "PHP/5.4.40"}]},
request: %HTTProt.Request{headers: %HTTProt.Headers{list: []}, method: :get,
socket: #Port<0.8824>,
uri: %URI{authority: "www.bajenfans.se", fragment: nil,
host: "www.bajenfans.se", path: "/feed/", port: 80, query: nil,
scheme: "http", userinfo: nil}},
status: %HTTProt.Status{code: 200, text: "OK"}}}
and then
> HTTProt.Response.body(resp)
I get
** (CondClauseError) no cond clause evaluated to a true value
(httprot) HTTProt.Response.body/1
This cond is failing, because neither header is present.
If I do
> HTTProt.get("https://github.com/meh/httprot")
I get
** (UndefinedFunctionError) undefined function: String.to_char_list!/1
(elixir) String.to_char_list!("github.com")
(socket) lib/socket/ssl.ex:134: Socket.SSL.connect/3
(httprot) lib/httprot/request.ex:42: HTTProt.Request.open/3
(httprot) lib/httprot.ex:20: HTTProt.get/2
It is not really httprot problem but socket, can be easily fixed with {:socket, github: "meh/elixir-socket", tag: "ec03c935565dbe4708d6b594ef57d6de17a93592", override: true}
in mix.exs where tag is current master hash, so probably it is a time just to make new release of socket.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.