How to resolve "Attempted to read past end of stream" error?

I get this error when trying to open a C# MySQL Connection on a Manticore server that I am trying to lock-down with HTTPS secure connection.

My Manticore.CONF File:

searchd

{

listen = 9306:https

ssl_cert = E:/ search-cert/config/xxxc01-mncs.crt

    ssl_key = E:/ search-cert/config/xxxc01-mncs.key

ssl_ca = E:/search-cert/config/xxxc01-mncs.crt

   log = E:\Manticore/var/log/manticore/searchd.log

max_packet_size = 32M

    binlog_path = E:\Manticore/var/log/manticore/bin.log

    query_log = E:\Manticore/var/log/manticore/query.log

    pid_file = E:\Manticore/var/run/manticore/searchd.pid

    # read_timeout = E:\Manticore/var/log/manticore/read.log

    client_timeout = E:\Manticore/var/log/manticore/client.log

    query_log_format = sphinxql

 

}

My connection string:

"Server=xx.xxx.xxx.xx.xx;Port=9306;SslMode=required;ConnectionTimeout=3600;DefaultCommandTimeout=3600;SslCert=E:/Manticore/Staging/xxxc01-mncs.crt;SslKey=E:/Manticore/Staging/xxxc01-mncs.key;SslCa=E:/Manticore/Staging/xxxc01-mncs.crt"

It fails on Open() command with “Attempted to read past end of stream error”. I received this error only after trying to implement HTTPS.

Any help would be greatly appreciated.

I found a solution, using HttpClient libraries instead of MySQL.Data. The syntax of the actual query stays the same, but the data-binding of the results is different. Here is sample code, in case it helps anyone else:

   using (var httpClient = new HttpClient())
   {
                                  //sample query, albiet a contrived one
                var manticore_query = $"SELECT my_index_fieldA FROM my_manticore_index LIMIT 1";

                var encodedQuery = HttpUtility.UrlEncode(manticore_query);

                //"query= ... adding this takes care of "query missing" error....
                var query = new StringContent("query=" + encodedQuery, Encoding.UTF8, "application/x-www-form-urlencoded");

                try
                {
                      HttpResponseMessage response = httpClient.PostAsync(https://SRV01-YCs:9306/sql, query).Result;
                      string responseBody = response.Content.ReadAsStringAsync().Result;

                     jsonResults = JsonConvert.DeserializeObject<ResponseObjectDefinition>(responseBody);

             }
             catch (Exception ex)
                   {
                    }

                }                             
1 Like