progrium / localtunnel

Expose localhost servers to the Internet
MIT License
3.2k stars 241 forks source link

Error under OS X: httplib.BadStatusLine: '' #84

Closed romanenko closed 9 years ago

romanenko commented 11 years ago

Hello. I used to use previous, ruby version of localtunnel, noticed that you released a new one, but I can't get it working.

I installed localtunnel with pip, on OSX Mountain Lion, and when I try to run it, I get this error:

$ localtunnel-beta 3000
Traceback (most recent call last):
  File "/usr/local/bin/localtunnel-beta", line 8, in <module>
    load_entry_point('localtunnel==0.5.8', 'console_scripts', 'localtunnel-beta')()
  File "/Library/Python/2.7/site-packages/localtunnel-0.5.8-py2.7.egg/localtunnel/client/client.py", line 73, in run
  File "/Library/Python/2.7/site-packages/localtunnel-0.5.8-py2.7.egg/localtunnel/util.py", line 45, in discover_backend_port
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 394, in open
    response = self._open(req, data)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 412, in _open
    '_open', req)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1199, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1170, in do_open
    r = h.getresponse(buffering=True)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1027, in getresponse
    response.begin()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 407, in begin
    version, status, reason = self._read_status()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 371, in _read_status
    raise BadStatusLine(line)
httplib.BadStatusLine: ''

What can cause such an error? I tried to reinstall localtunnel several times, update dependencies, but nothing helps.

jeloou commented 11 years ago

I got the same error on Ubuntu 12.04 LTS, here's the traceback:

Traceback (most recent call last):
  File "/usr/local/bin/localtunnel-beta", line 9, in <module>
    load_entry_point('localtunnel==0.5.8', 'console_scripts', 'localtunnel-beta')()
  File "/usr/local/lib/python2.7/dist-packages/localtunnel/client/client.py", line 73, in run
    backend_port = util.discover_backend_port(host[0])
  File "/usr/local/lib/python2.7/dist-packages/localtunnel/util.py", line 45, in discover_backend_port
    headers={"Host": "_backend.{0}".format(hostname)}))
  File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 400, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 418, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1207, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1180, in do_open
    r = h.getresponse(buffering=True)
  File "/usr/lib/python2.7/httplib.py", line 1030, in getresponse
    response.begin()
  File "/usr/lib/python2.7/httplib.py", line 407, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.7/httplib.py", line 371, in _read_status
    raise BadStatusLine(line)
httplib.BadStatusLine: ''
jbrodie commented 11 years ago

Same ....

Traceback (most recent call last): File "/usr/local/bin/localtunnel-beta", line 9, in load_entry_point('localtunnel==0.5.8', 'console_scripts', 'localtunnel-beta')() File "/usr/local/lib/python2.7/dist-packages/localtunnel/client/client.py", line 73, in run backend_port = util.discover_backend_port(host[0]) File "/usr/local/lib/python2.7/dist-packages/localtunnel/util.py", line 45, in discover_backend_port headers={"Host": "_backend.{0}".format(hostname)})) File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen return _opener.open(url, data, timeout) File "/usr/lib/python2.7/urllib2.py", line 394, in open response = self._open(req, data) File "/usr/lib/python2.7/urllib2.py", line 412, in _open '_open', req) File "/usr/lib/python2.7/urllib2.py", line 372, in _call_chain result = func(*args) File "/usr/lib/python2.7/urllib2.py", line 1201, in http_open return self.do_open(httplib.HTTPConnection, req) File "/usr/lib/python2.7/urllib2.py", line 1174, in do_open r = h.getresponse(buffering=True) File "/usr/lib/python2.7/httplib.py", line 1027, in getresponse response.begin() File "/usr/lib/python2.7/httplib.py", line 407, in begin version, status, reason = self._read_status() File "/usr/lib/python2.7/httplib.py", line 371, in _read_status raise BadStatusLine(line) httplib.BadStatusLine: ''

kayue commented 11 years ago

Same here:

Traceback (most recent call last):
  File "/usr/local/bin/localtunnel-beta", line 8, in <module>
    load_entry_point('localtunnel==0.5.8', 'console_scripts', 'localtunnel-beta')()
  File "build/bdist.macosx-10.8-intel/egg/localtunnel/client/client.py", line 73, in run
  File "build/bdist.macosx-10.8-intel/egg/localtunnel/util.py", line 45, in discover_backend_port
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 394, in open
    response = self._open(req, data)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 412, in _open
    '_open', req)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1199, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1170, in do_open
    r = h.getresponse(buffering=True)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1027, in getresponse
    response.begin()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 407, in begin
    version, status, reason = self._read_status()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 371, in _read_status
    raise BadStatusLine(line)
httplib.BadStatusLine: ''
VKen commented 11 years ago

Same issue on Ubuntu Quantal.

httplib.BadStatusLine: ''

Installed in virtualenv using pip as shown in the readme's instructions.

Dived into the code to trace what went wrong. It seems the default hostname v2.localtunnel.com isn't responding correctly.

def discover_backend_port(hostname, frontend_port=80):
    try:
        data = urllib2.urlopen(urllib2.Request(
            "http://{0}:{1}/".format(hostname,frontend_port),
            headers={"Host": "_backend.{0}".format(hostname)}))
        return int(data.read())
    except urllib2.HTTPError:
        raise RuntimeError("Frontend failed to provide backend port")

I tried that urllib2.Request line that's having problem in ipython by passing in the respective arguments, and I got:

URLError: <urlopen error [Errno -2] Name or service not known>

A totally different error. (I think I'm missing something...) This might mean that part of the issue is the localtunnel service at v2.localtunnel.com is down.

fizerkhan commented 11 years ago

Duplicate #87 Same issue in OSX (Mountain Lion), Python 2.7.2.

amacneil commented 11 years ago

Looks like the same error for me:

Adrians-MacBook-Air:~ adrian$ python --version
Python 2.7.2
Adrians-MacBook-Air:~ adrian$ localtunnel-beta 82
Traceback (most recent call last):
  File "/usr/local/bin/localtunnel-beta", line 8, in <module>
    load_entry_point('localtunnel==0.5.8', 'console_scripts', 'localtunnel-beta')()
  File "/Library/Python/2.7/site-packages/localtunnel-0.5.8-py2.7.egg/localtunnel/client/client.py", line 73, in run
  File "/Library/Python/2.7/site-packages/localtunnel-0.5.8-py2.7.egg/localtunnel/util.py", line 45, in discover_backend_port
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 394, in open
    response = self._open(req, data)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 412, in _open
    '_open', req)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1199, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1170, in do_open
    r = h.getresponse(buffering=True)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1027, in getresponse
    response.begin()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 407, in begin
    version, status, reason = self._read_status()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 371, in _read_status
    raise BadStatusLine(line)
httplib.BadStatusLine: ''
fizerkhan commented 11 years ago

It seems v2.localtunnel.com is offline

mileszs commented 11 years ago

Same errors here, OSX Mountain Lion. Went:

brew install python
pip install localtunnel
/usr/loca/share/python/localtunnel-beta 3000
david-l-young commented 11 years ago

Same. OSX

tbuehl commented 11 years ago

Same here, OSX Mountain Lion. Installed via easyinstall, client: 0.5.8.

localtunnel-beta --version
client: 0.5.8
server: ?? (v2.localtunnel.com)
egrachev commented 11 years ago

same problem client 0.6.0, ubuntu 12.10

juanriaza commented 11 years ago

Now seems to be working

fizerkhan commented 11 years ago

@juanriaza Getting different error

localtunnel-beta 8080

Traceback (most recent call last):
  File "/usr/local/bin/localtunnel-beta", line 8, in <module>
    load_entry_point('localtunnel==0.5.8', 'console_scripts', 'localtunnel-beta')()
  File "/Library/Python/2.7/site-packages/localtunnel/client/client.py", line 73, in run
    backend_port = util.discover_backend_port(host[0])
  File "/Library/Python/2.7/site-packages/localtunnel/util.py", line 48, in discover_backend_port
    raise RuntimeError("Frontend failed to provide backend port")
RuntimeError: Frontend failed to provide backend port
progrium commented 11 years ago

Upgrade localtunnel with: pip install --upgrade localtunnel

On Wed, Apr 3, 2013 at 3:11 AM, Fizer Khan notifications@github.com wrote:

@juanriaza https://github.com/juanriaza Getting different error

Traceback (most recent call last): File "/usr/local/bin/localtunnel-beta", line 8, in load_entry_point('localtunnel==0.5.8', 'console_scripts', 'localtunnel-beta')()

File "/Library/Python/2.7/site-packages/localtunnel/client/client.py", line 73, in run

backend_port = util.discover_backend_port(host[0])

File "/Library/Python/2.7/site-packages/localtunnel/util.py", line 48, in discover_backend_port

raise RuntimeError("Frontend failed to provide backend port")

RuntimeError: Frontend failed to provide backend port

— Reply to this email directly or view it on GitHubhttps://github.com/progrium/localtunnel/issues/84#issuecomment-15828687 .

Jeff Lindsay http://progrium.com