Comments (8)
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.
About GIT erro, I can't reproduce it here.
from restkit.
bump
from restkit.
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.
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.
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.
Any news about it ?
from restkit.
fixed in http-parser branch. Thanks for the report.
from restkit.
Related Issues (20)
- Documentation fails to build with Sphinx 1.2 HOT 1
- Document Error: Mixed case pool object typo in gevent example
- tests being installed in generic "tests" directory HOT 1
- Can't set headers per part of multipart requests HOT 1
- Add documentation on proxy usage
- Auth failed when password contains encoded / (slash)
- testsuite of -4.2.2; errors=6 HOT 1
- wsgi proxy and 'hop by hop' HOT 3
- WSGI proxy and Forwarded header
- un-contrib-ifying the proxy HOT 2
- minor performance optimization concerning location
- data coming out in wrong request HOT 1
- HostProxy misbehaves with spaces in PATH_INFO
- IOError: [Errno 0] Error on write() in tee.TeeInput._tee
- Doesn't Validate TLS HOT 4
- Exception in thread Thread-1 (most likely raised during interpreter shutdown
- no proxy support in restkit oauth? HOT 1
- Documentation for forms.py
- Attaching file to test result in test management 4 jira
- Proposing a PR to fix a few small typos
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from restkit.