1

PROBLEM:

I am trying to access data from a remote Bugzilla server using Bugzilla's REST API. Whenever I await a response from HttpClient.GetAsync, this exception is thrown.

WHAT I'VE TRIED:

In an effort to understand the exception, I've investigated the following SO questions and GitHub issues:

CORE CODE:

The purpose of the code below is to get the Bugzilla version of the server at _url_version. For example, if I set _url_version = "https://bugzilla.mozilla.org/rest/version", I get a valid response.

// Get version, dummy test to ensure REST API is working via http requests
public async Task<string> GetVersion()
{
    using (var client = new HttpClient())
    {
        HttpResponseMessage response = await client.GetAsync(_url_version);
        string json = await response.Content.ReadAsStringAsync();
        return JsonConvert.DeserializeObject<Rootobject>(json).version;
    }
}

QUESTION:

What is the meaning of this exception? What could be causing the communication break between my application and the remote Bugzilla server?

McGuireV10
  • 9,572
  • 5
  • 48
  • 64
Murfcoder
  • 33
  • 1
  • 9
  • That URL returns a gzipped response, See: [Decompressing GZip Stream from HTTPClient Response](https://stackoverflow.com/questions/20990601/decompressing-gzip-stream-from-httpclient-response) – Alex K. Mar 12 '18 at 14:54
  • @AlexK I serialize the response into an object. For the example URL, the serialization works fine. The problem is actually getting the response from a different URL. – Murfcoder Mar 12 '18 at 15:01
  • Sorry I missed the working bit. Have you tried tracing: https://stackoverflow.com/questions/18924996/logging-request-response-messages-when-using-httpclient – Alex K. Mar 12 '18 at 15:03
  • I'll give that a whirl and see what I can find. Thanks Alex. – Murfcoder Mar 12 '18 at 15:08
  • @AlexK [Here](http://textuploader.com/dxyxp) is the relevant trace for the exception. Any thoughts? – Murfcoder Mar 12 '18 at 15:30

1 Answers1

0

After doing some digging, I was able to resolve this issue by updating Bugzilla to 5.0.4.

ROOT CAUSE:

By using Curl, I was able to manually examine the headers from the Http response (here). The exception was being caused by noise in the response:

Bugzilla.pm:sysread() is deprecated on :utf8 handles. This will be a fatal error in Perl 5.30 at C:/...

For some reason, this issue with a perl module was being echoed on the server side.

SOLUTION:

According the Bugzilla 5.0.4 release notes, the issue was resolved. I updated my Bugzilla installation and the REST API worked as intended.

Hopefully this is helpful to someone out there!

Murfcoder
  • 33
  • 1
  • 9