[AWS] Custom Headers in AWS.Client

Casey Comendant casey at hyperspire.com
Fri Apr 6 07:06:02 CEST 2012


I believe you will find what you are looking for in AWS.Headers.Set.

For instance, consider the following:

with AWS.Client;
with AWS.Status;
with AWS.Headers.Set;
with AWS.Response;

procedure Default is

   HTTP_GET_Headers   : AWS.Headers.List;
   HTTP_GET_Response : AWS.Response.Data;

begin

   -- Set header data
   AWS.Headers.Set.Add (Headers  => HTTP_GET_Headers,
           Name => "Header_Name1", Value => "Header Value 1");

   AWS.Headers.Set.Add (Headers  => HTTP_GET_Headers,
           Name => "Header_Name2", Value => "Header Value 2");

   AWS.Headers.Set.Add (Headers  => HTTP_GET_Headers,
           Name => "Header_Name3", Value => "Header Value 3");

   -- Etc...

   -- Create client connection
   AWS.Client.Create (Connection => HTTP_Connection,
       Host => "http://example.somewhereovertherainbow.com/");

   -- Get the content
       AWS.Client.Get
           (HTTP_Connection,
            HTTP_GET_Response,
            "http://example.somewhereovertherainbow.com/wherebluebirdsfly/",
            HTTP_Data_Range,
            HTTP_GET_Headers);

   -- Do something with the data
   Ada.Text_IO.Put (AWS.Response.Message_Body (HTTP_GET_Response));

   -- Etc...

end Default;

Somewhat off the top of my head but I think it should point you in the
general direction.

On Fri, Apr 6, 2012 at 6:30 AM, Joseph Montanez <jmontanez at gorilla3d.com> wrote:
> I was looking at the documentation at AWS.Client.Get and I see
> "Headers", however I am not finding a way to populate them, it looks
> like it is a read only header list. Is there a way to alter the
> headers? I also noticed User_Agent is in HTTP_Connection, but that
> seems like the only way I can put custom data in.
>
> --
> Joseph Montanez
> Web Developer
> Gorilla3D
> Design, Develop, Deploy
> _______________________________________________
> AWS mailing list
> AWS at lists.adacore.com
> /no-more-mailman.html



--
-- Casey Comendant, Founder & Executive Director
-- Hyperspire Research Foundation
-- casey at hyperspire.com
-- http://hyperspire.com/
-- gpg --keyserver wwwkeys.pgp.net --recv-key 3969270E


More information about the AWS mailing list