The Boston Diaries

The ongoing saga of a programmer who doesn't live in Boston, nor does he even like Boston, but yet named his weblog/journal “The Boston Diaries.”

Go figure.

Saturday, November 30, 2019

Another minor issue with DoH

So I'm still having issues with my DoH implementation—this time it's Firefox complaining about not finding a server. I modified the script to log the request and response and as far as I could tell, the addresses were being resolved. It's just that Firefox was refusing to use the given answers. And trying to find an answer to “firefox server not found” is a futile exercise these days, giving me years old answers to issues that weren't quite what I was experiencing.

It's all very annoying.

But in looking over the script, again, I had a small epiphany.

local function output(status,data)
  if not data then
    io.stdout:write(string.format([[
Status: %d
Content-Length: 0

]],status))
  else
    io.stdout:write(string.format([[
Status: %d
Content-Type: application/dns-message
Content-Length: %d

%s]],status,#data,data))
  end
end

The code is running on Unix. By default, the “end-of-line” marker is just a line feed character. But the HTTP specification requires both a line feed and a carriage return character to mark the “end-of-line.” Given that the script works most of the time, I thought Self, perhaps there's a different codepath that is a bit more pedantic about the HTTP specification these particular sites hit for whatever reason. I changed the code:

local function output(status,data)
  if not data then
    io.stdout:write(
        string.format("Status: %d\r\n",status),
        "Content-Length: 0\r\n",
        "\r\n"
    )
  else
    io.stdout:write(
        string.format("Status: %d\r\n",status),
        "Content-Type: application/dns-message\r\n",
        string.format("Content-Length: %d\r\n",#data),
        "\r\n",
        data
    )
  end
end

And immediately, the sites I was having problems with started loading reliably in Firefox. Hopefully, this is the last bug with this service …

Obligatory Picture

Trying to get into the festive mood this year

Obligatory Contact Info

Obligatory Feeds

Obligatory Links

Obligatory Miscellaneous

Obligatory AI Disclaimer

No AI was used in the making of this site, unless otherwise noted.

You have my permission to link freely to any entry here. Go ahead, I won't bite. I promise.

The dates are the permanent links to that day's entries (or entry, if there is only one entry). The titles are the permanent links to that entry only. The format for the links are simple: Start with the base link for this site: https://boston.conman.org/, then add the date you are interested in, say 2000/08/01, so that would make the final URL:

https://boston.conman.org/2000/08/01

You can also specify the entire month by leaving off the day portion. You can even select an arbitrary portion of time.

You may also note subtle shading of the links and that's intentional: the “closer” the link is (relative to the page) the “brighter” it appears. It's an experiment in using color shading to denote the distance a link is from here. If you don't notice it, don't worry; it's not all that important.

It is assumed that every brand name, slogan, corporate name, symbol, design element, et cetera mentioned in these pages is a protected and/or trademarked entity, the sole property of its owner(s), and acknowledgement of this status is implied.

Copyright © 1999-2024 by Sean Conner. All Rights Reserved.