comp.lang.ada
 help / color / mirror / Atom feed
* Simple parse from https website
@ 2020-04-02 13:58 Rego, P.
  2020-04-02 14:24 ` Egil H H
  2020-04-02 14:42 ` Dmitry A. Kazakov
  0 siblings, 2 replies; 17+ messages in thread
From: Rego, P. @ 2020-04-02 13:58 UTC (permalink / raw)


Hi folks, how are you? I hope everyone is safe and healthy.

I am trying to make a simple parser for an https website push, so trying to follow from the example from http://rosettacode.org/wiki/HTTP#Ada, just changing the address from a website.

So I  tried 

    with Ada.Text_IO; use Ada.Text_IO;
    
    with AWS.Client;
    with AWS.Response;
    
    procedure Main_Other is
    begin
       Put_Line (AWS.Response.Message_Body
                 (AWS.Client.Get
                    (URL => "https://google.com")));
    end Main_Other;

But I got an exception
raised PROGRAM_ERROR : aws-client.adb:398 finalize/adjust raised exception
[2020-04-02 10:41:20] process exited with status 1, elapsed time: 00.80s

So, any thoughts on how to fix that? 

I'd like to parse the current status of some tables in a website, similar of making something like that in Python

    import pandas as pd
    def retrieve_json(json_url):
        return pd.read_json(json_url)


Thanks
Pablo.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simple parse from https website
  2020-04-02 13:58 Simple parse from https website Rego, P.
@ 2020-04-02 14:24 ` Egil H H
  2020-04-02 14:44   ` Rego, P.
  2020-04-02 14:42 ` Dmitry A. Kazakov
  1 sibling, 1 reply; 17+ messages in thread
From: Egil H H @ 2020-04-02 14:24 UTC (permalink / raw)


On Thursday, April 2, 2020 at 3:58:12 PM UTC+2, Rego, P. wrote:
> Hi folks, how are you? I hope everyone is safe and healthy.
> 
> I am trying to make a simple parser for an https website push, so trying to follow from the example from http://rosettacode.org/wiki/HTTP#Ada, just changing the address from a website.
> 
> 
> So, any thoughts on how to fix that? 
> 

Wild guess: You have to compile AWS with SSL support

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simple parse from https website
  2020-04-02 13:58 Simple parse from https website Rego, P.
  2020-04-02 14:24 ` Egil H H
@ 2020-04-02 14:42 ` Dmitry A. Kazakov
  2020-04-02 14:48   ` Rego, P.
  1 sibling, 1 reply; 17+ messages in thread
From: Dmitry A. Kazakov @ 2020-04-02 14:42 UTC (permalink / raw)


On 2020-04-02 15:58, Rego, P. wrote:

> I am trying to make a simple parser for an https website push, so trying to follow from the example from http://rosettacode.org/wiki/HTTP#Ada, just changing the address from a website.
> 
> So I  tried
> 
>      with Ada.Text_IO; use Ada.Text_IO;
>      
>      with AWS.Client;
>      with AWS.Response;
>      
>      procedure Main_Other is
>      begin
>         Put_Line (AWS.Response.Message_Body
>                   (AWS.Client.Get
>                      (URL => "https://google.com")));
>      end Main_Other;
> 
> But I got an exception
> raised PROGRAM_ERROR : aws-client.adb:398 finalize/adjust raised exception
> [2020-04-02 10:41:20] process exited with status 1, elapsed time: 00.80s
> 
> So, any thoughts on how to fix that?

This is certainly an induced error. You get some exception which 
propagates on and upon finalization of an AWS object (AWS Client?) 
causes another exception inside its Finalize. I suggest you to report it 
to AdaCore, as this is surely a bug.

As for the original error, like another poster guessed, you seem try to 
establish an insecure connection (HTTP) to a secure server (HTTPS), get 
bounced and then, see above.

You need to configure OpenSSL or GNUTLS for you AWS client before 
connecting. I cannot help with details because I don't use AWS. There 
should be some samples of secure HTTP connection using an AWS client.

