Hi, thank you for this wonderful project.
On servers that disable allow_url_fopen for security reasons (in my case, DreamHost), we need an alternative to the get_headers() function call, which reports:
# warning: get_headers() [function.get-headers]: URL file-access is disabled in the server configuration in /modules/private_upload/private_upload.module on line 130.
# warning: get_headers() [function.get-headers]: This function may only be used against URLs. in modules/private_upload/private_upload.module on line 130
It seems that uploaded files don't get uploaded into the private directory in this instance, they remain in the public directory.
Thanks for any help you can provide.
Peace
Comments
Comment #1
iokevins commentedIt's probably obvious but the actual line number is 129 due to a debugging line I threw into the file.
Comment #2
iokevins commentedHere's a patch that resolves the failing call to get_headers(). I implement a new function, private_upload_is_publicly_accessible($url) which uses cURL to test the 200 & 302 HEAD status codes.
Here's the driver code I used to test:
Peace
UPDATE: See below for latest patch.
Comment #3
iokevins commentedComment #4
iokevins commentedBug fixes in the latest patch:
1) Status codes now recorded properly as strings and not integers
2) While(!feof($fp)) loop removed since comparing against headers other than the very first one might lead to incorrect results. It's also efficient.
Peace
Comment #5
starbow commentedThis is very cool work, and should help out the PHP4 folk, as well those on Dreamhost. Why do you call is cURL though? It doesn't use the libCurl library.
I am going to change around the logic a little bit, but I will incorporate your patch into the next beta.
thanks!
Comment #6
iokevins commentedHi starbow,
You're welcome.
Honestly, I regret the confusion above (and in the patch) between the libCurl and PHP implementation. This represents my first foray into this functionality and the documentation represents my own confusion. I appreciate you letting me know it wasn't cURL--aside from minor embarrassment I've corrected a mistaken assumption.
Peace
Comment #7
starbow commentedHi Schultkl,
Actually, I don't know much about curl one way or the other. I was just asking.
thanks again.
Comment #8
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.