Giter Club home page Giter Club logo

httprot's Introduction

Httprot

** TODO: Add description **

httprot's People

Contributors

meh avatar sdancer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

httprot's Issues

Issue with header/ cookie parsing

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

** (CondClauseError) no cond clause evaluated to a true value

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.

** (UndefinedFunctionError) undefined function: String.to_char_list!/1

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.