[Glass] Alternatives for HTTPS client

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

[Glass] Alternatives for HTTPS client

Mariano Martinez Peck
Hi guys. I need a HTTPS client to do a post. Actually, my app need to connect to many "financial institutions" though a protocol. I have a collection of financial institutions (stored in my database) and each of them provides the URL I need to connect and do the post. Some are HTTPS some are HTTP. 

In Pharo, I use Zodiac. The nice thing is that by using ZnClient I can either connect to HTTP and HTTPS. I do this:

| client |
client := ZnClient new.
client
systemPolicy;
accept: 'application/xxx' asZnMimeType ;
https;
contents: stream contents;
logToTranscript;
url: aStringURL;
post.
What are the workarounds I could do in GemStone?

Thanks in advance,


--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] Alternatives for HTTPS client

Dale Henrichs-3
Mariano,

One of the motivations for porting Zinc is to get to the point where we can port Zodiac as well, but we are not quite there yet .. It turns that Sean Allen wrote a post about https clients and GLASS (GsWebEdition?)[1] ... then you can use the Zinc client code to do https connects ... I do believe that the Zinc client code is pretty solid, but Johan should let us know the details ...

Dale

[1] http://www.monkeysnatchbanana.com/posts/2010/06/22/faking-a-https-client-for-glass.html


From: "Mariano Martinez Peck" <[hidden email]>
To: [hidden email]
Sent: Friday, November 15, 2013 7:28:39 AM
Subject: [Glass] Alternatives for HTTPS client

Hi guys. I need a HTTPS client to do a post. Actually, my app need to connect to many "financial institutions" though a protocol. I have a collection of financial institutions (stored in my database) and each of them provides the URL I need to connect and do the post. Some are HTTPS some are HTTP. 

In Pharo, I use Zodiac. The nice thing is that by using ZnClient I can either connect to HTTP and HTTPS. I do this:

| client |
client := ZnClient new.
client
systemPolicy;
accept: 'application/xxx' asZnMimeType ;
https;
contents: stream contents;
logToTranscript;
url: aStringURL;
post.
What are the workarounds I could do in GemStone?

Thanks in advance,


--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] Alternatives for HTTPS client

Mariano Martinez Peck



On Fri, Nov 15, 2013 at 2:33 PM, Dale K. Henrichs <[hidden email]> wrote:
Mariano,

One of the motivations for porting Zinc is to get to the point where we can port Zodiac as well, but we are not quite there yet .. It turns that Sean Allen wrote a post about https clients and GLASS (GsWebEdition?

YESSSSS GsWebEdition!!!! :)
 
)[1] ... then you can use the Zinc client code to do https connects ... I do believe that the Zinc client code is pretty solid, but Johan should let us know the details ...


Hi Dale. 

Yes, I knew the alternative of using a proxy (wether the webserver or tunneling). But, for my usage, it is a pain. Why?  These Financial Institutions are domain objects. They could be added by the user. The URL are provided by the user. And then they can connect. So with this approach what I would need to do is:

1) For each add of those objects, I would need to automatically append an entry in the configuration file of the webserver or tunneling. 
2) Add an entry in hosts
3) Define a pattern to convert from the originalURL to the proxy one
4) Depend on tunneling or have to use an external webserver even for development...
5) Have a completely separate logic than pharo.

But yes, I agree, we don't have much other choices. Thanks for your suggestion. 

I was thinking something similar to what John suggest. Let me reply below his answer. 


 
Dale

[1] http://www.monkeysnatchbanana.com/posts/2010/06/22/faking-a-https-client-for-glass.html


From: "Mariano Martinez Peck" <[hidden email]>
To: [hidden email]
Sent: Friday, November 15, 2013 7:28:39 AM
Subject: [Glass] Alternatives for HTTPS client


Hi guys. I need a HTTPS client to do a post. Actually, my app need to connect to many "financial institutions" though a protocol. I have a collection of financial institutions (stored in my database) and each of them provides the URL I need to connect and do the post. Some are HTTPS some are HTTP. 

In Pharo, I use Zodiac. The nice thing is that by using ZnClient I can either connect to HTTP and HTTPS. I do this:

| client |
client := ZnClient new.
client
systemPolicy;
accept: 'application/xxx' asZnMimeType ;
https;
contents: stream contents;
logToTranscript;
url: aStringURL;
post.
What are the workarounds I could do in GemStone?

Thanks in advance,


--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass




--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] Alternatives for HTTPS client

Mariano Martinez Peck
In reply to this post by Mariano Martinez Peck



On Fri, Nov 15, 2013 at 3:05 PM, John M McIntosh <[hidden email]> wrote:
You can do proxy rewrite redirection from your local http server to the https server. Thus http://localhost:8776/service/...  Becomes https://www.apple.com/service...  So https from server to https host and http from server to zinc


Hi John, thanks for your suggestion, I was thinking something similar. 
Can I do this with proxy rewrite redirection??  :


And that is redirected to:


Could that be done with rewrite/redirection rules?
Basically, it would be "does url begins with http://localhost:8776/specialService"  if true, then it should be https://  ,  the last part of the original url :)

Probably I could experiment a bit (I have a server running in nginx)..

Thanks!


 

Sent from my iPhone

On Nov 15, 2013, at 10:28 AM, Mariano Martinez Peck <[hidden email]> wrote:

Hi guys. I need a HTTPS client to do a post. Actually, my app need to connect to many "financial institutions" though a protocol. I have a collection of financial institutions (stored in my database) and each of them provides the URL I need to connect and do the post. Some are HTTPS some are HTTP. 

