* * * * *

           More unintended consequences of my Apache configuration

Now that mod_blog [1] supports conditional requests [2], I thought of the
next feature I want to add—PUT support to upload posts.

Currently, mod-blog supports three methods to add new entries:

 1. A traditional web form where updates are done via the POST method. I
    don't use this method that often, but I have used it—perhaps less than
    five times over the past 24 years.
 2. Via email—this was my favorite method until I could no longer email the
    entries from home. Most, if not all, ISP (Internet Service Provider)s
    now forbid outgoing SMTP (Simple Mail Transport Protocol) traffic from
    residential connections. Seeing how I check my email on my public
    server, it doesn't make much sense to use email when I can add an entry—
 3. As a file, via the command line. This is how I add new posts these days.
    I write the entry at home, copy the file to the server and then add it
    via the command line.

I suppose there's a fourth way—adding the entry directly to the storage area
and updating some files containing metadata, but I'm only mentioning this for
completion's sake. I don't think I've ever done this except when I was first
developing mod_blog back in early 2000.

The new method I'm looking to support, the HTTP (HyperText Transport
Protocol) PUT method, would take it down to one command, even for an image-
heavy post like this Burning Down The House Show [3] Bunny and I caught in
Brevard [4] a few years ago. Something like:

-----[ shell ]-----
[spc]lucy:/tmp>put entry *.jpg
[spc]lucy:/tmp>
-----[ END OF LINE ]-----

It shouldn't be that hard, as supporting the PUT method is eaiser than POST—
it's a single item being uploaded, and no x-www-form-urlencoded or form-data
blobs to parse through. It's just the MIME (Multipurpose Internet Mail
Extensions) type, content length and raw data to be placed in a file
somewhere.

So I start working. I add some minimal support to mod_blog to handle the PUT
method. I configure Apache to pipe PUT requests through mod_blog:

-----[ Apache ]-----
#On the development server for now
<Directory /home/spc/web/boston/htdocs>
 ...
 Script PUT /boston.cgi
 ...
</Directory>
-----[ END OF LINE ]-----

and I write a simple script to loop through the command line to upload each
file to the webserver.

And yet, when I attampted to upload an image file, I kept getting a “405
Method Not Allowed.”

Odd.

I just couldn't figure out why.

A single entry? Fine. An entry with multiple text files? Fine. An entry with
multiple binary files that aren't images? Fine.

An entry with any type of image file? Not fine at all.

I spent entirely too long on this before I remembered a recent change to the
Apache configuration: a rewrite rule that redirected image requests directly
to the file system [5]. I then added one more line to the configuration:

-----[ Apache ]-----
<Directory /home/spc/web/boston/journal>
 ...
 Script PUT /boston.cgi
...
<Directory>
-----[ END OF LINE ]-----

and now things worked as expected.

How much time did I waste on this particular rabbit hole? Don't answer that!
I'd rather not know.

[1] https://github.com/spc476/mod_blog
[2] gopher://gopher.conman.org/0Phlog:2024/08/17.1
[3] gopher://gopher.conman.org/0Phlog:2019/06/10.1
[4] https://www.cityofbrevard.com/
[5] gopher://gopher.conman.org/0Phlog:2024/07/27.1

Email author at [email protected]