Search the web
Sign In
New User? Sign Up
plazesapi
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
411 Length Required   Message List  
Reply | Forward Message #106 of 236 |
Re: [plazesapi] 411 Length Required

* Till <klimpong@...> [20080113 15:24]:
> my request is versus https://sandbox.plazes.com/sessions.xml
>
> This is what I get in response:
> <html>
> <head><title>411 Length Required</title></head>
> <body bgcolor="white">
> <center><h1>411 Length Required</h1></center>
> <hr><center>nginx/0.5.35</center>
> </body>
> </html>
>
> Btw, it works when I issue the same via curl - I just have no idea
> what I need to supply in terms of "Length" here.
>
> Obviously the request is a "POST" and I am not sending a "body" along.
> I tried to send an empty body ('') - but that didn't help either. Is
> this anything you can do about this? I'm not too up to date on HTTP
> spec, but if Content-Length is absolutely required and not set - then
> I guess it's a bug somewhere else.

Your client needs to include this http header in the request:

Content-Length: 0

According to the http spec this header SHOULD be included in every
POST request - not sure what to do if the body is empty. It doesn't
make too much sense that rails on the server side is enforcing the
length requirement in that case in my opinion, but maybe there is a
good reason for this.

If you can't easily make your client library include the header, a
workaround may be to send some whitespace in the body, that would be
ignored by plazes. For example:

tils@tilsbox:~/lunch$ curl -v -u joe:secret -X POST
http://sandbox.plazes.com/sessions.xml -d ' '
* About to connect() to sandbox.plazes.com port 80 (#0)
* Trying 78.46.49.103... connected
* Connected to sandbox.plazes.com (78.46.49.103) port 80 (#0)
* Server auth using Basic with user 'til'
> POST /sessions.xml HTTP/1.1
> Authorization: Basic dGlsOmlnZ3U=
> User-Agent: curl/7.16.4 (i486-pc-linux-gnu) libcurl/7.16.4
> OpenSSL/0.9.8e zlib/1.2.3.3 libidn/1.0
> Host: sandbox.plazes.com
> Accept: */*
> Content-Length: 1
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 200 OK
< Server: nginx/0.5.35
< Date: Mon, 14 Jan 2008 10:30:21 GMT
< Content-Type: application/xml; charset=utf-8
< Connection: keep-alive
< Set-Cookie: _session_id=c157a5e7404fbc7437d0180572ab1168;
domain=.plazes.com; path=/
< Status: 200 OK
< Location:
http://sandbox.plazes.com/sessions/c157a5e7404fbc7437d0180572ab1168
< X-Runtime: 0.00678
< ETag: "7429055448796d66cd6881524b012eba"
< Cache-Control: private
< Content-Length: 168
< Expires: Wed, 25 Sep 1974 02:00:00 GMT
<
<?xml version="1.0" encoding="UTF-8"?>
<session>
<created_at type="datetime">2008-01-14T10:30:21Z</created_at>
<id>c157a5e7404fbc7437d0180572ab1168</id>
</session>


Til

--
http://plazes.com/whereis/til | +49 176 20 19 51 69 | http://tils.net



Mon Jan 14, 2008 10:34 am

tilz3000
Offline Offline
Send Email Send Email

Forward
Message #106 of 236 |
Expand Messages Author Sort by Date

Hi Til (et all), my request is versus https://sandbox.plazes.com/sessions.xml This is what I get in response: <html> <head><title>411 Length...
Till
till1982
Offline Send Email
Jan 13, 2008
2:25 pm

... Your client needs to include this http header in the request: Content-Length: 0 According to the http spec this header SHOULD be included in every POST...
Tilmann Singer
tilz3000
Offline Send Email
Jan 14, 2008
10:34 am

... Yeah, if it's spec - no problem. I got it working with Content-Length 0 already. Got a link handy from the spec? Thanks, Till...
till
till1982
Offline Send Email
Jan 14, 2008
10:36 am

... http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13 "Applications SHOULD use this field to indicate the transfer-length of the message-body,...
Tilmann Singer
tilz3000
Offline Send Email
Jan 14, 2008
10:40 am

... Thanks....
till
till1982
Offline Send Email
Jan 14, 2008
10:58 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help