Are you able to get the contents of 

ZnEasy get: 'https://www.google.com'  


?  



If so then is not an SSL issue.  If not you'll need to use charles proxy
(http://www.charlesproxy.com/) or an equivalent to see the decoded https
requests.  Wireshark only has encrypted packets.


Are you doing the #resetEntity prior to setting the url or other parameters
when doing your POST?




Tim Mackinnon wrote
> Actually looking at this a bit more - #resetEntity does do what you
> suggest (my mistake) - but I still have some problem, possibly related to
> https? Not sure whats going on as it looks like the post call is sending
> out what I think it should - but somehow the receiving server is not happy
> and is redirecting to “/“?
> 
> Not really sure how to debug that - guess I might have to learn how to use
> wireshark.
> 
> Tim
> 
> On 25 Jun 2014, at 08:55, Tim Mackinnon <

> tamackinnon@

> > wrote:
> 
>> Hi Paul - thanks for your suggestions, #resetEntity doesn't seem to clear
>> the parameters or have any effect (which I think makes sense given the
>> name?).
>> 
>> The get portion and decoding parameters is all working perfectly, it's
>> the post that has me confused.
>> 
>> If I inspect the request - it seems to be issuing to "/" - so it's like
>> the URL: is not being honoured (and the response I get back is the
>> contents of the / webpage).
>> 
>> I think I'm confused about the interaction of URL:, and setting request
>> and form params. From the docs, it wasn't obvious to me that ordering is
>> important - but it seems that it is (I was expecting #post or #get to
>> assemble everything when invoked - but I'm not sure it works like that).
>> 
>> I guess I will have to debug through the code.
>> 
>> Tim
>> 
>> Sent from my iPhone
>> 
>> On 25 Jun 2014, at 05:12, "Paul DeBruicker [via Smalltalk]" <

> [email protected]

> > wrote:
>> 
>>> Do your query parameters from the initial GET get cleared from the
>>> request before the POST? If you're not sure send the client
>>> #resetEntity. 
>>> 
>>> 
>>> Is the response of the GET correct & are the keys decoded properly? if
>>> not can you get a valid signature and request key from somewhere else
>>> (e.g. web ui, or ....) to test the POST? 
>>> 
>>> 
>>> Is it important to reuse the connection?  IF not add the #beOneShot
>>> method to both and see if that helps as it does some resetting.   
>>> 
>>> The #post method is a convenience method that conjoins a send to
>>> #method: and #execute.  You could separate them and use #method: at the
>>> top and #execute; before the #request line but I'd be surprised to learn
>>> that fixed things. 
>>> 
>>> 
>>> Good luck 
>>> 
>>> Paul 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Tim Mackinnon wrote
>>> Hi I'm a bit confused about how to send a get request to a resource and
>>> then post a response to it? I seem to fail on the post part, as it seems
>>> that my query is not being well formeed - or something is not being
>>> cleared when I reuse the connection I used in the get.  My code looks as
>>> follows (and I'm sure there is a simple mistake). 
>>> 
>>> It seems that in my post request, it doesn't formulate the post I expect
>>> - it shows a GET / msg, and as such my response doesn't give me the
>>> token I expect.  If I move the "post" line up to the start, I seem to
>>> get a request header I expect, but still not the the result I expect.
>>> Can anyone offer any tips? Do I need to clear my Client in some way
>>> before the second post operation? 
>>> 
>>> Tim 
>>> 
>>> | znc resp | 
>>> 
>>> (znc := ZnClient new) logToTranscript. 
>>> 
>>> resp := znc 
>>>         url: 'https://trello.com/1/authorize';
>>>         queryAt: 'scope' put: 'read'; 
>>>         queryAt: 'expiration' put: '1day'; 
>>>         queryAt: 'name' put: 'Pharo App'; 
>>>         "queryAt: 'response_type' put: 'token';" 
>>>         queryAt: 'key' put: 'xxxxxx1d588819825d57da6dad4dd'; 
>>>         get; 
>>>         request; 
>>>         response. 
>>>         
>>> soup := (Soup fromString:  resp entity). 
>>> sig := soup findTag: [ :e | (e name = 'input') and: [  (e attributeAt:
>>> 'name' ifAbsent: ['']) = 'signature' ]]. 
>>> key := soup findTag: [ :e | (e name = 'input') and: [  (e attributeAt:
>>> 'name' ifAbsent: ['']) = 'requestKey' ]]. 
>>> 
>>> resp := znc 
>>>         url: 'https://trello.com/1/token/approve';
>>>         formAt: 'approve' put: 'Allow'; 
>>>         formAt: 'requestKey' put: (key attributeAt: 'value'); 
>>>         formAt: 'signature' put: (sig attributeAt: 'value'); 
>>>         post; 
>>>         request; 
>>>         response.
>>> 
>>> 
>>> If you reply to this email, your message will be added to the discussion
>>> below:
>>> http://forum.world.st/ZnClient-get-then-post-tp4764605p4764608.html
>>> To unsubscribe from ZnClient get then post?, click here.
>>> NAML





--
View this message in context: 
http://forum.world.st/ZnClient-get-then-post-tp4764605p4764717.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

Reply via email to