ejabberd - Comments for "Serving big files through HTTP" https://www.ejabberd.im/forum/25521/serving-big-files-through-http en Thanks Badlop, I've looked at https://www.ejabberd.im/forum/25521/serving-big-files-through-http#comment-66966 <p>Thanks Badlop, I've looked at yaws but I wasn't aware of that kind of integration with ejabberd, I'll definitively look at it. These are simple questions but I'm still a beginner with ejabberd (and erlang as well..)</p> Fri, 22 Jul 2016 15:38:04 +0000 andrea comment 66966 at https://www.ejabberd.im Well, if you found that https://www.ejabberd.im/forum/25521/serving-big-files-through-http#comment-66953 <p>Well, if you found that ejabberd's listener is slowing you, you can avoid it. In the same Erlang node where ejabberd is running, you can start other applications, Yaws for instance, and serve HTTP queries from there. See <a href="https://www.ejabberd.im/yawspack" title="https://www.ejabberd.im/yawspack">https://www.ejabberd.im/yawspack</a> for example</p> Mon, 18 Jul 2016 16:08:24 +0000 badlop comment 66953 at https://www.ejabberd.im It's related to Erlang (I'm a https://www.ejabberd.im/forum/25521/serving-big-files-through-http#comment-66946 <p>It's related to Erlang (I'm a pool imperative programmer sorry :) ), you're right, but I'd like to explain you why ejabberd matters.<br /> In these days I have spent some time on it and I figured out how to avoid this problem with gen_tcp. I have seen yaws and other projects and those pointed me on serving http content as multipart/form data. I have built something from scratch without ejabberd and I have had quite good results, now the problem seems to be related to process/2 in my module, I'm under ejabberd_http in my config file, something like:</p> <div class="codeblock"><code>-<br />&nbsp; port: 5280<br />&nbsp;&nbsp;&nbsp; module: ejabberd_http<br />&nbsp;&nbsp;&nbsp; request_handlers:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;/files&quot;: modfileupload&nbsp; ## Here I am<br />&nbsp;&nbsp;&nbsp; http_bind: true<br />&nbsp;&nbsp;&nbsp; register: false<br />&nbsp;&nbsp;&nbsp; captcha: false</code></div> <p>and when something like <noindex><a href="http://localhost:5280/files/somethingelse" title="http://localhost:5280/files/somethingelse" rel="nofollow" >http://localhost:5280/files/somethingelse</a></noindex> is called I receive a request on process/2. process/2 needs to return back some data with a tuple like {HTTPCode, Headers, PageContent}. If PageContent is <strong>huge</strong> everything crashes.<br /> I wish to reply back to the client directly (on a socket) without passing the content inside a tuple/variable to someone else function. I'd like to manage directly the headers and output data as multipart to the client, I guess I could obtain better results. It seems ejabberd_http.erl calls socket_handoff/6 in my module (when available) but I don't know how to use it or if there're usage examples.<br /> Any hints ? Am I following the right path ?</p> <p>Thanks again<br /> Ben</p> Fri, 08 Jul 2016 08:27:34 +0000 andrea comment 66946 at https://www.ejabberd.im Your problem is more related https://www.ejabberd.im/forum/25521/serving-big-files-through-http#comment-66944 <p>Your problem is more related to the erlang language, and the OTP libraries than ejabberd. Look at HTTP servers written in erlang, starting with Yaws, maybe they give you some hint?</p> Thu, 07 Jul 2016 18:44:58 +0000 badlop comment 66944 at https://www.ejabberd.im