Opened 8 years ago

Closed 7 years ago

#367 closed defect (fixed)

504 Gateway Time-out from http proxy when eepsite does not end with '/'

Reported by: bpb Owned by: dream
Priority: minor Milestone: 0.9
Component: apps/i2ptunnel Version: 0.8.7
Keywords: 504 i2p http proxy Cc: killyourtv@…
Parent Tickets: Sensitive: no


When attempting to connect to an eepsite through the http proxy (several tested, e.g. h.i2p, www.i2p2.i2p, bluepaper.i2p, 33pz6wn6qqntoxs4hfrhjiinihmse6w2uhdwcrwjqwma7icz5qaa.b32.i2p etc.) curl and some web browsers require that a forward slash be included after the URL.

This problem did not occur when attempting to connect to google w/o the proxy or google w/ the proxy, so it appears that this issue only effects eepsites using the i2p http proxy.

This problem has caused eepsite connectivity issues for users.

This issue was confirmed by others in #i2p-chat

$ http_proxy= curl -I http://bluepaper.i2p
HTTP/1.0 504 Gateway Time-out
Date: Mon, 03 Jan 2011 01:13:46 GMT
Connection: close
Content-Type: text/html
Expires: Mon, 03 Jan 2011 01:13:46 GMT
Content-Length: 1195
Proxy-Connection: close

$ http_proxy= curl -I http://bluepaper.i2p/
HTTP/1.1 200 OK
Date: Mon, 03 Jan 2011 01:13:48 GMT
Accept-Ranges: bytes
Last-Modified: Mon, 03 Jan 2011 01:04:06 GMT
Content-Type: text/html
Connection: close
Content-Length: 3854
Proxy-Connection: close

Client information:

I2P version: 0.8.2-0
Java version: Apple Inc. 1.6.0_22 (Java™ SE Runtime Environment 1.6.0_22-b04-307-10M3261)
Platform: Mac OS X x86_64 10.6.5
Processor: uninitialized (unrecognized)
Jbigi: Native BigInteger? library jbigi not loaded - using pure Java - poor performance may result - see http://www.i2p2.i2p/jbigi.html for help
Encoding: MacRoman?


Change History (8)

comment:1 Changed 8 years ago by killyourtv

Cc: killyourtv@… added

I was one of those in #i2p-chat that was able to confirm this issue.

Using a self-compiled

I2P version: 0.8.2-6
Java version: Sun Microsystems Inc. 1.6.0_22 (Java(TM) SE Runtime Environment 1.6.0_22-b04)
Platform: Linux amd64 2.6.36-zen1
Processor: uninitialized (athlon64)
Jbigi: Locally optimized native BigInteger library loaded from the library path
Encoding: UTF-8

comment:2 Changed 8 years ago by zzz

Component: unspecifiedapps/i2ptunnel
Priority: majortrivial
Type: defectenhancement

http://example.i2p is not a valid URL according to the RFCs. There must always be a / after the hostname. Browsers rectify the URL by adding a '/'. Curl apparently does not.

Eepget also does not. It also fails without a trailing '/'.

So this is not a bug. But it would be nice if it were handled better.

comment:3 Changed 8 years ago by bpb

To clarify, curl has no issue handling URLs w/o a '/' fine for non-eepsites.

$ curl -I
HTTP/1.1 200 OK
Server: nginx/0.6.32
Date: Mon, 03 Jan 2011 17:15:31 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
ETag: "2d768baaa1afe5ca35179b665871c47c"
Content-Length: 8699

Additionally, some users were reporting issues with their browsers forwarding to sites without manually adding '/'. Unfortunately I don't have any more information about which users/browsers, etc.

comment:4 Changed 8 years ago by killyourtv


Update: It seems these requests are sent to the outproxy.

$ http_proxy=localhost:4444 curl -i http://killyourtv.i2p
HTTP/1.0 504 Gateway Time-out
Date: Tue, 23 Aug 2011 04:26:18 GMT
Content-Length: 1319
Connection: close
Content-Type: text/html
Proxy-Connection: close

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" ""> <html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>ERROR: The requested URL could not be retrieved</title> <style type="text/css"><!--   %l  body :lang(fa) { direction: rtl; font-size: 100%; font-family: Tahoma, Roya, sans-serif; float: right; } :lang(he) { direction: rtl; float: right; }  --></style> </head><body> <div id="titles"> <h1>ERROR</h1> <h2>The requested URL could not be retrieved</h2> </div> <hr>  <div id="content"> <p>The following error was encountered while trying to retrieve the URL: <a href="http://killyourtv.i2p/">http://killyourtv.i2p/</a></p>  <blockquote id="error"> <p><b>Unable to determine IP address from host name <q>killyourtv.i2p</q></b></p> </blockquote>  <p>The DNS server returned:</p> <blockquote id="data"> <pre>Name Error: The domain name does not exist.</pre> </blockquote>  <p>This means that the cache was not able to resolve the hostname presented in the URL. Check if the address is correct.</p>  <p>Your cache administrator is <a href="mailto:webmaster">webmaster</a>.</p> <br> </div>  <hr> <div id="footer"> <p>Generated Tue, 23 Aug 2011 04:26:18 GMT by (squid/2.7.STABLE9)</p> <!-- ERR_DNS_FAIL --> </div> </body></html>

