Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You DO have to open it, otherwise you won't know what URL it will redirect to. As Greg put it:</p> <blockquote> <p>A short link is a key into somebody else's database; you can't expand the link without querying the database</p> </blockquote> <p>Now to your question.</p> <blockquote> <p>Does anyone know of a more efficient way to complete this operation without using open (since it is a waste of bandwidth)?</p> </blockquote> <p>The more efficient way is to not close the connection, keep it open in the background, by using HTTP's <code>Connection: keep-alive</code>.</p> <p>After a small test, unshorten.me seems to take the <code>HEAD</code> method into account and doing a redirect to itself:</p> <pre><code>&gt; telnet unshorten.me 80 Trying 64.202.189.170... Connected to unshorten.me. Escape character is '^]'. HEAD http://unshort.me/index.php?r=http%3A%2F%2Fbit.ly%2FcXEInp HTTP/1.1 Host: unshorten.me HTTP/1.1 301 Moved Permanently Date: Mon, 22 Aug 2011 20:42:46 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 Location: http://resolves.me/index.php?r=http%3A%2F%2Fbit.ly%2FcXEInp Cache-Control: private Content-Length: 0 </code></pre> <p>So if you use the <code>HEAD</code> HTTP method, instead of <code>GET</code>, <strong>you will actually end up doing the same work twice</strong>.</p> <p>Instead, you should keep the connection alive, which will save you only a little bandwidth, but what it <strong>will</strong> certainly save is the <strong>latency</strong> of establishing a new connection every time. Establishing a TCP/IP connection is <strong>expensive</strong>.</p> <p>You should get away with a number of kept-alive connections to the unshorten service equal to the number of concurrent connections your own service receives.</p> <p>You could manage these connections in a pool. That's the closest you can get. Beside <a href="http://systembash.com/content/tweaking-tcp-for-fast-100mbps-connections-and-transfers-on-linux/" rel="nofollow">tweaking your kernel</a>'s TCP/IP stack.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload