tornadoweb / tornadoweb/tornado

Timeout with HEAD method of AsyncHTTPClient on valid URL

Open
#2,250 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

httpclient
Dominant language
Python
Stars
22.2k
Forks
5.6k
Avg merge
3h 42m
Merged PRs (30d)
16

Description

I can't get AsyncHTTPClient to do a simple HEAD request.

Not working:

#!/usr/bin/env python
import logging
from tornado import ioloop
from tornado.web import gen
from tornado.httpclient import AsyncHTTPClient
logging.basicConfig(level=logging.DEBUG)


@gen.coroutine
def test():
    url = "https://r4---sn-8vq54vox2u-apne.googlevideo.com/videoplayback?aitags=133%2C134%2C135%2C136%2C160&sparams=aitags%2Cclen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&mime=video%2Fmp4&id=o-AK1r9zLt8iQEN-zyIbOXynTtGcj201h1Qivmb4INkx0Q&itag=135&dur=125.600&lmt=1380999388644463&ip=94.62.195.82&key=yt6&expire=1516640181&clen=2196699&signature=53D81AE57372BADC88F66B6B33EB220E42847E10.B3EAC4C02578FFBAA553A47652BE63312A8DFF7D&ms=au&ei=VcNlWq62DtilWOP7m8AB&mv=m&mt=1516618492&ipbits=0&mn=sn-8vq54vox2u-apne&mm=31&requiressl=yes&keepalive=yes&pl=16&source=youtube&gir=yes&initcwndbps=940000&ratebypass=yes"
    client = AsyncHTTPClient()
    try:
        response = yield client.fetch(url, method="HEAD", validate_cert=False)
        print response.status
        print response.headers
    except:
        logging.exception("error")

    ioloop.IOLoop.current().stop()


if __name__ == '__main__':
    test()
    ioloop.IOLoop.current().start()

working just fine:

import requests
url = "https://r4---sn-8vq54vox2u-apne.googlevideo.com/videoplayback?aitags=133%2C134%2C135%2C136%2C160&sparams=aitags%2Cclen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&mime=video%2Fmp4&id=o-AK1r9zLt8iQEN-zyIbOXynTtGcj201h1Qivmb4INkx0Q&itag=135&dur=125.600&lmt=1380999388644463&ip=94.62.195.82&key=yt6&expire=1516640181&clen=2196699&signature=53D81AE57372BADC88F66B6B33EB220E42847E10.B3EAC4C02578FFBAA553A47652BE63312A8DFF7D&ms=au&ei=VcNlWq62DtilWOP7m8AB&mv=m&mt=1516618492&ipbits=0&mn=sn-8vq54vox2u-apne&mm=31&requiressl=yes&keepalive=yes&pl=16&source=youtube&gir=yes&initcwndbps=940000&ratebypass=yes"
r = requests.request('HEAD', url)
print r.headers

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the AsyncHTTPClient.fetch call in the reproducer and compare its HEAD request behavior with the working requests example. Verify the behavior against the supplied valid URL; done means the asynchronous request completes and exposes the response status and headers instead of timing out.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.