comment:5 Changed 8 years ago by zzz

Milestone: 0.9
Owner: set to dream
Priority: trivialminor
Status: newassigned
Type: enhancementdefect

I believe dream attempted to fix this just after 0.8.8 was released. But the curl line above still fails for me, as does eepget. There may be a separate issue in eepget but it seems like dream's change should have worked? Reassigning to him.

Revision: 804bb87106b8e0129d06020ddf5f77ddc242d622
Parent:   a78c79524630e6c3e53539c616fd7e05c700dfe8
Author:   dream@mail.i2p
Date:     08/23/2011 04:28:05 AM
Branch:   i2p.i2p


Proper handling of implied "/" paths

Changes against parent a78c79524630e6c3e53539c616fd7e05c700dfe8

  patched  apps/i2ptunnel/java/src/net/i2p/i2ptunnel/

--- apps/i2ptunnel/java/src/net/i2p/i2ptunnel/	401517638fb4b11b6d0ff5c3b9f5dd59528c692a
+++ apps/i2ptunnel/java/src/net/i2p/i2ptunnel/	e2c3deef96697cc86b93ae5740b40e0d2779dbf4
@@ -389,8 +389,7 @@ public class I2PTunnelHTTPClient extends
                     // pos is the start of the path
                     pos = request.indexOf("/");
                     if (pos == -1) {
-                        method = null;
-                        break;
+                        pos = request.length();
                     host = request.substring(0, pos);

comment:6 Changed 8 years ago by zzz

From a conversation on IRC, dream said that his checkin referenced above didn't accomplish what he wanted it to, and that it didn't do anything at all (zzz iirc).
I requested that he revert it but was unsuccessful in convincing him.
I reverted the checkin just before the 0.8.9 release on the principle that if a change doesn't do what was intended it probably shouldn't remain, even if it is apparently harmless.

There's actually two pieces to any possible fix - one in eepget and one in the HTTP Client code itself.

comment:7 Changed 7 years ago by killyourtv

It may be too soon to report this as fixed but with 0.8.13-1:

$ http_proxy= curl -I http://killyourtv.i2p
HTTP/1.1 200 OK
ETag: "11face-129b-4ba1b68db87eb"
Vary: Accept-Encoding
Date: Fri, 02 Mar 2012 11:17:06 GMT
Content-Length: 4763
Last-Modified: Wed, 29 Feb 2012 14:46:32 GMT
Content-Type: text/html
Connection: close
Accept-Ranges: bytes
Proxy-Connection: close
$ http_proxy= curl -I http://zzz.i2p
HTTP/1.1 200 OK
Connection: close
Content-Length: 20361
ETag: "3f8fb51769cb241c719653415dea7145"
Set-Cookie: _eldorado_session_id=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo%250ASGFzaHsABjoKQHVzZWR7AA%253D%253D--9fd679cd561f2a4e63d4deed6a90b498c4ddb27b; path=/
Date: Fri, 02 Mar 2012 11:17:55 GMT
X-Runtime: 0.24397
Content-Type: text/html; charset=utf-8
Cache-Control: private, max-age=0, must-revalidate
Proxy-Connection: close

Back on 0.8.13:

$ http_proxy= curl -I http://zzz.i2p
HTTP/1.0 503 Service Unavailable
Content-Language: en
X-Squid-Error: ERR_DNS_FAIL 0
Vary: Accept-Language
Date: Fri, 02 Mar 2012 11:18:32 GMT
Content-Length: 4182
X-Cache-Lookup: MISS from localhost:3333
Content-Type: text/html
X-Cache: MISS from localhost
Mime-Version: 1.0
Proxy-Connection: close
Connection: close

comment:8 Changed 7 years ago by killyourtv

Resolution: fixed
Status: assignedclosed

I think this can definitely be closed as fixed now. Fixed as of 0.8.13-1. Thanks zzz!

Note: See TracTickets for help on using tickets.