From 084a3114186e8c7c12a72ef01468bcd98a0eb3e6 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Thu, 23 Mar 2023 10:57:41 -0700 Subject: [PATCH] Minor updates to 2005/mynx Though this will not work as is I have changed the code to scan for https as well (it exited before). This is so if someone comes up with a clever command line to make it work it can. A secure connection has to be established before http commands can be given but now it at least can connect (though it's been a while since I've played with sockets so maybe I'm forgetting some detail - one does have to specify the port but I gave an example in the README.md file for that). In the README.md I pointed out that one has to specify http:// (or else https though with the caveat noted above). I also explained how to specify an alternative port. I also noted the https issue in the bugs.md file in the INABIAF section ('it's not a bug it's a feature'). As well I changed the try command in the entry README.md file to refer to a page that does not use https as trying it on the ioccc website (what it used to) will just return a 301 error. --- 2005/mynx/README.md | 19 +++++++++++++++++-- 2005/mynx/mynx.c | 2 +- bugs.md | 10 ++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/2005/mynx/README.md b/2005/mynx/README.md index f18aa72b4..662c9fc73 100644 --- a/2005/mynx/README.md +++ b/2005/mynx/README.md @@ -16,15 +16,30 @@ make ### To run: ```sh -./prog +./mynx http:// ``` +You can specify a port by appending to the domain `:port`. See notes below on +the issue of https. + ### Try: ```sh -./mynx http://www.ioccc.org/ +./mynx http://www.textfiles.com ``` + +[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) pointed out that this +will not work for https initially for two reasons. First it scanned for http://. +Cody changed it to scan for both http:// and https:// but the problem is a +secure connection needs to be set up before http commands can be sent. One would +also have to specify a port in the URL. Fortunately or unfortunately many more +websites use https nowadays so this entry will not work as well as it used to. +If one were to try and connect to `http://www.ioccc.org` with this entry they'll +just get a 301 error. Perhaps someone can come up with a pipeline that will make +this work with the change made. Otherwise just enjoy it for what it was. + + ## Judges' comments This little mynx will give any Fiery Fox a run for its money. A nice complement diff --git a/2005/mynx/mynx.c b/2005/mynx/mynx.c index c0a95094b..b3d21e644 100644 --- a/2005/mynx/mynx.c +++ b/2005/mynx/mynx.c @@ -147,7 +147,7 @@ main(I V, c *v) struct sockaddr_in A; L = 0; B = 1; - Q !sscanf(t, "http://%255[^/]%n", h, &n) && !*h) { + Q (!sscanf(t, "http://%255[^/]%n", h, &n)&&!sscanf(t,"https://%255[^/]%n",h, &n) && !*h)) { Q !(f = fopen(t, "rb"))) k 1; goto e; diff --git a/bugs.md b/bugs.md index c49727fda..c3da92b3c 100644 --- a/bugs.md +++ b/bugs.md @@ -226,6 +226,16 @@ is true on both linux and macOS, with `k` being equal to 22. Should the entry use `perror()`? Perhaps not but we're not sure of its purpose so it can stay for now with this note. +### [2005/mynx](2005/mynx/mynx.c) ([README.md](2005/mynx/README.md)) + +[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) notes that, though +probably obvious, this entry will not work with https. He changed the code to +scan for https too (it exited before) in case someone comes up with a clever +command line to make it work but the problem is a secure connection has to first +be set up in order to give http commands. This is not a bug but it's worth +pointing out as it won't work on as many websites as it used to including the +[IOCCC website](https://www.ioccc.org) itself. + ### [2019/endoh](2019/endoh/prog.c) ([README.md](2019/endoh/README.md))