In Pharo, I use Zodiac. The nice thing is that by using ZnClient I can either connect to HTTP and HTTPS. I do this:

| client |
client := ZnClient new.
client
systemPolicy;
accept: 'application/xxx' asZnMimeType ;
https;
contents: stream contents;
logToTranscript;
url: aStringURL;
post.
What are the workarounds I could do in GemStone?

Thanks in advance,


--
Mariano
http://marianopeck.wordpress.com
_______________________________________________



--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] Alternatives for HTTPS client

Johan Brichau-3
Mariano,

For nginx, this is how we do the tunneling:

server
{
  listen 8181;
  server_name localhost;

  access_log  /var/log/nginx/tunnel.log;  

  location /
  {
    proxy_pass https://secret.server.somewhere;
  }
}



On 15 Nov 2013, at 19:19, Mariano Martinez Peck <[hidden email]> wrote:

> Probably I could experiment a bit (I have a server running in nginx)..

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] Alternatives for HTTPS client

Göran Krampe
Hi!

And also, you can use stud from Bumptech instead of nginx etc, if you
want a scalable tool that does one thing only - SSL wrapping.

regards, Göran

PS. We use stud now for all SSL server stuff in Terf at 3dicc.com.
SqueakSSL does not scale so its use on the server side is... not advisable.
_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] Alternatives for HTTPS client

Mariano Martinez Peck
Hi Goran,

Thanks for the alternative. Do you know if it is possible to configure the SSL wrapping in a way in which the HTTPS url comes as an argument in the original URL?


And that is redirected to:


Could that be done with rewrite/redirection rules?
Basically, it would be "does url begins with http://localhost:8776/specialService"  if true, then it should be https://  ,  the last part of the original url :)

Thanks!
  


On Sat, Nov 16, 2013 at 7:31 PM, Göran Krampe <[hidden email]> wrote:
Hi!

And also, you can use stud from Bumptech instead of nginx etc, if you want a scalable tool that does one thing only - SSL wrapping.

regards, Göran

PS. We use stud now for all SSL server stuff in Terf at 3dicc.com. SqueakSSL does not scale so its use on the server side is... not advisable.

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass



--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] Alternatives for HTTPS client

Mariano Martinez Peck
In reply to this post by Mariano Martinez Peck



On Sat, Nov 16, 2013 at 8:32 PM, Mariano Martinez Peck <[hidden email]> wrote:



On Fri, Nov 15, 2013 at 8:36 PM, John McIntosh <[hidden email]> wrote:
Let me give an example of where we talk to Apple's App Store Receipt Validation server.
That takes a Json stream built from a Dictionary and returns a Json stream we decompose into a Dictionary and validate. 

We refer to the host as  http://localhost:8889/verifyReceipt'.
but the proxy-remapping by apache changes that to 


For apache we have 

<VirtualHost *:8889>
  ProxyRequests On
  ProxyPassReverse / https://buy.itunes.apple.com/

Cool. Thanks John for the example, Very useful.
The only thing I would need is to automatically get this URL from the original URL. Otherwise, I would need to add an entry to the conf file for each financial institution...and that's  a pain...

Thanks!!

 
  SSLProxyEngine on
</VirtualHost>

The gemstone code is:

client := ZnClient new
    url: url;
    enforceHttpSuccess: true;
    accept: ZnMimeType applicationJson;
    contentWriter: [ :object | 
       ZnEntity 
            with: (String streamContents: [ :stream |
                        JSStream encodeDictionary:  object on:  stream  ])
           type: ZnMimeType applicationJson ];
    contentReader: [ :entity |
JSJsonParser parse: entity bytes asString];
    yourself.

d := Dictionary new.
d at: 'receipt-data' put: purchaseData receiptData.
d at: 'password' put: 'xxxxxxxxxxx'.

client contents: d.
results := client post.
purchaseData validationData: results.
^self checkValidationData: purchaseData

On Nov 15, 2013, at 1:19 PM, Mariano Martinez Peck <[hidden email]> wrote:




On Fri, Nov 15, 2013 at 3:05 PM, John M McIntosh <[hidden email]> wrote:
You can do proxy rewrite redirection from your local http server to the https server. Thus http://localhost:8776/service/...  Becomes https://www.apple.com/service...  So https from server to https host and http from server to zinc


Hi John, thanks for your suggestion, I was thinking something similar. 
Can I do this with proxy rewrite redirection??  :


And that is redirected to:


Could that be done with rewrite/redirection rules?
Basically, it would be "does url begins with http://localhost:8776/specialService"  if true, then it should be https://  ,  the last part of the original url :)

Probably I could experiment a bit (I have a server running in nginx)..

Thanks!


 

Sent from my iPhone

On Nov 15, 2013, at 10:28 AM, Mariano Martinez Peck <[hidden email]> wrote:

Hi guys. I need a HTTPS client to do a post. Actually, my app need to connect to many "financial institutions" though a protocol. I have a collection of financial institutions (stored in my database) and each of them provides the URL I need to connect and do the post. Some are HTTPS some are HTTP. 

In Pharo, I use Zodiac. The nice thing is that by using ZnClient I can either connect to HTTP and HTTPS. I do this:

| client |
client := ZnClient new.
client
systemPolicy;
accept: 'application/xxx' asZnMimeType ;
https;
contents: stream contents;
logToTranscript;
url: aStringURL;
post.
What are the workarounds I could do in GemStone?

Thanks in advance,


--
Mariano
http://marianopeck.wordpress.com
_______________________________________________



--
Mariano
http://marianopeck.wordpress.com



--
Mariano
http://marianopeck.wordpress.com



--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass