HTTP requests fail
gabble - May 25, 2006 - 08:31
| Project: | Janode |
| Version: | HEAD |
| Component: | Miscellaneous |
| Category: | bug report |
| Priority: | normal |
| Assigned: | AjK |
| Status: | closed |
Description
Everytime a URL is checked against 404, fopen fails:
fopen(http://www.foo.com/%2F): failed to open stream: HTTP request failed!
HTTP/1.1 404 Not Found in [path]/modules/janode/janode.module line 386Of course, the website is up and running... as you can see in the warning, any URLs like http://www.foo.com/ become http://www.foo.com/%2FI don't know if that's the culprit, but after every cron job runs, the janode post is unpublished...

#1
gabble,
There could be one of two problems here:-
1st. Your PHP installation, for some reason, not have "fopen wrappers" enabled. (http://uk2.php.net/manual/en/wrappers.php)
In which case the fopen() call would fail. The above patch does an ini_get("allow_url_fopen") to test for this condition. If it's found not to be present, the link check is aborted and a watchdog notice is issued telling you that this was the case.
2nd. Your web server may be behind a firewall that allows incoming HTTP requests (as is normal for a web server) but does not allow your server to make outgoing HTTP requests (i.e. the web server is not allowed to act as a browser itself). I made a note if this in the README.txt file. If you have ssh access to the server host and it has wget installed, you can check your server can get remote pages from the shell command line thus:
$wget http://www.foo.comThe above patch adds an addittional feature. In admin >> settings >> janode there is a new checkbox to disable the link check. If you find janodes useful but wish them not to be checked (and sent into the moderation queue) uncheck the checkbox and save. This wil at least allow you to use janodes and not have them unpublished by the automated link checker.
Let me know how you get on.
Best regards
--AjK
#2
gabble,
I have found that if "fopen wrappers" are disabled, the error message is "URL file-access is disabled in the server configuration".
So I can only assume the "failed to open stream: HTTP request failed" failure is due to the set up of your server. More likely a firewall on your hosts network that prevents outgoing HTTP requests from your server to other servers. You will need to speak to your hosting provider regarding this issue in that case.
Since this isn't a bug (I did note this condition may exist in the README.txt file) I'm altering the status of this ticket to "feature request" as I have supplied a patch that does given some additional functionality.
regards
--AjK
#3
I should read more closely! It seems the call to urlencode was too early and encoded the slash when it should not have.
The attached patch is same as 01 above but should fix the early urlencode problem.
In addition, I added in proper use of check_markup() function.
Try this and let me know how you get on.
regards
--AjK
#4
Thank you, I try next monday, then I'll let you know!
#5
gabble,
I decided that this was a bug (early urlencode) so I changed the category of this issue.
For you info, I have tested and already commited the change so it would probably be better to download a fresh copy before you try next week.
Thanks for your feedback and hopefully look forward to a positive outcome.
best regards
--AjK
#6
patch fix confirmed to myself via email.
regards
--AjK
#7