[AWS] AWS.Client HTTPS connections

BenjaminC.Place BenjaminC.Place
Sun, 23 Nov 2003 15:24:04 -0500


On Sunday, November 23, 2003, at 02:37  PM, Pascal Obry wrote:

> You must surely call AWS.Net.SSL.Initialize providing a certificate 
> too.
> You can use the one "demos/cert.pem" for example.

That did the trick. Thanks, Pascal!

It's hard to wade through all the AWS.Server docs when you haven't 
built one and are just familiar with AWS.Client. Also, the AWS.Client 
docs make no mention of AWS.Net.SSL. I'm going to write up an addition 
to the AWS.Client document page with sample code for making an HTTPS 
connection.

Some new questions:

- Can I freely use/redistribute "demos/cert.pem"?

- Building a webclient using AWS, I want to set the User-Agent string. 
Is there any way to do that?

The following snippet has all my relevant HTTPS code. It's really very 
simple. Do you see any problems?

------------------------------------------------------
	with Ada.Text_IO;    use Ada.Text_IO;

	with AWS.Client;
	with AWS.Response;
	with AWS.Net.SSL;

	procedure HTTPS_Test is
	      Resp : AWS.Response.Data;
	begin
	      AWS.Net.SSL.Initialize ("aws-1.4/demos/cert.pem");

	      Resp := AWS.Client.Get ("https://secure_site.com");

	      Put_Line (AWS.Response.Message_Body (Resp));
	end HTTPS_Test;
------------------------------------------------------

Thanks a lot!
Ben