Giter VIP home page Giter VIP logo

Comments (8)

benoitc avatar benoitc commented on July 17, 2024

Do you close headers by \r\n\r\n ? Header part should be :

HTTP/1.1 200 OK\r\nContent-Length: 10\r\nContent-Type: text/plain\r\n\r\n

Note the final trailing \r\n .

To give me a better trace you can use set_logging function at top of your code.

from restkit.

benoitc avatar benoitc commented on July 17, 2024

About GIT erro, I can't reproduce it here.

from restkit.

benoitc avatar benoitc commented on July 17, 2024

bump

from restkit.

drewp avatar drewp commented on July 17, 2024

Sorry about the brief report. Here's a full example. The headers are definitely not closed with \r\n\r\n. This is easily in violation of http (I haven't checked for sure), but every client I have tried can work with it anyway, including prior versions of restkit. Therefore I'd call this a regression in restkit, and it's a problem I really ran into in the wild.

virtualenv .

cat > lousy.cgi
#!/bin/sh
echo "Content-type: image/png"
echo ""
convert -size 100x100 gradient: png:-
Ctrl-d

thttpd -p 9999 -d . -c "*" -D     
(leave that running)

bin/easy_install -U http://github.com/benoitc/restkit/tarball/0.9.4
bin/python -c "import restkit; print restkit.Resource('http://localhost:9999/lousy.cgi').get().body" | display -
(success)

bin/easy_install -U "restkit==0.9.6" 
bin/python -c "import restkit; print restkit.Resource('http://localhost:9999/lousy.cgi').get().body" | display -
Traceback (most recent call last):
 File "<string>", line 1, in <module>
 File "build/bdist.linux-x86_64/egg/restkit/resource.py", line 135, in get
 File "build/bdist.linux-x86_64/egg/restkit/resource.py", line 231, in request
restkit.errors.RequestError: 'bool' object has no attribute 'seek'

from restkit.

drewp avatar drewp commented on July 17, 2024

logging doesn't add much, here:

bin/python -c "import restkit, logging; logging.basicConfig(level=logging.DEBUG); restkit.set_logging(logging.DEBUG); print restkit.Resource('http://localhost:9999/lousy.cgi').get().body" 
2010-05-11 23:34:54 [25020] [INFO] Start request: GET http://localhost:9999/lousy.cgi
INFO:restkit.client:Start request: GET http://localhost:9999/lousy.cgi
2010-05-11 23:34:54 [25020] [INFO] Start request: GET http://localhost:9999/lousy.cgi
INFO:restkit.client:Start request: GET http://localhost:9999/lousy.cgi
2010-05-11 23:34:54 [25020] [INFO] Start request: GET http://localhost:9999/lousy.cgi
INFO:restkit.client:Start request: GET http://localhost:9999/lousy.cgi
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "build/bdist.linux-x86_64/egg/restkit/resource.py", line 135, in get
  File "build/bdist.linux-x86_64/egg/restkit/resource.py", line 231, in request
restkit.errors.RequestError: 'bool' object has no attribute 'seek'

from restkit.

benoitc avatar benoitc commented on July 17, 2024

last line of headers is \r\n according the spec :

 generic-message = start-line
                          *(message-header CRLF)
                          CRLF
                          [ message-body ]
 start-line      = Request-Line | Status-Line

http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4

Any possibility you could send me the header messages you get. Using curl -v would do the trick.

from restkit.

benoitc avatar benoitc commented on July 17, 2024

Any news about it ?

from restkit.

benoitc avatar benoitc commented on July 17, 2024

fixed in http-parser branch. Thanks for the report.

from restkit.

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.