<p dir="ltr">Hmmm. Putting upload one step out in the frontline..</p>
<p dir="ltr">I ask my office also about nginx and also test install for myself. </p>
<p dir="ltr">Anyway, a pure pharo streaming solution is still interesting for me.</p>
<p dir="ltr">R<br>
</p>
<div class="gmail_quote">2016.01.18. 19:20 ezt írta (&quot;Tobias Pape&quot; &lt;<a href="mailto:Das.Linux@gmx.de">Das.Linux@gmx.de</a>&gt;):<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Johan<br>
On <a href="tel:18.01.2016" value="+3618012016">18.01.2016</a>, at 19:18, Johan Brichau &lt;<a href="mailto:johan@inceptive.be">johan@inceptive.be</a>&gt; wrote:<br>
<br>
&gt; Hi Tobias,<br>
&gt;<br>
&gt; This is what we do since years :)<br>
&gt; There was a blog post online describing all the details but I don’t find it anymore.<br>
&gt; The only think I can find is Nick Ager’s reply when we had a little trouble setting it up [1]<br>
&gt;<br>
&gt; I might try to separate off the code to spare you some time.<br>
&gt; It’s quite simple, actually.<br>
<br>
Oh that would be just great. My students would rejoice to no longer see the spurious &quot;503 gateway timed out&quot; messaged ;)<br>
<br>
Best regards<br>
        -Tobias<br>