> I'd like to parse the current status of some tables in a website, similar of making something like that in Python
> 
>      import pandas as pd
>      def retrieve_json(json_url):
>          return pd.read_json(json_url)

Hmm, google.com content does not look like JSON, far from. Though they 
may have REST API in JSON format, is that you are trying to do?

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simple parse from https website
  2020-04-02 14:24 ` Egil H H
@ 2020-04-02 14:44   ` Rego, P.
  2020-04-03  9:35     ` Björn Lundin
  0 siblings, 1 reply; 17+ messages in thread
From: Rego, P. @ 2020-04-02 14:44 UTC (permalink / raw)


> Wild guess: You have to compile AWS with SSL support

Do you mean to include some project switch to compile it using SSL support? (maybe would you know which switches, please?)

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simple parse from https website
  2020-04-02 14:42 ` Dmitry A. Kazakov
@ 2020-04-02 14:48   ` Rego, P.
  2020-04-02 17:16     ` Dmitry A. Kazakov
  0 siblings, 1 reply; 17+ messages in thread
From: Rego, P. @ 2020-04-02 14:48 UTC (permalink / raw)


> This is certainly an induced error. You get some exception which 
> propagates on and upon finalization of an AWS object (AWS Client?) 
> causes another exception inside its Finalize. I suggest you to report it 
> to AdaCore, as this is surely a bug.
> 
> As for the original error, like another poster guessed, you seem try to 
> establish an insecure connection (HTTP) to a secure server (HTTPS), get 
> bounced and then, see above.
> 
> You need to configure OpenSSL or GNUTLS for you AWS client before 
> connecting. I cannot help with details because I don't use AWS. There 
> should be some samples of secure HTTP connection using an AWS client.

I'd love not to use AWS, but it was the simpler possible solution that I found today (I know I did years ago something like that, but it's lost in a dark place in my mind lol)

> Hmm, google.com content does not look like JSON, far from. Though they 
> may have REST API in JSON format, is that you are trying to do?

Ops...not, just testing more simpler cases. I am trying to get the data from
https://poloniex.com/public?command=returnTicker

