Rant on my favourite topics : LC server with a side-dish of on-rev :-)

Matthias Rebbe matthias_livecode_150811 at m-r-d.de
Sat Nov 18 06:28:33 EST 2017


Alex,

you are not alone. I  noticed something similar with LcServer 7.10 on the On-Rev server Tio.
$_post arrays where empty when data was formatted with libUrlMultipartFormData,
while $_post_raw showed the content. So it was not possible to post larger binary data to LcServer.

I send a support request already in April this year informing the On-Rev team that the installed LcServer version is not able to handle http posts when the data was formatted with libUrlMultipartFormData.
I decided to install my own version of LcServer (in my case LC9-dp6 at that time) using the .htaccess method, which solved my problem immediately.

The only caveat: If you have several add-on domains and each domain uses its own root folder under public_html, e.g.
public_html/domain1
public_html/domain2
or whatever the folder names are, you have to install your custom LcServer for each domain separately into the cgi-bin folder of each of that root folders
public_html/domain1/cgi-bin
public_html/domain2/cgi-bin

If all of your domains use public_html as the  root folder then just install it into

public_html/cgi-bin


My .htaccess looks like this, in case you are interested. This version work also with HostM accounts, while the htaccess example in the LcServer lesson doesn´t.

#
RewriteEngine on
# this suPHP…  btw allows to set php settings using a php.ini file which is stored in public_html folder
# it is not needed on HostM accounts, because PHP settings can set in cPanel there.
suPHP_ConfigPath /home/YOURACCOUNTNAME/public_html/
<Files php.ini> 
order allow,deny 
deny from all 
</Files>

Options +ExecCGI
# path the the LcServer executable
Action custom-livecode /cgi-bin/livecode-server-9dp6/livecode-server
<FilesMatch ".+\.lc$">
SetHandler custom-livecode
</FilesMatch>
# 

The permissions of the folders and the LcServer executable are set to 755. The driver and external files  are set to 644.


Maybe this will “calm" you down a little bit. ;)
Have a nice weekend.

Just forgot: Would you please be so kind and share the information which library does contain the  ArrayToJSON() function? Did you already try it out using it on LcServer?

Regards,

Matthias


> Am 18.11.2017 um 00:53 schrieb Alex Tweedly via use-livecode <use-livecode at lists.runrev.com <mailto:use-livecode at lists.runrev.com>>:
> 
> This is a bit of a rant, so if you're not in the mood, switch off now :-)
> 
> I will (when I've calmed down and organised myself :-) submit bug reports.
> 
> So, normally, I don't have much time for my favourite hobby of scripting in LC, which lately has been mostly LCServer for a couple of simple websites I have built for friends. But this week I had lots of time set aside, because I've (finally) convinced one of those website owners to do her own maintenance / updating of the site.
> 
> The site has many images - which I have typically put into my desktop copy of the site, tried them out - and then synch'ed those up to the real site. However, for the site owner to upload photos, I needed to revive my script for uploading files (specifically images), which hasn't been used in a while. And indeed, may have been played around with in the meantime - so I can't be sure that this is exactly a "once-working" script.
> 
> It was written a long time ago - back before there was any built-in way to parse multi-part form content - so I did my own parsing of the POSTed data (actually, I think someone else did it first, and I copied that :-)
> 
> However - that no longer works. Using $_POST_RAW fails when the uploaded file is a jpg image - it works ok for text file, simple PNGs etc. - but fails dramatically when the file is proper binary. Test script of
> 
>> <?lc
>> set the errormode to inline
>> put "raw has" && the number of bytes in $_POST_RAW && "bytes<br>"
>> ?>
> fails with
> 
> file "/home/ua886128/public_html/tweedly.co.uk/tryme.lc <http://tweedly.co.uk/tryme.lc>"
>  row 3, col 18: Chunk: can't get source string
>  row 3, col 18: Chunk: error in chunk expression
> .....
> 
> when the POSTed data includes a JPG file.
> 
> 
> While google'ing around for that, I ran into the Livecode lesson on this topic
> 
> http://lessons.livecode.com/m/4070/l/40708-how-to-upload-a-file-with-livecode-server <http://lessons.livecode.com/m/4070/l/40708-how-to-upload-a-file-with-livecode-server>
> 
> which uses the (newer) $_FILES array which does the complex parsing of the file info from the form - a big improvement !! And indeed, the example there works does work. BUT - it seems that although it correctly parses out the file information, it loses any other POSTed values. So if your form consists *ONLY* of one or more files to upload - you're good. But if you pass any other values (e.g. folder you want it to go to, meta-info, passwords, etc.) that is all lost. Which basically means it's unusable for any real scenario.
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list