[erlang-questions 1] Re: [erlang-questions] Webmachine questions

Alain O'Dea alain.odea@REDACTED
Thu Mar 24 16:48:13 CET 2011


Hi Ulf:

On 2011-03-24, at 5:45, u a <uaforum1@REDACTED> wrote:

> Hello,
> 
> i am working on a small project, where i am using webmachine.
> Everything works fine, but know i have some question regarding the
> tool.
> 
> 1. Tunneld delete throw POST (HTML forms)
> 
> Because of the limitation of the browser, i have to tunnel a delete
> request throw a post request to webmachine.
> When i look in the trace, great tool :-) , my request comes to the
> decision M16 where the question is asked if this is a DELETE method or
> not.
> The answer is false , because it is a POST and not a DELETE method.
> 
> Is it possible to change the method from a POST to a DELETE or which
> kind of solution is the best?
> 
> 2. Getting the protocol for the location
> 
> When i create a location header or a redirect, i want to decide of the
> underlying socket, which kind of protocol i have to use (HTTP or HTTPS
> for instance. I found that the socket is part of webmachine_request,
> but there is no function inside wrq to retrieve this information.
> 
> Is there an easy way to detect the protocol which is used inside the
> resource?
> 
> Thanks for your help,
> Ulf
> 

1. Your resource's process_post function needs to handle this.  Since you are tunneling DELETE through POST it is actually POST that you need to handle.  I am guessing your tunneling is based on a form param called method.  Read that and branch in process_post :)

2. No idea off the top of my head how to get the protocol.  I don't think vanilla webmachine wrq has this info.  I'm pretty sure it is visible in Zotonic webmachine resources though


More information about the erlang-questions mailing list