Just tried with google to check if it's problem from polo ticker. But the exception was the same.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simple parse from https website
  2020-04-02 14:48   ` Rego, P.
@ 2020-04-02 17:16     ` Dmitry A. Kazakov
  2020-04-02 18:27       ` Rego, P.
  0 siblings, 1 reply; 17+ messages in thread
From: Dmitry A. Kazakov @ 2020-04-02 17:16 UTC (permalink / raw)


On 2020-04-02 16:48, Rego, P. wrote:

> Ops...not, just testing more simpler cases. I am trying to get the data from
> https://poloniex.com/public?command=returnTicker
> 
> Just tried with google to check if it's problem from polo ticker. But the exception was the same.

No, that site looks OK. I modified my OpenSSL HTTP client. I just added 
JSON parser and procedure Dump to print the JSON object:

----------------------------- test_https_openssl_json_client.adb -----
with Ada.Exceptions;               use Ada.Exceptions;
with Ada.Text_IO;                  use Ada.Text_IO;
with Ada.Streams;                  use Ada.Streams;
--with GNAT.Exception_Traces;      use GNAT.Exception_Traces;
with GNAT.Sockets.Server.Handles;  use GNAT.Sockets.Server.Handles;
with GNAT.Sockets.Server.OpenSSL;  use GNAT.Sockets.Server.OpenSSL;
with OpenSSL;                      use OpenSSL;
with Parsers.JSON;                 use Parsers.JSON;
with Parsers.JSON.String_Source;   use Parsers.JSON.String_Source;
with Strings_Edit.Integers;        use Strings_Edit.Integers;
with Strings_Edit.Quoted;          use Strings_Edit.Quoted;
with Strings_Edit.Streams;         use Strings_Edit.Streams;
with Strings_Edit.Long_Floats;     use Strings_Edit.Long_Floats;
with Test_HTTP_Servers.OpenSSL;    use Test_HTTP_Servers.OpenSSL;

with GNAT.Sockets.Connection_State_Machine.HTTP_Client.Signaled;
with GNAT.Sockets.Server.Pooled;
with Parsers.String_Source;
with Stack_Storage;

procedure Test_HTTPS_OpenSSL_JSON_Client is
    use GNAT.Sockets.Connection_State_Machine.HTTP_Client.Signaled;

    Address : constant String := "poloniex.com";
    Path    : constant String := "public?command=returnTicker";
    Port    : constant := 443;

    procedure Dump (Prefix : String; Value : JSON_Value) is
    begin
       case Value.JSON_Type is
          when JSON_Boolean =>
             Put_Line (Prefix & Boolean'Image (Value.Condition));
          when JSON_Null =>
             Put_Line (Prefix & "null");
          when JSON_Number =>
             Put_Line (Prefix & Image (Value.Value));
          when JSON_String =>
             Put_Line (Prefix & Quote (Value.Text.all));
          when JSON_Array =>
             Put_Line (Prefix & "(");
             for Index in Value.Sequence'Range loop
                Dump (Prefix & "   ", Value.Sequence (Index));
             end loop;
             Put_Line (Prefix & ")");
          when JSON_Object =>
             Put_Line (Prefix & "{");
             for Index in Value.Map'Range loop
                Put_Line (Prefix & "   " & Value.Map (Index).Name.all & 
"=");
                Dump (Prefix & "      ", Value.Map (Index).Value);
             end loop;
             Put_Line (Prefix & "}");
       end case;
    end Dump;
begin
    declare
       Factory : aliased HTTPS_OpenSSL_Factory
                         (  Request_Length  => 200,
                            Input_Size      => 40,
                            Output_Size     => 1024,
                            Decoded_Size    => 40,
                            Max_Connections => 100
                         );
    begin
       Set_Default_Verify_Paths (Factory, Client_Context);
       declare
          Message   : aliased String_Stream (1024 * 100);
          Server    : aliased GNAT.Sockets.Server.
                              Connections_Server (Factory'Access, 0);
          Reference : GNAT.Sockets.Server.Handles.Handle;
       begin
          Put_Line ("HTTP client started");
          Set
          (  Reference,
             new HTTP_Session_Signaled
                 (  Server'Unchecked_Access,
                    200,
                    512,
                    1024
          )      );
          declare
             Client : HTTP_Session_Signaled renames
                      HTTP_Session_Signaled (Ptr (Reference).all);
          begin
             Connect (Client, Address, Port);
             Get
             (  Client,
                "https://" & Address & "/" & Path,
                Message'Unchecked_Access
             );
             Wait (Client, False);
             Put_Line
             (  Image (Get_Response_Code (Client))
             &  " "
             &  Get_Response_Reason (Client)
             &  " Message >>>>>>>>>>>>>>>>>>>>"
             );
             declare
                Content : aliased String := Get (Message);
                Source  : aliased Parsers.String_Source.
                                  Source (Content'Access);
                Arena   : aliased Stack_Storage.Pool (1024, 10);
                Data    : constant JSON_Value :=
                                   Parse (Source'Access, Arena'Access);
             begin
                Dump ("", Data);
             end;
             Put_Line ("<<<<<<<<<<<<<<<<<<<< Message");
          end;
          Put_Line ("HTTP client stopping");
       end;
    end;
exception
    when Error : others =>
       Put_Line ("Error: " & Exception_Information (Error));
end Test_HTTPS_OpenSSL_JSON_Client;
----------------------------- test_https_openssl_json_client.adb -----

It connects fine and spills lots of garbage like:

   ...
    USDT_SNX=
       {
          id=
             290.9999999999999
          last=
             "0.00000000"
          lowestAsk=
             "0.00000000"
          highestBid=
             "0.00000000"
          percentChange=
             "0.00000000"
          baseVolume=
             "0.00000000"
          quoteVolume=
             "0.00000000"
          isFrozen=
             "0"
          high24hr=
             "0.00000000"
          low24hr=
             "0.00000000"
       }
    TRX_SNX=
       {
          id=
             292.0000000000000
          last=
             "0.00000000"
          lowestAsk=
             "0.00000000"
          highestBid=
             "0.00000000"
          percentChange=
             "0.00000000"
     ...

and so on. Funny enough, they put numbers as strings, so it seems.

It is not very efficient as written. You see, the code it accumulates 
all response in a string stream buffer. Then takes a string from that. 
Then it parses the obtained string into a JSON object. So it is two 
copies too many. One could parse the response on the fly without 
accumulating it whole in the memory. But it would mean more efforts.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simple parse from https website
  2020-04-02 17:16     ` Dmitry A. Kazakov
