paulgorman.org

< ^ txt

Wed Jan 17 09:16:01 EST 2018 Slept from eleven to seven. Woke briefly around five. High of twenty-four and partly sunny today. Apparently a large meteor hit nearby last night, causing a 2.0 magnitude shockwave. I was out to dinner with the SEMIBUG guys. Several people got "did you feel that?" text messages, but we didn't feel it at all. I'd forgotten about it, but mom called this morning to say her whole house had shaken. Work: - Get in touch with West Virginia about litigation hold Done. - Work on MECS A bit. --- falstaff ~ % sudo virt-manager No protocol specified Unable to init server: Could not connect: Connection refused (virt-manager:17967): Gtk-WARNING **: cannot open display: :0 --- falstaff ~ % xhost +local: non-network local connections being added to access control list Tried a new Thai Place for lunch. Telegraph near Ten. Not bad, but their hot+ is very, very spicy. Fifteen-minute walk. Sunny and not especially gold. The wind throws powder off roofs like glitter confetti. Home: - Pay off Barclay (juniper) credit card Done. Reference number 512689031. - Serving txt as UTF-8 from OpenBSD httpd? Done. --- https://www.w3.org/International/articles/http-charset/index I did a default install of OpenBSD 6.2, and ran httpd with the config: ``` server "default" { listen on * port 80 root "/htdocs/test" } types { include "/usr/share/misc/mime.types" } ``` The results for serving a text file appear identical with or without the "types" stanza. Both return the header "Content-Type: text/plain" rather than "Content-Type: text/plain; charset=utf-8". ``` ~ $ curl -v http://192.168.122.62/test.txt * Trying 192.168.122.62... * TCP_NODELAY set * Connected to 192.168.122.62 (192.168.122.62) port 80 (#0) > GET /test.txt HTTP/1.1 > Host: 192.168.122.62 > User-Agent: curl/7.57.0 > Accept: */* > < HTTP/1.1 200 OK < Connection: keep-alive < Content-Length: 22 < Content-Type: text/plain < Date: Wed, 17 Jan 2018 16:28:18 GMT < Last-Modified: Wed, 17 Jan 2018 16:24:00 GMT < Server: OpenBSD httpd < This is a test. 😕 * Connection #0 to host 192.168.122.62 left intact ``` Httpd won't start if we try to do something like: ``` server "default" { listen on * port 80 root "/htdocs/test" } types { "text/plain; charset=utf-8" txt } ``` It doesn't seem to like the semicolon or equals sign, and I haven't figured out if there's a way to escape them. Apache has "AddDefaultCharset utf-8". https://github.com/reyk/httpd/issues/5 > Support configurable charset for directory auto index and files. So, OpenBSD httpd lack of setting "charset" is a known issue. Maybe add Nginx as a reverse proxy? ``` # pkg_add nginx # vi /etc/httpd.conf server "default" { listen on 127.0.0.1 port 80 root "/htdocs/test" } # vi /etc/nginx/nginx.conf [...] http { charset utf-8; server { location / { proxy_pass http://127.0.0.1/; } [...] } [...] } [...] # rcctl enable nginx # rcctl start nginx ``` That works. Nginx is fine doing reverse proxy to simply add the correct character set. --- I no longer serve unencrypted HTTP. Port 80 traffic gets forwarded to 443. Decided to use Nginx as a reverse proxy and for SSL termination. Revised https://paulgorman.org/technical/openbsd-vultr-runbook.txt. https://www.kernel.org/doc/Documentation/networking/netconsole.txt Lunch: coffee, pineapple curry Dinner: Italian sub, fries

< ^ txt