Raging Sloth Tech

A Long time coming and almost there...

Thanks to a comment pointing out the use of a particular php file in the uploading of thumbnails to a Synology NAS by Louis Somers I'm hot on the trail of making a useful and easy to use alternative file uploader. Turns out that there are actually a few PHP files in the mix (it was driving me crazy trying to figure out how that one alone could do things but a little more digging into the file system and it looks like there are at least 5 server scripts involved.) I've already got super fast multithreaded python code to generate the thumbnails so once I can figure these scripts out it won't be long.

**Update - after a good deal of struggling I've come to realize a few things.
  1. There are two php files in use. One gives a list of files that are going to be transferred and the other is called for each thumbnail that is uploaded
  2. The file uploads are done with PUTs rather than POSTs to php files (this was really confusing when reading the php file and seeing references to files but nowhere where they are taken from the request…)
  3. Even though my NAS is setup to prefer HTTPS all of these transfers are done over unencrypted HTTP which means I spent a lot of time setting up proxies and things so I didn't have to mess with my settings to spy on the requests when the answer in the end was wireshark

**Update 2
  1. There are three php files in use because while you can use HTTPAuth to access files on the NAS you need to be specifically logged in to photo station to be able to do things (I've got this working)
  2. The second file sets up the transfer for a particular image (I've got this working)
  3. The third file is called multiple times with PUT. Once for each Thumbnail and once for the original file. (I have a test case for a single thumbnail working)
  4. In retrospect the original comment mentioned the use of PUT but I lost track of that in the confusion from the fact the system uses HTTP headers and accesses them through the _SERVER object when it really should be using parameters. This caused untold problems because I duplicated the wireshark output in setting my parameters including termination codes and the python requests library went all nuts on me when I included those codes… I spent like 3 hours debugging just to find out I had to delete \r\n from my header values...
  5. I'm done for the night but I now have all the basic code needed to make a third party uploader. I expect a working script tomorrow and a GUI to follow (not sure how long this will take as I haven't used a python GUI library in quite a while.)
blog comments powered by Disqus