Closed (cannot reproduce)
Project:
Shorten URLs
Version:
6.x-1.12
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Aug 2011 at 19:58 UTC
Updated:
15 Jul 2012 at 07:39 UTC
I get two of these in the watchdog log each time I create a node:
CURL failed to return an abbreviated URL from .
with details:
Error: Please enter a valid URL to shorten
I suspect this is because I've not set up any API keys -- in which case, the module should just warn with hook_requirements() and not keep trying to operate.
Alternatively, it could be because I'm on localhost.
(A side issue -- does the module really get a shortened URL on the offchance I need the token, for every single node save? That seems rather wasteful if so.)
Comments
Comment #1
icecreamyou commentedYou should not be able to select any of the services that require API keys if you haven't entered API keys. Which service are you trying to use?
It will work fine on localhost as long as your local instance has internet access.
If you enable that token in the module's settings, then yes, it does. That has nothing to do with Shorten URLs -- it's just the way Token works. Every single token is built and retrieved every time it *might* be needed. However, Shorten URLs caches the URLs it retrieves, so you generally won't notice any related performance issues.
Comment #2
joachim commented> You should not be able to select any of the services that require API keys if you haven't entered API keys. Which service are you trying to use?
I'm not trying to use any service! I installed the module to see if I could use its API in some custom code, and now when I save new nodes I get that message.
> However, Shorten URLs caches the URLs it retrieves, so you generally won't notice any related performance issues.
What I meant by 'wasteful' is that it's creating a shortened URL at say bit.ly which is going to be thrown away. These are surely finite!
Comment #3
icecreamyou commentedThe module uses (mostly third-party) URL shortening services like bit.ly to shorten URLs. Even if you didn't set one explicitly, there should be a default one and a backup one enabled in the module's settings.
Sure, but you need the short URL to make a short URL token, and there's no way to tell whether the token is actually going to be used before the Token module asks for it. It's an issue with the way the Token module is designed, not an issue with Shorten URLs. However, if you're not using that token, you can turn it off in the module's settings.
Comment #4
icecreamyou commentedAny thoughts on how I might reproduce it? I haven't seen this error before and everything seems to be working for me.
Comment #5
icecreamyou commentedComment #6
joachim commentedI'm getting more of this sort of thing when I publish nodes in bulk via node admin:
I still have no API keys set up... I would expect shorten module in this instance to remain mute rather than try and contact things it doesn't have!
Comment #7
icecreamyou commentedis.gd doesn't need an API key. There is no contacting anything it doesn't have.
Also you should upgrade to 1.12 - at the very least the errors will probably be more useful.
A 502 error is a server error, but "failed to open stream" usually means something is blocking outbound requests. Can your local server make HTTP requests?
Comment #8
joachim commented> Can your local server make HTTP requests?
Yes, definitely.
(Though shouldn't you be using drupal_http_request() rather than file_get_contents()?
> There is no contacting anything it doesn't have.
Well what I mean (probably) is that I've not
> Also you should upgrade to 1.12
Just checked -- that's the version I was on in fact.
Is there a way to prevent attempts at shortening? I see that 'Generate a shortened URL for nodes for use as tokens' was selected which is probably the cause. But there's 'Shorten aliased URLs where possible' too and that's rather vague...
Comment #9
icecreamyou commentedThe D7 branch uses drupal_http_request(), but that function doesn't support the ability to time out in D6, which could potentially lead to extremely long page load times if it was used. The D7 branch handles requests a little more gracefully than the D6 branch in general.
Missing the rest of that sentence?
Disabling "Generate a shortened URL for nodes for use as tokens" should make it so that URLs are only shortened if you explicitly ask for them to be shortened by calling the API, using the UI provided at /shorten or in the Shorten URLs block, or using some other module that calls the API. The "Shorten aliased URLs where possible" setting just means that for example if you try to shorten /node/32, the module will look for an alias of /node/32 instead.
I'm really not sure what else to tell you. I can't reproduce this and I haven't heard of it happening before. The shortening service you're using (is.gd) appears to be functioning fine, so if your server configuration isn't blocking outbound HTTP requests I'm not sure what would cause this.
Comment #10
icecreamyou commentedAny additional information? Any difference with other shortening services?
Comment #11
icecreamyou commented