@ 2020-04-02 18:27       ` Rego, P.
  2020-04-02 19:05         ` Dmitry A. Kazakov
  0 siblings, 1 reply; 17+ messages in thread
From: Rego, P. @ 2020-04-02 18:27 UTC (permalink / raw)


> No, that site looks OK. I modified my OpenSSL HTTP client. I just added 
> JSON parser and procedure Dump to print the JSON object:
> 
> ----------------------------- test_https_openssl_json_client.adb -----
> with Ada.Exceptions;               use Ada.Exceptions;
> with Ada.Text_IO;                  use Ada.Text_IO;
> with Ada.Streams;                  use Ada.Streams;
> --with GNAT.Exception_Traces;      use GNAT.Exception_Traces;
> with GNAT.Sockets.Server.Handles;  use GNAT.Sockets.Server.Handles;
> with GNAT.Sockets.Server.OpenSSL;  use GNAT.Sockets.Server.OpenSSL;
> with OpenSSL;                      use OpenSSL;
> with Parsers.JSON;                 use Parsers.JSON;
> with Parsers.JSON.String_Source;   use Parsers.JSON.String_Source;
> with Strings_Edit.Integers;        use Strings_Edit.Integers;
> with Strings_Edit.Quoted;          use Strings_Edit.Quoted;
> with Strings_Edit.Streams;         use Strings_Edit.Streams;
> with Strings_Edit.Long_Floats;     use Strings_Edit.Long_Floats;
> with Test_HTTP_Servers.OpenSSL;    use Test_HTTP_Servers.OpenSSL;
> 
> with GNAT.Sockets.Connection_State_Machine.HTTP_Client.Signaled;
> with GNAT.Sockets.Server.Pooled;
> with Parsers.String_Source;
> with Stack_Storage;
> 
> procedure Test_HTTPS_OpenSSL_JSON_Client is
>     use GNAT.Sockets.Connection_State_Machine.HTTP_Client.Signaled;
> 
>     Address : constant String := "poloniex.com";
>     Path    : constant String := "public?command=returnTicker";
>     Port    : constant := 443;
> 
>     procedure Dump (Prefix : String; Value : JSON_Value) is
>     begin
>        case Value.JSON_Type is
>           when JSON_Boolean =>
>              Put_Line (Prefix & Boolean'Image (Value.Condition));
>           when JSON_Null =>
>              Put_Line (Prefix & "null");
>           when JSON_Number =>
>              Put_Line (Prefix & Image (Value.Value));
>           when JSON_String =>
>              Put_Line (Prefix & Quote (Value.Text.all));
>           when JSON_Array =>
>              Put_Line (Prefix & "(");
>              for Index in Value.Sequence'Range loop
>                 Dump (Prefix & "   ", Value.Sequence (Index));
>              end loop;
>              Put_Line (Prefix & ")");
>           when JSON_Object =>
>              Put_Line (Prefix & "{");
>              for Index in Value.Map'Range loop
>                 Put_Line (Prefix & "   " & Value.Map (Index).Name.all & 
> "=");
>                 Dump (Prefix & "      ", Value.Map (Index).Value);
>              end loop;
>              Put_Line (Prefix & "}");
>        end case;
>     end Dump;
> begin
>     declare
>        Factory : aliased HTTPS_OpenSSL_Factory
>                          (  Request_Length  => 200,
>                             Input_Size      => 40,
>                             Output_Size     => 1024,
>                             Decoded_Size    => 40,
>                             Max_Connections => 100
>                          );
>     begin
>        Set_Default_Verify_Paths (Factory, Client_Context);
>        declare
>           Message   : aliased String_Stream (1024 * 100);
>           Server    : aliased GNAT.Sockets.Server.
>                               Connections_Server (Factory'Access, 0);
>           Reference : GNAT.Sockets.Server.Handles.Handle;
>        begin
>           Put_Line ("HTTP client started");
>           Set
>           (  Reference,
>              new HTTP_Session_Signaled
>                  (  Server'Unchecked_Access,
>                     200,
>                     512,
>                     1024
>           )      );
>           declare
>              Client : HTTP_Session_Signaled renames
>                       HTTP_Session_Signaled (Ptr (Reference).all);
>           begin
>              Connect (Client, Address, Port);
>              Get
>              (  Client,
>                 "https://" & Address & "/" & Path,
>                 Message'Unchecked_Access
>              );
>              Wait (Client, False);
>              Put_Line
>              (  Image (Get_Response_Code (Client))
>              &  " "
>              &  Get_Response_Reason (Client)
>              &  " Message >>>>>>>>>>>>>>>>>>>>"
>              );
>              declare
>                 Content : aliased String := Get (Message);
>                 Source  : aliased Parsers.String_Source.
>                                   Source (Content'Access);
>                 Arena   : aliased Stack_Storage.Pool (1024, 10);
>                 Data    : constant JSON_Value :=
>                                    Parse (Source'Access, Arena'Access);
>              begin
>                 Dump ("", Data);
>              end;
>              Put_Line ("<<<<<<<<<<<<<<<<<<<< Message");
>           end;
>           Put_Line ("HTTP client stopping");
>        end;
>     end;
> exception
>     when Error : others =>
>        Put_Line ("Error: " & Exception_Information (Error));
> end Test_HTTPS_OpenSSL_JSON_Client;
> ----------------------------- test_https_openssl_json_client.adb -----
> 
> It connects fine and spills lots of garbage like:
> 
>    ...
>     USDT_SNX=
>        {
>           id=
>              290.9999999999999
>           last=
>              "0.00000000"
>           lowestAsk=
>              "0.00000000"
>           highestBid=
>              "0.00000000"
>           percentChange=
>              "0.00000000"
>           baseVolume=
>              "0.00000000"
>           quoteVolume=
>              "0.00000000"
>           isFrozen=
>              "0"
>           high24hr=
>              "0.00000000"
>           low24hr=
>              "0.00000000"
>        }
>     TRX_SNX=
>        {
>           id=
>              292.0000000000000
>           last=
>              "0.00000000"
>           lowestAsk=
>              "0.00000000"
>           highestBid=
>              "0.00000000"
>           percentChange=
>              "0.00000000"
>      ...
> 
> and so on. Funny enough, they put numbers as strings, so it seems.
> 
> It is not very efficient as written. You see, the code it accumulates 
> all response in a string stream buffer. Then takes a string from that. 
> Then it parses the obtained string into a JSON object. So it is two 
> copies too many. One could parse the response on the fly without 
> accumulating it whole in the memory. But it would mean more efforts.

Omg... (almost) Perfect(!lol)...just discovered that GNAT.Sockets has a signature change, some subpackages are no more exposed (like GNAT.SOCKETS.Server). I am using GNAT Community 2019.

Builder results
        17:6 file "g-scstma.ads" not found
        6:6 file "g-socser.ads" not found
        7:6 file "g-socser.ads" not found
        18:6 file "g-socser.ads" not found
        8:6 file "openssl.ads" not found
        9:6 file "parsers.ads" not found
        10:6 file "parsers.ads" not found
        19:6 file "parsers.ads" not found
        20:6 file "stack_storage.ads" not found
        11:6 file "strings_edit.ads" not found
        12:6 file "strings_edit.ads" not found
        13:6 file "strings_edit.ads" not found
        14:6 file "strings_edit.ads" not found
        15:6 file "test_http_servers.ads" not found


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simple parse from https website
  2020-04-02 18:27       ` Rego, P.
@ 2020-04-02 19:05         ` Dmitry A. Kazakov
  2020-04-02 19:34           ` Rego, P.
  0 siblings, 1 reply; 17+ messages in thread
From: Dmitry A. Kazakov @ 2020-04-02 19:05 UTC (permalink / raw)


On 2020-04-02 20:27, Rego, P. wrote:

> Omg... (almost) Perfect(!lol)...just discovered that GNAT.Sockets has a signature change, some subpackages are no more exposed (like GNAT.SOCKETS.Server). I am using GNAT Community 2019.
> 
> Builder results
>          17:6 file "g-scstma.ads" not found
>          6:6 file "g-socser.ads" not found
>          7:6 file "g-socser.ads" not found
>          18:6 file "g-socser.ads" not found
>          8:6 file "openssl.ads" not found
>          9:6 file "parsers.ads" not found
>          10:6 file "parsers.ads" not found
>          19:6 file "parsers.ads" not found
>          20:6 file "stack_storage.ads" not found
>          11:6 file "strings_edit.ads" not found
>          12:6 file "strings_edit.ads" not found
>          13:6 file "strings_edit.ads" not found
>          14:6 file "strings_edit.ads" not found
>          15:6 file "test_http_servers.ads" not found

Egh, no, this is not AWS and not a part of GNAT Community 2019. I just 
tested if your site worked with Simple Components.

So GNAT.Sockets.Server is a part of Simple Components. I know it is 
confusing but it must be a child of GNAT.Sockets to see a few things 
declared there privately.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simple parse from https website
  2020-04-02 19:05         ` Dmitry A. Kazakov
@ 2020-04-02 19:34           ` Rego, P.
  2020-04-03  5:19             ` Jere
  2020-04-03  6:47             ` Dmitry A. Kazakov
  0 siblings, 2 replies; 17+ messages in thread
From: Rego, P. @ 2020-04-02 19:34 UTC (permalink / raw)


> Egh, no, this is not AWS and not a part of GNAT Community 2019. I just 
> tested if your site worked with Simple Components.
> 
> So GNAT.Sockets.Server is a part of Simple Components. I know it is 
> confusing but it must be a child of GNAT.Sockets to see a few things 
> declared there privately.

Oh, got it now =)
Ok, so I included Simple Components as a source folder (using source from your site http://www.dmitry-kazakov.de/ada/components_4_48.tgz). But I got those compilation errors:

        16:6 "Gnat.Sockets.Connection_State_Machine (spec)" depends on "Gnat.Sockets.Server (spec)"
        16:6 "Json_Dmitry (body)" depends on "Gnat.Sockets.Connection_State_Machine (spec)"
        5:6 file "g-socser.ads" not found
        6:6 file "g-socser.ads" not found
        16:6 file "g-socser.ads" not found
        14:6 file "test_http_servers.ads" not found

It seems that the compiler is looking for abbreviated names for the GNAT.Sockets child packages (but they are there). How can I force the compiler/builder to look for the extended names?

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simple parse from https website
  2020-04-02 19:34           ` Rego, P.
@ 2020-04-03  5:19             ` Jere
  2020-04-03 12:13               ` Rego, P.
  2020-04-03  6:47             ` Dmitry A. Kazakov
  1 sibling, 1 reply; 17+ messages in thread
From: Jere @ 2020-04-03  5:19 UTC (permalink / raw)


On Thursday, April 2, 2020 at 3:35:00 PM UTC-4, Rego, P. wrote:
> > Egh, no, this is not AWS and not a part of GNAT Community 2019. I just 
> > tested if your site worked with Simple Components.
> > 
> > So GNAT.Sockets.Server is a part of Simple Components. I know it is 
> > confusing but it must be a child of GNAT.Sockets to see a few things 
> > declared there privately.
> 
> Oh, got it now =)
> Ok, so I included Simple Components as a source folder (using source from your site http://www.dmitry-kazakov.de/ada/components_4_48.tgz). But I got those compilation errors:
> 
>         16:6 "Gnat.Sockets.Connection_State_Machine (spec)" depends on "Gnat.Sockets.Server (spec)"
>         16:6 "Json_Dmitry (body)" depends on "Gnat.Sockets.Connection_State_Machine (spec)"
>         5:6 file "g-socser.ads" not found
>         6:6 file "g-socser.ads" not found
>         16:6 file "g-socser.ads" not found
>         14:6 file "test_http_servers.ads" not found
> 
> It seems that the compiler is looking for abbreviated names for the GNAT.Sockets child packages (but they are there). How can I force the compiler/builder to look for the extended names?

Did you try building simple components as a library and 
"withing" the gpr file instead of adding it to your source
directories?

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simple parse from https website
  2020-04-02 19:34           ` Rego, P.
  2020-04-03  5:19             ` Jere
@ 2020-04-03  6:47             ` Dmitry A. Kazakov
  2020-04-03 12:42               ` Rego, P.
  1 sibling, 1 reply; 17+ messages in thread
From: Dmitry A. Kazakov @ 2020-04-03  6:47 UTC (permalink / raw)


On 2020-04-02 21:34, Rego, P. wrote:
>> Egh, no, this is not AWS and not a part of GNAT Community 2019. I just
>> tested if your site worked with Simple Components.
>>
>> So GNAT.Sockets.Server is a part of Simple Components. I know it is
>> confusing but it must be a child of GNAT.Sockets to see a few things
>> declared there privately.
> 
> Oh, got it now =)
> Ok, so I included Simple Components as a source folder (using source from your site http://www.dmitry-kazakov.de/ada/components_4_48.tgz). But I got those compilation errors:
> 
>          16:6 "Gnat.Sockets.Connection_State_Machine (spec)" depends on "Gnat.Sockets.Server (spec)"
>          16:6 "Json_Dmitry (body)" depends on "Gnat.Sockets.Connection_State_Machine (spec)"
>          5:6 file "g-socser.ads" not found
>          6:6 file "g-socser.ads" not found
>          16:6 file "g-socser.ads" not found
>          14:6 file "test_http_servers.ads" not found
> 
> It seems that the compiler is looking for abbreviated names for the GNAT.Sockets child packages (but they are there). How can I force the compiler/builder to look for the extended names?

You need to set up the project with-ing corresponding gpr-files.

It is a bit off-topic here. Let's keep it outside c.l.a. Send me an 
E-mail, and I will help you to set things straight.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simple parse from https website
  2020-04-02 14:44   ` Rego, P.
@ 2020-04-03  9:35     ` Björn Lundin
  2020-04-03 12:04       ` Rego, P.
  0 siblings, 1 reply; 17+ messages in thread
From: Björn Lundin @ 2020-04-03  9:35 UTC (permalink / raw)


Den 2020-04-02 kl. 16:44, skrev Rego, P.:
>> Wild guess: You have to compile AWS with SSL support
> 
> Do you mean to include some project switch to compile it using SSL support? (maybe would you know which switches, please?)

If your code works with http and not https, you need to
* download aws source (github )
* configure it for https -> you point out openssh/gnutls
* compile it
* install it
* use it - use env var ADA_PROJECT_PATH to point to where you installed 
the https version (directory with aws.gpr).

I hope you are on Linux, it's a pain on windows (or at least was)

-- 
Björn

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simple parse from https website
  2020-04-03  9:35     ` Björn Lundin
@ 2020-04-03 12:04       ` Rego, P.
  0 siblings, 0 replies; 17+ messages in thread
From: Rego, P. @ 2020-04-03 12:04 UTC (permalink / raw)


> If your code works with http and not https, you need to
> * download aws source (github )
> * configure it for https -> you point out openssh/gnutls
> * compile it
> * install it
> * use it - use env var ADA_PROJECT_PATH to point to where you installed 
> the https version (directory with aws.gpr).
> 
> I hope you are on Linux, it's a pain on windows (or at least was)

(I'm on Windows) Thanks Björn, but this should be more straightforward. I mean, it should be simpler, just a get/post from a rest API to download a CSV. In this application I was trying to run away from Python because it has an awful threading/tasking treatment (among several other awfulness), but I am almost trying a binding.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simple parse from https website
  2020-04-03  5:19             ` Jere
@ 2020-04-03 12:13               ` Rego, P.
  2020-04-03 12:30                 ` Rego, P.
  0 siblings, 1 reply; 17+ messages in thread
From: Rego, P. @ 2020-04-03 12:13 UTC (permalink / raw)


> Did you try building simple components as a library and 
> "withing" the gpr file instead of adding it to your source
> directories?

Hi Jere. Not yet, trying to do this way.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simple parse from https website
  2020-04-03 12:13               ` Rego, P.
@ 2020-04-03 12:30                 ` Rego, P.
  2020-04-03 12:49                   ` Dmitry A. Kazakov
  0 siblings, 1 reply; 17+ messages in thread
From: Rego, P. @ 2020-04-03 12:30 UTC (permalink / raw)


On Friday, April 3, 2020 at 9:13:19 AM UTC-3, Rego, P. wrote:
> > Did you try building simple components as a library and 
> > "withing" the gpr file instead of adding it to your source
> > directories?
> 
> Hi Jere. Not yet, trying to do this way.

Same response. Also, it looks that some files are not there, like parsers-json.ads (in this case it does not exist in my machine)

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simple parse from https website
  2020-04-03  6:47             ` Dmitry A. Kazakov
@ 2020-04-03 12:42               ` Rego, P.
  0 siblings, 0 replies; 17+ messages in thread
From: Rego, P. @ 2020-04-03 12:42 UTC (permalink / raw)


> You need to set up the project with-ing corresponding gpr-files.
> 
> It is a bit off-topic here. Let's keep it outside c.l.a. Send me an 
> E-mail, and I will help you to set things straight.

Ok I will do it. Thanks Dmitry.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simple parse from https website
  2020-04-03 12:30                 ` Rego, P.
@ 2020-04-03 12:49                   ` Dmitry A. Kazakov
  0 siblings, 0 replies; 17+ messages in thread
From: Dmitry A. Kazakov @ 2020-04-03 12:49 UTC (permalink / raw)


On 2020-04-03 14:30, Rego, P. wrote:
> On Friday, April 3, 2020 at 9:13:19 AM UTC-3, Rego, P. wrote:
>>> Did you try building simple components as a library and
>>> "withing" the gpr file instead of adding it to your source
>>> directories?
>>
>> Hi Jere. Not yet, trying to do this way.
> 
> Same response. Also, it looks that some files are not there, like parsers-json.ads (in this case it does not exist in my machine)

They are certainly there. In your gpr-project file you must have these:

with "components.gpr";
with "components-connections_server-http_server.gpr";
with "components-connections_server-openssl.gpr";
with "components-openssl.gpr";
with "components-json.gpr";

Things like JSON, HTTP, OpenSSL bindings are outside the core library. 
You must add them extra.

BTW, if you want to try it, there is a small bug fix in the signaled 
HTTP client which is not yet released. You can download it here:

http://www.dmitry-kazakov.de/ada/components_4_49.tgz

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2020-04-03 12:49 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-02 13:58 Simple parse from https website Rego, P.
2020-04-02 14:24 ` Egil H H
2020-04-02 14:44   ` Rego, P.
2020-04-03  9:35     ` Björn Lundin
2020-04-03 12:04       ` Rego, P.
2020-04-02 14:42 ` Dmitry A. Kazakov
2020-04-02 14:48   ` Rego, P.
2020-04-02 17:16     ` Dmitry A. Kazakov
2020-04-02 18:27       ` Rego, P.
2020-04-02 19:05         ` Dmitry A. Kazakov
2020-04-02 19:34           ` Rego, P.
2020-04-03  5:19             ` Jere
2020-04-03 12:13               ` Rego, P.
2020-04-03 12:30                 ` Rego, P.
2020-04-03 12:49                   ` Dmitry A. Kazakov
2020-04-03  6:47             ` Dmitry A. Kazakov
2020-04-03 12:42               ` Rego, P.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox