an error in ZnResourceMetaUtils>>queryKeyValueSafeSet ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

an error in ZnResourceMetaUtils>>queryKeyValueSafeSet ?

EstebanLM
Hi all, Sven

I’m doing some experiments with twitter and posting and I found that twitter does not accept a post with $? in the status string (it throws an error). Now, if I change ZnResourceMetaUtils>>queryKeyValueSafeSet removing $? from the safe set it works correctly.

the question is: this is a twitter error or a ZnResourceMetaUtils>>queryKeyValueSafeSet error and the $? shouldn’t be considered safe (and then it should be percent encoded?)

cheers,
Esteban
Reply | Threaded
Open this post in threaded view
|

Re: an error in ZnResourceMetaUtils>>queryKeyValueSafeSet ?

Sven Van Caekenberghe-2
Hi Esteban,

> On 28 Dec 2017, at 11:54, Esteban Lorenzano <[hidden email]> wrote:
>
> Hi all, Sven
>
> I’m doing some experiments with twitter and posting and I found that twitter does not accept a post with $? in the status string (it throws an error). Now, if I change ZnResourceMetaUtils>>queryKeyValueSafeSet removing $? from the safe set it works correctly.
>
> the question is: this is a twitter error or a ZnResourceMetaUtils>>queryKeyValueSafeSet error and the $? shouldn’t be considered safe (and then it should be percent encoded?)
>
> cheers,
> Esteban

I know that the last time I did the implementation, we looked very carefully in what characters are safe or not, and had some discussions about it.

I am not familiar with the API you are trying to use. I am a bit confused by POST and 'status string', while encoding a query part of the URL. It is possible to show exactly the call that you are trying to make ? What does an equivalent curl -v call show ? Could you point to the actual API call documentation ?

Sven


Reply | Threaded
Open this post in threaded view
|

Re: an error in ZnResourceMetaUtils>>queryKeyValueSafeSet ?

EstebanLM
Hi Sven,

A POST with this form will fail on twitter api:

POST /1.1/statuses/update.json HTTP/1.1
Host: api.twitter.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 0
User-Agent: Zinc HTTP Components 1.0 (Pharo/7.0)

status=testing?

It will fail because of the “?”, if I remove ? from save and I encode as this:

POST /1.1/statuses/update.json HTTP/1.1
Host: api.twitter.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 0
User-Agent: Zinc HTTP Components 1.0 (Pharo/7.0)

status=testing%3F

it will be posted correctly.

My doubt if this is a bug in queryKeyValueSafeSet or this is a particular problem on twitter. If the last, I didn’t see a good way to change value of safe set for just one case (for now I just override the method, but this is clearly not good ;) ).

cheers!
Esteban


> On 28 Dec 2017, at 13:00, Sven Van Caekenberghe <[hidden email]> wrote:
>
> Hi Esteban,
>
>> On 28 Dec 2017, at 11:54, Esteban Lorenzano <[hidden email]> wrote:
>>
>> Hi all, Sven
>>
>> I’m doing some experiments with twitter and posting and I found that twitter does not accept a post with $? in the status string (it throws an error). Now, if I change ZnResourceMetaUtils>>queryKeyValueSafeSet removing $? from the safe set it works correctly.
>>
>> the question is: this is a twitter error or a ZnResourceMetaUtils>>queryKeyValueSafeSet error and the $? shouldn’t be considered safe (and then it should be percent encoded?)
>>
>> cheers,
>> Esteban
>
> I know that the last time I did the implementation, we looked very carefully in what characters are safe or not, and had some discussions about it.
>
> I am not familiar with the API you are trying to use. I am a bit confused by POST and 'status string', while encoding a query part of the URL. It is possible to show exactly the call that you are trying to make ? What does an equivalent curl -v call show ? Could you point to the actual API call documentation ?
>
> Sven
>
>


Reply | Threaded
Open this post in threaded view
|

Re: an error in ZnResourceMetaUtils>>queryKeyValueSafeSet ?

EstebanLM
now I found that also $@ and $! are problematic for twitter api.
so… I’m guessing is a problem of twitter more than a generic error (this would have been spotted before, if is a bug).
I need to dig to see if I can explicit an encoding in some way instead hacking over #queryKeyValueSafeSet (but that will be hard to do today ;) )

Esteban

> On 29 Dec 2017, at 10:17, Esteban Lorenzano <[hidden email]> wrote:
>
> Hi Sven,
>
> A POST with this form will fail on twitter api:
>
> POST /1.1/statuses/update.json HTTP/1.1
> Host: api.twitter.com
> Content-Type: application/x-www-form-urlencoded
> Accept: */*
> Content-Length: 0
> User-Agent: Zinc HTTP Components 1.0 (Pharo/7.0)
>
> status=testing?
>
> It will fail because of the “?”, if I remove ? from save and I encode as this:
>
> POST /1.1/statuses/update.json HTTP/1.1
> Host: api.twitter.com
> Content-Type: application/x-www-form-urlencoded
> Accept: */*
> Content-Length: 0
> User-Agent: Zinc HTTP Components 1.0 (Pharo/7.0)
>
> status=testing%3F
>
> it will be posted correctly.
>
> My doubt if this is a bug in queryKeyValueSafeSet or this is a particular problem on twitter. If the last, I didn’t see a good way to change value of safe set for just one case (for now I just override the method, but this is clearly not good ;) ).
>
> cheers!
> Esteban
>
>
>> On 28 Dec 2017, at 13:00, Sven Van Caekenberghe <[hidden email]> wrote:
>>
>> Hi Esteban,
>>
>>> On 28 Dec 2017, at 11:54, Esteban Lorenzano <[hidden email]> wrote:
>>>
>>> Hi all, Sven
>>>
>>> I’m doing some experiments with twitter and posting and I found that twitter does not accept a post with $? in the status string (it throws an error). Now, if I change ZnResourceMetaUtils>>queryKeyValueSafeSet removing $? from the safe set it works correctly.
>>>
>>> the question is: this is a twitter error or a ZnResourceMetaUtils>>queryKeyValueSafeSet error and the $? shouldn’t be considered safe (and then it should be percent encoded?)
>>>
>>> cheers,
>>> Esteban
>>
>> I know that the last time I did the implementation, we looked very carefully in what characters are safe or not, and had some discussions about it.
>>
>> I am not familiar with the API you are trying to use. I am a bit confused by POST and 'status string', while encoding a query part of the URL. It is possible to show exactly the call that you are trying to make ? What does an equivalent curl -v call show ? Could you point to the actual API call documentation ?
>>
>> Sven
>>
>>
>