[Pharo-project] Zinc problems found
Hi, I found some problems on Zinc implementation. Take this example: HTTPSocket httpGetDocument: 'http://127.0.0.1:333/analytics/feeds/accounts/default' args: (Dictionary new at: 'prettyprint' put: #('true'); yourself) accept: '*/*' request: ('Authorization: GoogleLogin Auth={1}{2}' format: {self authenticationKey. String crlf} this, if I have the correct authentication key, gives me the correct answer (an atom-xml response). Now, if I try: ZnHTTPSocketFacade httpGetDocument: 'http://127.0.0.1:333/analytics/feeds/accounts/default' args: (Dictionary new at: 'prettyprint' put: #('true'); yourself) accept: '*/*' request: ('Authorization: GoogleLogin Auth={1}{2}' format: {self authenticationKey. String crlf} (this should work, as the facade is for compatibility, I think) I have two errors, one of them easily solvable, and the other... well... I couldn't solve it in the 15' I spent on it :) 1) arguments are not in the correct way. While HTTPSocket functions expect something like this: Dictionary new at: 'prettyprint' put: #('true'); "<-- Parameter is an array" yourself. ZnHTTPSocketFacade expects something like this: Dictionary new at: 'prettyprint' put: 'true'; "<-- Parameter is a string" yourself. 2) This is the hard one. If you do the get request with parameter fixed, you should get the atom feed. But you don't. You get a ZnResponse who is OK (status 200), but entity is empty. I followed the error until this method: canReadContent ^ self hasContentLength or: [ self isChunked or: [ self allowsReadingUpToEnd ] ] who return false, because none of the questions is true. Then, no entity is filled, and I have no answer :( Hope this help :) Cheers, Esteban
Hello Esteban, On 29 Apr 2011, at 00:26, Esteban Lorenzano wrote: Thanks for reporting these issues, I'll have a look at them, but during the day I am out of the office and have meetings, so it won't be until the evening that I have some time, maybe only tomorrow. I remember having thought about the first issue, I just don't remember why I did it that way, I'll have to check a bit. The second issue them, can you send a print string of the headers in that response ? Maybe there just is no body ? Is there a way for me to try that request ? Sven
Hi, I found some problems on Zinc implementation.
Take this example:
HTTPSocket httpGetDocument: 'http://127.0.0.1:333/analytics/feeds/accounts/default' args: (Dictionary new at: 'prettyprint' put: #('true'); yourself) accept: '*/*' request: ('Authorization: GoogleLogin Auth={1}{2}' format: {self authenticationKey. String crlf}
this, if I have the correct authentication key, gives me the correct answer (an atom-xml response).
Now, if I try:
ZnHTTPSocketFacade httpGetDocument: 'http://127.0.0.1:333/analytics/feeds/accounts/default' args: (Dictionary new at: 'prettyprint' put: #('true'); yourself) accept: '*/*' request: ('Authorization: GoogleLogin Auth={1}{2}' format: {self authenticationKey. String crlf}
(this should work, as the facade is for compatibility, I think)
I have two errors, one of them easily solvable, and the other... well... I couldn't solve it in the 15' I spent on it :)
1) arguments are not in the correct way. While HTTPSocket functions expect something like this:
Dictionary new at: 'prettyprint' put: #('true'); "<-- Parameter is an array" yourself.
ZnHTTPSocketFacade expects something like this:
Dictionary new at: 'prettyprint' put: 'true'; "<-- Parameter is a string" yourself.
2) This is the hard one. If you do the get request with parameter fixed, you should get the atom feed. But you don't. You get a ZnResponse who is OK (status 200), but entity is empty. I followed the error until this method:
canReadContent ^ self hasContentLength or: [ self isChunked or: [ self allowsReadingUpToEnd ] ]
who return false, because none of the questions is true. Then, no entity is filled, and I have no answer :(
Hope this help :)
Cheers, Esteban
Hi Sven, no, it has to have a body (if I use HTTPSocket, I get a correct answer) here is a script that can show you the problem: | response auth | response := ZnClient post: 'http://127.0.0.1:333/accounts/ClientLogin' data: (ZnApplicationFormUrlEncodedEntity withAll: (Dictionary new at: 'Email' put: 'YOUR GOOGLE ACCOUNT'; at: 'Passwd' put: 'YOUR SECRET PASSWORD'; at: 'service' put: 'analytics'; yourself)). auth := Dictionary new. (response entity contents subStrings: Character lf asString) do: [ :each | (each subStrings: '=') in: [ :array | auth at: array first put: array second ] ]. ZnHTTPSocketFacade httpGetDocument: 'http://127.0.0.1:333/analytics/feeds/accounts/default' args: nil accept: '*/*' request: ('Authorization: GoogleLogin Auth={1}{2}' format: {auth at: 'Auth'. String crlf}). (if you replace ZnHTTPSocketFacade with HTTPSocket, you get a correct answer, if you have a google analytics account) btw... 127.0.0.1:333 is a stunnel who redirects to https://google.com Cheers, Esteban El 29/04/2011, a las 2:32a.m., Sven Van Caekenberghe escribió:
Hello Esteban,
On 29 Apr 2011, at 00:26, Esteban Lorenzano wrote:
Thanks for reporting these issues, I'll have a look at them, but during the day I am out of the office and have meetings, so it won't be until the evening that I have some time, maybe only tomorrow.
I remember having thought about the first issue, I just don't remember why I did it that way, I'll have to check a bit.
The second issue them, can you send a print string of the headers in that response ? Maybe there just is no body ? Is there a way for me to try that request ?
Sven
Hi, I found some problems on Zinc implementation.
Take this example:
HTTPSocket httpGetDocument: 'http://127.0.0.1:333/analytics/feeds/accounts/default' args: (Dictionary new at: 'prettyprint' put: #('true'); yourself) accept: '*/*' request: ('Authorization: GoogleLogin Auth={1}{2}' format: {self authenticationKey. String crlf}
this, if I have the correct authentication key, gives me the correct answer (an atom-xml response).
Now, if I try:
ZnHTTPSocketFacade httpGetDocument: 'http://127.0.0.1:333/analytics/feeds/accounts/default' args: (Dictionary new at: 'prettyprint' put: #('true'); yourself) accept: '*/*' request: ('Authorization: GoogleLogin Auth={1}{2}' format: {self authenticationKey. String crlf}
(this should work, as the facade is for compatibility, I think)
I have two errors, one of them easily solvable, and the other... well... I couldn't solve it in the 15' I spent on it :)
1) arguments are not in the correct way. While HTTPSocket functions expect something like this:
Dictionary new at: 'prettyprint' put: #('true'); "<-- Parameter is an array" yourself.
ZnHTTPSocketFacade expects something like this:
Dictionary new at: 'prettyprint' put: 'true'; "<-- Parameter is a string" yourself.
2) This is the hard one. If you do the get request with parameter fixed, you should get the atom feed. But you don't. You get a ZnResponse who is OK (status 200), but entity is empty. I followed the error until this method:
canReadContent ^ self hasContentLength or: [ self isChunked or: [ self allowsReadingUpToEnd ] ]
who return false, because none of the questions is true. Then, no entity is filled, and I have no answer :(
Hope this help :)
Cheers, Esteban
On 29 Apr 2011, at 07:32, Sven Van Caekenberghe wrote:
I remember having thought about the first issue, I just don't remember why I did it that way, I'll have to check a bit.
The first issue should be fixed now: Name: Zinc-HTTP-SvenVanCaekenberghe.149 Author: SvenVanCaekenberghe Time: 30 April 2011, 8:55:03 pm UUID: 3a49e678-fa7b-4c30-bdc6-0944c7637e7f Ancestors: Zinc-HTTP-SvenVanCaekenberghe.148 rewrote ZnHTTPSocketFacade class>>#entendURL:withArguments: to be compatible with HTTPSocket class>>#argString: (Thanks Esteban Lorenzano)
The second issue them, can you send a print string of the headers in that response ? Maybe there just is no body ? Is there a way for me to try that request ?
This is a deeper issue (I described it in a reply to a message 'Strange results from Zinc for the www.delicious.com domain'). I am working on it. Sven
participants (2)
-
Esteban Lorenzano -
Sven Van Caekenberghe