Hi,
I try to write a client to www.jamendo.com with Zinc. Jamendo has a REST API to request the music catalog. It's a fun workshop to discover Zinc :-) If I use the url " ZnClient get: 'http://api.jamendo.com/get2/name+url/album/xml" in my browser, I get the list of the last entries. But, if I do the same with Zinc, I get an error. ZnClient get: 'http://api.jamendo.com/get2/name+url/album/xml' The error is: "MessageNotUnderstood: Array>>peekFor:" I think that the problem can be the URL rewriting. Maybe Zinc can't follow the link ? Thanks for your help. Olivier ;-) www.auverlot.fr |
On 20.09.2011 12:32, Olivier Auverlot wrote:
> Hi, > > I try to write a client to www.jamendo.com with Zinc. Jamendo has a > REST API to request the music catalog. It's a fun workshop to discover > Zinc :-) > > If I use the url " ZnClient get: > 'http://api.jamendo.com/get2/name+url/album/xml" in my browser, I get > the list of the last entries. But, if I do the same with Zinc, I get > an error. > > ZnClient get: 'http://api.jamendo.com/get2/name+url/album/xml' > > The error is: "MessageNotUnderstood: Array>>peekFor:" > > I think that the problem can be the URL rewriting. Maybe Zinc can't > follow the link ? > > Thanks for your help. > > Olivier ;-) > www.auverlot.fr the same value) Zn then fails since ZnHeaders >> contentLength expects there to be only one. Cheers, Henry. P.S. The response code was 302, is redirection handled at a different API level, or is #get: missing it? |
In reply to this post by Olivier Auverlot
Olivier,
On 20 Sep 2011, at 12:32, Olivier Auverlot wrote: > Hi, > > I try to write a client to www.jamendo.com with Zinc. Jamendo has a REST API to request the music catalog. It's a fun workshop to discover Zinc :-) > > If I use the url " ZnClient get: 'http://api.jamendo.com/get2/name+url/album/xml" in my browser, I get the list of the last entries. But, if I do the same with Zinc, I get an error. > > ZnClient get: 'http://api.jamendo.com/get2/name+url/album/xml' > > The error is: "MessageNotUnderstood: Array>>peekFor:" > > I think that the problem can be the URL rewriting. Maybe Zinc can't follow the link ? > > Thanks for your help. > > Olivier ;-) > www.auverlot.fr Yes, REST API's are nice to play with and Zn should definitively be able to work with any of them. The strange thing is that this server returns headers that don't look right to me: Content-Length: 449, 449 or Content-Length: 0, 0 I have never seen this before, but I will have to check the standard documents before I known what to do. I will let you know. Regards, Sven PS: In the lastest Zn version, all Zn clients should be able to follow redirects. (ZnClient is being replaced by ZnNeoClient, the class side of ZnClient is now deprecated and move to ZnEasy). |
On 20.09.2011 13:01, Sven Van Caekenberghe wrote:
> Olivier, > > On 20 Sep 2011, at 12:32, Olivier Auverlot wrote: > >> Hi, >> >> I try to write a client to www.jamendo.com with Zinc. Jamendo has a REST API to request the music catalog. It's a fun workshop to discover Zinc :-) >> >> If I use the url " ZnClient get: 'http://api.jamendo.com/get2/name+url/album/xml" in my browser, I get the list of the last entries. But, if I do the same with Zinc, I get an error. >> >> ZnClient get: 'http://api.jamendo.com/get2/name+url/album/xml' >> >> The error is: "MessageNotUnderstood: Array>>peekFor:" >> >> I think that the problem can be the URL rewriting. Maybe Zinc can't follow the link ? >> >> Thanks for your help. >> >> Olivier ;-) >> www.auverlot.fr > Yes, REST API's are nice to play with and Zn should definitively be able to work with any of them. > > The strange thing is that this server returns headers that don't look right to me: > > Content-Length: 449, 449 > > or > > Content-Length: 0, 0 > > I have never seen this before, but I will have to check the standard documents before I known what to do. > > I will let you know. > "Multiple message-header fields with the same field-name MAY be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)]. " Content-Length = "Content-Length" ":" 1*DIGIT So technically, they're doing something illegal :) Cheers, Henry |
In reply to this post by Henrik Sperre Johansen
Hendrik,
On 20 Sep 2011, at 12:56, Henrik Sperre Johansen wrote: > The response contains duplicate Content-Length header fields. (both with the same value) > Zn then fails since ZnHeaders >> contentLength expects there to be only one. Yes, there are indeed double headers, Safari reports them as 449, 449 while Zn turns them in an array #(449 449). As I said, I have to check the RFCs. > P.S. The response code was 302, is redirection handled at a different API level, or is #get: missing it? In the past only ZnUserAgent and its subclass ZnHttpClient followed redirects. In the future, there will only be one client, currently named, ZnNeoClient, that does follow redirects. Sven |
In reply to this post by Henrik Sperre Johansen
On 20 Sep 2011, at 13:17, Henrik Sperre Johansen wrote: > http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4 > "Multiple message-header fields with the same field-name MAY be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)]. " > Content-Length = "Content-Length" ":" 1*DIGIT > > So technically, they're doing something illegal :) Apparently, this has been an issue before: http://greenbytes.de/tech/httpbis/issue-95.xhtml http://trac.tools.ietf.org/wg/httpbis/trac/ticket/95 It would not be too hard to implement this compromise: Both Chrome and Mozilla seem to have settled on allowing multiple C-Ls if they're dups. Sven |
On 20 Sep 2011, at 13:38, Sven Van Caekenberghe wrote: > It would not be too hard to implement this compromise: > Both Chrome and Mozilla seem to have settled on allowing multiple C-Ls if they're dups. ZnEasy get: 'http://api.jamendo.com/get2/name+url/album/xml' or ZnNeoClient new get: 'http://api.jamendo.com/get2/name+url/album/xml' should now work as expected. Name: Zinc-HTTP-SvenVanCaekenberghe.205 Author: SvenVanCaekenberghe Time: 20 September 2011, 1:58:59 pm UUID: 135d43af-b715-45d4-bd28-85323f49999d Ancestors: Zinc-HTTP-SvenVanCaekenberghe.204 modified ZnHeaders>>#contentLength to allow for the special case when there are multiple content-length headers, but only when they are identical; fixed some typos in ZnHTTPSocketFacade where some arguments where ignored (thx Olivier Auverlot for reporting this) |
Hi Swen,
Thank you for your patch. Now, Zinc works perfectly to make request on jamendo.com. I'm going to fill my iPod ;-) Olivier www.auverlot.fr > On 20 Sep 2011, at 13:38, Sven Van Caekenberghe wrote: > >> It would not be too hard to implement this compromise: >> Both Chrome and Mozilla seem to have settled on allowing multiple C-Ls if they're dups. > ZnEasy get: 'http://api.jamendo.com/get2/name+url/album/xml' > > or > > ZnNeoClient new get: 'http://api.jamendo.com/get2/name+url/album/xml' > > should now work as expected. > > > Name: Zinc-HTTP-SvenVanCaekenberghe.205 > Author: SvenVanCaekenberghe > Time: 20 September 2011, 1:58:59 pm > UUID: 135d43af-b715-45d4-bd28-85323f49999d > Ancestors: Zinc-HTTP-SvenVanCaekenberghe.204 > > modified ZnHeaders>>#contentLength to allow for the special case when there are multiple content-length headers, but only when they are identical; > fixed some typos in ZnHTTPSocketFacade where some arguments where ignored (thx Olivier Auverlot for reporting this) > |
Free forum by Nabble | Edit this page |