Doing an HTTP GET with Atari Basic with mode 12.

[Developers] When Doing HTTP GET, use Mode 12 !

TL:DR – When opening an HTTP GET connection, use mode = 12. Mode = 4 now does URL encoding of the path when it’s passed in, and will probably not be what you want.

While Mode = 4 is also an HTTP GET, it will attempt to resolve filenames and encode them so that they can be safely passed to and from a web server. It is intended for accessing plain files on HTTP and WebDAV servers.

So if you’re doing this in ATARI BASIC:

Change it to this:

For cross-platform C programs written in fujinet-lib, use the HTTP_GET_H constant in nopen():

network_open(buf, OPEN_MODE_HTTP_GET_H, OPEN_TRANS_NONE);

While Apple2 users using the AppleSoft BASIC extension should do:

& NOPEN 0, 12,0, "N:HTTPS://APPS.IRATA.ONLINE/Homesoft/?query=1234"

The Change, in Detail

Web servers, and in fact the standard that dictates the format of a URL give special meaning to characters like ? and &, as well as disallowing spaces. If these characters are to be used as part of a file name, they must be encoded so that the web server can pass them through literally.

On the ATARI, at least. You have the N: device. It can open any type of network connection, including to a networked filesystem. This can be used to access files stored on web servers. The encoding of filenames can break the seamless transparency expected, so some additional processing now happens in the FujiNet firmware to encode filenames so that web servers will treat them literally.

For example, with the latest change, this command works as expected:

On Open, the HTTP protocol adapter executes this piece of code here: https://github.com/FujiNetWIFI/fujinet-firmware/blob/master/lib/network-protocol/HTTP.cpp#L322

    if (aux1_open == 4 || aux1_open == 8)
{
// We are opening a file, URL encode the path.
std::string encoded = mstr::urlEncode(url->path);
url->path = encoded;
url->rebuildUrl();
}

return !client->begin(url->url);
}

Which transforms the above entered URL into:

Atari_8-bit%2FGames%2FHomesoft%2FFrogger%20%28Parker%20Brothers%29.xex

…before opening, so the web server is happy.

It does, however, make a bit of a mess when dealing with query parameters, as characters like ? get encoded, and the web server treats them literally as part of the path, rather than as the special query character:

Atari_8-bit/Games/Homesoft/F/Frogger/Frogger (Parker Brothers).xex?query=foo

gets the query part mangled into:

%2FAtari_8-bit%2FGames%2FHomesoft%2FFrogger%20%28Parker%20Brothers%29.xex%3Fquery%3Dfoo

…a mess.

This is why if you’re utilizing some web address that does an HTTP GET, and accepts query parameters, to please use mode 12, which does not do any transformation of the input, and passes it to the web server, unmolested.

FujiApple Rev1 Boards Arrive for Testing

The first batch of 10 PCBs for the Apple II FujiNet have arrived! Initial tests look good on my Apple IIe with Grappler+ SmartPort card using the DB19 disk controller. Several units have been assembled and headed out to others with IIc, IIc+ and IIgs systems for further testing.

This design allows you to use the FujiNet in one of two ways. You can connect the custom DB19 adapter into the FujiNet and it will plug directly into the back of the Apple IIc or IIc+, just like the Atari FujiNet connects to the SIO port.

For other systems where the FujiNet does not fit vertically, you can use the same custom DB19 adapter with a 20 pin cable, or just a regular 20 pin IDC cable directly into the Disk II controller.

An audio out port is on this test board but we’re unsure if it will remain. The Atari FujiNet has audio output that is piped directly from the ESP32 through the SIO port into the systems POKEY sound chip. Since the Apple II has no sound input, one would need an external amplifier and speakers.

Stay tuned for more updates on testing progress!