<br>
<br>
&gt;<br>
&gt; [1] <a href="http://forum.world.st/Using-nginx-file-upload-module-td3591666.html" rel="noreferrer" target="_blank">http://forum.world.st/Using-nginx-file-upload-module-td3591666.html</a><br>
&gt;<br>
&gt; Johan<br>
&gt;<br>
&gt;&gt; On 18 Jan 2016, at 18:56, Tobias Pape &lt;<a href="mailto:Das.Linux@gmx.de">Das.Linux@gmx.de</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Hey all<br>
&gt;&gt;<br>
&gt;&gt; just my 2ct while skimming the thread.<br>
&gt;&gt;<br>
&gt;&gt; I have upload problems with my seaside app<br>
&gt;&gt; and plan to tackle them by utilizing the reverse proxy.<br>
&gt;&gt; In my scenario, that is nginx, wich ships an &quot;upload module&quot;<br>
&gt;&gt;      <a href="https://www.nginx.com/resources/wiki/modules/upload/" rel="noreferrer" target="_blank">https://www.nginx.com/resources/wiki/modules/upload/</a><br>
&gt;&gt;<br>
&gt;&gt; Given that, the upload is handled by the reverse proxy and only when<br>
&gt;&gt; the file is already on the file system, the backend (seaside in this case)<br>
&gt;&gt; would get a notification request.<br>
&gt;&gt;<br>
&gt;&gt; I plan to implement this within the next 6 weeks, so if I get going something<br>
&gt;&gt; usable, I&#39;ll probably hand it back to the seaside community :)<br>
&gt;&gt; Remind me if I forget ;)<br>
&gt;&gt;<br>
&gt;&gt; best regards<br>
&gt;&gt;      -Tobias<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On <a href="tel:18.01.2016" value="+3618012016">18.01.2016</a>, at 18:00, Robert Kuszinger &lt;<a href="mailto:kuszinger@giscom.hu">kuszinger@giscom.hu</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Sven,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; thanks for the demo. Zn without Seaside is just fine if it could work. A one-field form with only the uploaded file could work also. Some javascript addition on client side is acceptable - I&#39;ll see then. I understand that a simple file upload is also &quot;composite&quot; data with filename and binary content...<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Usage: An office need to receive large map / digital survey data files from clients. Now they post it on CD or DVD disks, however the typical amount is 100-200 Mb in one or two or more files (depending one who has heard about ZIP and who hasn&#39;t :) - really! ). So we are trying to create an upload portal where they could login and then upload files to folders where folder name contains their ID and date. That&#39;s it.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; No, SSH/SFTP or FTP with OS auth is not acceptable. They want pure browser upload as clients know this from their everyday life. And they could also add metadata about their uploads.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Login, auth to existing client database is done in Seaside/Pharo in a few hours, works nicely.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I would be great to create the upload receiving part also with Pharo at least.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; All this stuff is behind and IIS/ARR - tested for large uploads, worked well when extending timeout limitations is IIS (with Kom but eating memory, maybe not so much as Zinc now, but it had the codepage problem I wanted debug earlier). OS is Windows Server 2008 R2Datacenter Edition, IIS 7.5.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I&#39;m developing on Linux and testing on Windows Server 2008 configured to the same setup (IIS, ARR, etc.)<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; This is the scenario.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Robert<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Sven Van Caekenberghe &lt;<a href="mailto:sven@stfx.eu">sven@stfx.eu</a>&gt; ezt írta (időpont: 2016. jan. 18., H, 16:30):<br>
&gt;&gt;&gt; Robert,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; This is not such an easy problem, you have to really understand HTTP.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; BTW, such huge uploads don&#39;t seem a very good idea anyway, you will get annoying timeouts as well. I am curious, what is in those files ?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Now, here is the key idea (pure Zn, no Seaside, quick hack):<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; (ZnServer startOn: 1701)<br>
&gt;&gt;&gt; reader: [ :stream | ZnRequest readStreamingFrom: stream ];<br>
&gt;&gt;&gt; maximumEntitySize: 100*1024*1024;<br>
&gt;&gt;&gt; onRequestRespond: [ :req |<br>
&gt;&gt;&gt;  &#39;/tmp/upload.bin&#39; asFileReference writeStreamDo: [ :out |<br>
&gt;&gt;&gt;     out binary.<br>
&gt;&gt;&gt;     ZnUtils streamFrom: req entity stream to: out ].<br>
&gt;&gt;&gt;  ZnResponse ok: (ZnEntity text: &#39;done&#39;) ];<br>
&gt;&gt;&gt; yourself.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; You would use it like this:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; $ echo one two three &gt; data.bin<br>
&gt;&gt;&gt; $ curl -X POST -d @data.bin <a href="http://localhost:1701" rel="noreferrer" target="_blank">http://localhost:1701</a><br>
&gt;&gt;&gt; $ cat /tmp/upload.bin<br>
&gt;&gt;&gt; one two three<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; With a 1Mb data file generated from Pharo:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; &#39;/tmp/data.txt&#39; asFileReference writeStreamDo: [ :out |<br>
&gt;&gt;&gt; 1 * 1024 timesRepeat: [<br>
&gt;&gt;&gt;  1 to: 32 do: [ :each |<br>
&gt;&gt;&gt;    out &lt;&lt; Character alphabet &lt;&lt; (each printStringPadded: 5); lf ] ] ]<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; $ curl -v -X POST --data-binary @data2.bin <a href="http://localhost:1701" rel="noreferrer" target="_blank">http://localhost:1701</a><br>
&gt;&gt;&gt; * Rebuilt URL to: <a href="http://localhost:1701/" rel="noreferrer" target="_blank">http://localhost:1701/</a><br>
&gt;&gt;&gt; *   Trying ::1...<br>
&gt;&gt;&gt; * connect to ::1 port 1701 failed: Connection refused<br>
&gt;&gt;&gt; *   Trying 127.0.0.1...<br>
&gt;&gt;&gt; * Connected to localhost (127.0.0.1) port 1701 (#0)<br>
&gt;&gt;&gt;&gt; POST / HTTP/1.1<br>
&gt;&gt;&gt;&gt; Host: localhost:1701<br>
&gt;&gt;&gt;&gt; User-Agent: curl/7.43.0<br>
&gt;&gt;&gt;&gt; Accept: */*<br>
&gt;&gt;&gt;&gt; Content-Length: 1048576<br>
&gt;&gt;&gt;&gt; Content-Type: application/x-www-form-urlencoded<br>
&gt;&gt;&gt;&gt; Expect: 100-continue<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt; * Done waiting for 100-continue<br>
&gt;&gt;&gt; * We are completely uploaded and fine<br>
&gt;&gt;&gt; &lt; HTTP/1.1 200 OK<br>
&gt;&gt;&gt; &lt; Content-Type: text/plain;charset=utf-8<br>
&gt;&gt;&gt; &lt; Content-Length: 4<br>
&gt;&gt;&gt; &lt; Date: Mon, 18 Jan 2016 14:56:53 GMT<br>
&gt;&gt;&gt; &lt; Server: Zinc HTTP Components 1.0<br>
&gt;&gt;&gt; &lt;<br>
&gt;&gt;&gt; * Connection #0 to host localhost left intact<br>
&gt;&gt;&gt; done<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; $ diff data2.bin /tmp/upload.bin<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; This code is totally incomplete, you need lots of error handling. Furthermore, working with streaming requests is dangerous, because you are responsible for reading the bodies correctly.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Also, if you want an upload in a form, you will have to parse that form (see ZnApplicationFormUrlEncodedEntity and ZnMultiPartFormDataEntity), you will then again take it in memory. These things are normally done for you by Zn and/or Seaside.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I also tried with 100Mb, it worked, but it took several minutes, like 10 to 15. The #streamFrom:to: above uses a 16Kb buffer, which is probably too small for this use case. Maybe curl doesn&#39;t upload very aggressively. Performance is another issue.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; That is why I asked what is in the files, what you eventually want to do with it. Is the next processing step in Pharo too ?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Maybe all that is needed is giving Pharo more memory. What platform are you on ?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Sven<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; On 18 Jan 2016, at 13:39, Robert Kuszinger &lt;<a href="mailto:kuszinger@giscom.hu">kuszinger@giscom.hu</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Sven,<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; thanks for the comments. I understand all.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Could you please clarify this:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; &quot;Technically, it would be possible to write a Zn handler that can accept a large upload in a streaming fashion (and save it to a file for example), but I don&#39;t think that will happen with Seaside - so you will pull that all in memory.&quot;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Is there a chance to create a streaming solution? Is it documented somewhere? Why do you think it won&#39;t happen with Seaside? Is there a Seaside set or design limitation?<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Answering on how it goes:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; 20 - 40 - 10MB upload in seconds. Now it seems to stuck on a ~ 120 MB upload. Pharo memory (windows OS) seemed to grow ~ 441 MB. &quot;Space is low&quot; warning window appeared. I&#39;ve clicked on &quot;Proceed&quot; just for curiosity but no reaction in the Pharo gui... hmmm...<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; thanks<br>
&gt;&gt;&gt;&gt; Robert<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; 2016-01-18 13:27 GMT+01:00 Sven Van Caekenberghe &lt;<a href="mailto:sven@stfx.eu">sven@stfx.eu</a>&gt;:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt; seaside mailing list<br>
&gt;&gt;&gt; <a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
&gt;&gt;&gt; <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" rel="noreferrer" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; seaside mailing list<br>
&gt;&gt; <a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
&gt;&gt; <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" rel="noreferrer" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; seaside mailing list<br>
&gt; <a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
&gt; <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" rel="noreferrer" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
<br>
_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" rel="noreferrer" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
</blockquote></div>