Giter Site home page Giter Site logo

Comments (12)

kennethreitz avatar kennethreitz commented on April 28, 2024

Interesting. I wonder if these are happening at the heroku level or the app level.

from httpbin.

kennethreitz avatar kennethreitz commented on April 28, 2024

You can hit a direct tcp route to the app here: http://route.heroku.com:26966

from httpbin.

slingamn avatar slingamn commented on April 28, 2024

Interesting. The behavior is still slightly inaccurate:

>>> print requests.post('http://route.heroku.com:26966/post').content
{
  "origin": "10.44.89.92", 
  "files": {}, 
  "form": {}, 
  "url": "http://route.heroku.com:26966/post", 
  "args": {}, 
  "headers": {
    "Content-Length": "", 
    "Accept-Encoding": "identity, deflate, compress, gzip", 
    "Accept": "*/*", 
    "User-Agent": "python-requests/0.12.0", 
    "Host": "route.heroku.com:26966", 
    "Content-Type": ""
  }, 
  "json": null, 
  "data": ""
}

So the headers dict contains an empty-string value for Content-length. But the header is still not being set by Requests at all:

sendto(3, "POST /post HTTP/1.1\r\nHost: route.heroku.com:26966\r\nAccept-Encoding: identity, deflate, compress, gzip\r\nAccept: */*\r\nUser-Agent: python-requests/0.12.0\r\n\r\n", 154, 0, NULL, 0) = 154

from httpbin.

kennethreitz avatar kennethreitz commented on April 28, 2024

Interesting. I wonder if this is a wsgi bug or something to bring up with either gunicorn or werkzeug?

/cc @mitsuhiko, @benoitc

from httpbin.

slingamn avatar slingamn commented on April 28, 2024

Heh, the reported origin of 10.44.89.92 is now some sort of internal Heroku gateway? When I hit httpbin.org directly, the reported origin is my own IP.

from httpbin.

kennethreitz avatar kennethreitz commented on April 28, 2024

Correct.

from httpbin.

slingamn avatar slingamn commented on April 28, 2024

The route.heroku.com address produces the correct behavior for Connection: close:

[shivaram@good-fortune ~/Documents]$ curl -v -H "Connection: close" http://httpbin.org/headers
* About to connect() to httpbin.org port 80 (#0)
*   Trying 204.236.238.79... connected
* Connected to httpbin.org (204.236.238.79) port 80 (#0)
> GET /headers HTTP/1.1
> User-Agent: curl/7.21.7 (x86_64-redhat-linux-gnu) libcurl/7.21.7 NSS/3.13.3.0 zlib/1.2.5 libidn/1.22 libssh2/1.2.7
> Host: httpbin.org
> Accept: */*
> Connection: close
> 
< HTTP/1.1 200 OK
< Content-Type: application/json
< Date: Fri, 04 May 2012 04:00:48 GMT
< Server: gunicorn/0.13.4
< Content-Length: 280
< Connection: Close
< 
{
  "headers": {
    "Content-Length": "", 
    "Connection": "keep-alive", 
    "Accept": "*/*", 
    "User-Agent": "curl/7.21.7 (x86_64-redhat-linux-gnu) libcurl/7.21.7 NSS/3.13.3.0 zlib/1.2.5 libidn/1.22 libssh2/1.2.7", 
    "Host": "httpbin.org", 
    "Content-Type": ""
  }
* Closing connection #0
}[shivaram@good-fortune ~/Documents]$ curl -v -H "Connection: close" http://route.heroku.com:26966/headers
* About to connect() to route.heroku.com port 26966 (#0)
*   Trying 107.20.247.209... connected
* Connected to route.heroku.com (107.20.247.209) port 26966 (#0)
> GET /headers HTTP/1.1
> User-Agent: curl/7.21.7 (x86_64-redhat-linux-gnu) libcurl/7.21.7 NSS/3.13.3.0 zlib/1.2.5 libidn/1.22 libssh2/1.2.7
> Host: route.heroku.com:26966
> Accept: */*
> Connection: close
> 
< HTTP/1.1 200 OK
< Server: gunicorn/0.13.4
< Date: Fri, 04 May 2012 04:01:46 GMT
< Connection: close
< Content-Type: application/json
< Content-Length: 286
< 
{
  "headers": {
    "Content-Length": "", 
    "Connection": "close", 
    "Accept": "*/*", 
    "User-Agent": "curl/7.21.7 (x86_64-redhat-linux-gnu) libcurl/7.21.7 NSS/3.13.3.0 zlib/1.2.5 libidn/1.22 libssh2/1.2.7", 
    "Host": "route.heroku.com:26966", 
    "Content-Type": ""
  }
* Closing connection #0
}

So that one might be some sort of proxying issue.

from httpbin.

aknuds1 avatar aknuds1 commented on April 28, 2024

I was the person originally bit by the issue, trying to debug Requests. Apart from this niggle, great service :)

from httpbin.

mitsuhiko avatar mitsuhiko commented on April 28, 2024

WSGI can't work without content length so Werkzeug assumes that if the content length is not provided the request wanted to transmit no data at all. Regarding the keep alive behavior: that one is controlled by the WSGI server. The application is explicitly not allowed to control that.

from httpbin.

benoitc avatar benoitc commented on April 28, 2024

About the content-length : that's not totally true

http://www.python.org/dev/peps/pep-3333/#handling-the-content-length-header

from httpbin.

mitsuhiko avatar mitsuhiko commented on April 28, 2024

@benoitc this is referring to the outgoing content length header, not the incoming one.

from httpbin.

msabramo avatar msabramo commented on April 28, 2024

Sounds like nothing httpbin can do here then? Close able?

from httpbin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.