Open benzen opened 9 years ago
I've seen your update of the documentation for Cauldron. So i've updated my usage to:
defmodule Foo do
# respond to a GET / request with "Hello, World!"
def handle("GET", %URI{path: "/"}, req) do
req |> Request.reply(200, "Hello, World!")
end
end
Now I have this error:
08:49:01.633 [error] Error in process <0.234.0> with exit value: {undef,[{'Elixir.Request',reply,[#{'__struct__'=>'Elixir.Cauldron.HTTP.Request',connection=>#{'__struct__'=>'Elixir.Reagent.Connection',id=>#Ref<0.0.0.1099>,listener=>#{'__struct__'=>'Elixir.Reagent.Listener',acceptors=>#{'__struct__'=>'Elixir.HashSet'...
08:49:01.650 [error] {:undef, [{Request, :reply, [#Cauldron.Request<GET http://127.0.0.1:7792/>, 200, "Hello, World!"], []}]}
08:49:02.037 [error] {:function_clause, [{Foo, :handle, ["GET", %URI{authority: "127.0.0.1:7792", fragment: nil, host: "127.0.0.1", path: "/favicon.ico", port: 7792, query: nil, scheme: "http", userinfo: nil}, #Cauldron.Request<GET http://127.0.0.1:7792/favicon.ico>], [file: 'lib/AntWorld.ex', line: 23]}]}
08:49:02.037 [error] Error in process <0.235.0> with exit value: {function_clause,[{'Elixir.Foo',handle,[<<3 bytes>>,#{'__struct__'=>'Elixir.URI',authority=><<14 bytes>>,fragment=>nil,host=><<9 bytes>>,path=><<12 bytes>>,port=>7792,query=>nil,scheme=><<4 bytes>>,userinfo=>nil},#{'__struct__'=>'Elixir.Cauldron.HTTP.Request',connection=>#{'__struct__'=>'Elixir.Reagent.Connection'...
You're missing use Cauldron
.
Thanks i've add it now.
But i've got this error now:
10:33:36.082 [error] Error in process <0.254.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'...
What version of Elixir are you using?
And what browser? Can you paste the headers that are being sent?
elixir 1.0.1 browser chrome: 38.0.2125.111
Chrome says it's provisional headers
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Referer:
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36
X-DevTools-Emulate-Network-Conditions-Client-Id:8D9CD180-5528-E5FE-F28C-20F7271F64D8
Also chrome says it recieve an empty response.
Can you try with another browser please? I'm still unable to reproduce it, just want to know if it's one of those headers you pasted above or if something else is going on.
I ll try with curl
Envoyé de mon iPhone
Le 2014-11-11 à 17:29, meh. notifications@github.com a écrit :
Can you try with another browser please? I'm still unable to reproduce it, just want to know if it's one of those headers you pasted above or if something else is going on.
— Reply to this email directly or view it on GitHub.
it works just fine. Maybe by chrome is sending some funky request
Oh i know what went wrong. In my chrome test, I've always used the localhost But with curl i had an error saying that's it's not lisening on this name. So i went for 127.0.0.1
On chrome when i switched for the ip, everything whent great.
I think I know.
You probably used the same port for other projects, and there are some cookies registered that httprot is barfing on, now if you could find them and sanitize them from personal information, that would be great.
Here it is
Name | value |
---|---|
COMPANY_ID | 10255 |
COOKIE_SUPPORT | true |
GUEST_LANGUAGE_ID | fr_FR |
ID | 52414b4e617e4432484539414273464a2f3968305a773d3d |
JSESSIONID | F30173812FC6C4A93F24934FA498461C |
JSESSIONID | AB9EF827DB20D82B0C7E8940B6AE56A5 |
LFR_SESSION_STATE_10434 | expired |
SCREEN_NAME | 5a4f6b6b34616e31316a6c5634716e78526b335158673d3d |
USER_UUID | "awPGWlFwQ12XGYgmmAoXxrSy+XAIN+jf4GcRMeo46pQ=" |
_ga | GA1.1.1116705830.1411494152 |
_your_app_key | bHFIS1ppWC85MmRNX0tFMS95ZUpVVjNabVU3V1FMVkNPWjMrbzdGenhBaz0tLXllUEg3T1c2SWNsUkErTEFMS3RLclE9PQ==--/Bgwwalu25d50QePyTGVeDbOgoI= |
org.cups.sid | 1ef1a3d43a1ab87b711e02b9d39ff532 |
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
But i have this error message when i head up to the page localhost:7786/file
Is there something that i'm missing ?
I m using httprot with cauldron