Kitz ADSL Broadband Information
adsl spacer  
Support this site
Home Broadband ISPs Tech Routers Wiki Forum
 
     
   Compare ISP   Rate your ISP
   Glossary   Glossary
 
Please login or register.

Login with username, password and session length
Advanced search  

News:

Author Topic: Testing for existence of HTTP server without hang  (Read 1826 times)

Weaver

  • Senior Kitizen
  • ******
  • Posts: 11459
  • Retd s/w dev; A&A; 4x7km ADSL2 lines; Firebrick
Testing for existence of HTTP server without hang
« on: August 12, 2022, 08:02:04 PM »

I want to test whether or not a particular HTTP server works and whether or not it has the correct software in the server by seeing if it’s giving back happy HTTP responses, or any kind of responses that I can try to parse to see if they are in some kind of recognisable format. I need to make sure that doing this won’t hang the querier though if the server doesn’t exist, isn’t an http server, or is the wrong http server. How should I go about achieving this with no hang-danger?

And yes I’m using iOS Shortcuts again, and you don’t know anything about it, but there’s not much to say really: it just has the usual synchronous get-content-at-url( url ) service, or whatever it’s called.

Now the specifics: This is a ZyXEL modem that is running our friend Mr Johnson’s custom ZyXEL modem firmware and I’m talking to the Johnson stats server, an alternative small http server ‘Mongoose’, listening on port 8000, running alongside the usual ZyXEL main admin webserver. (Easy-stats web server only works if the ZyXEL is configured into modem-only mode, ie it’s not being a wireless router.) So this is http://192.168.1.1:8000

I’m also wondering about the choice of url to query, to see if an intelligent choice might help but I’m not at all hopeful.

I don’t have a way of pinging the address first programmatically in Shortcuts afaik, will recheck that. But I’m not sure it would really help to prevent hangs though.
« Last Edit: August 12, 2022, 08:49:13 PM by Weaver »
Logged

Alex Atkin UK

  • Addicted Kitizen
  • *****
  • Posts: 5273
    • Thinkbroadband Quality Monitors
Re: Testing for existence of HTTP server without hang
« Reply #1 on: August 12, 2022, 08:04:40 PM »

I would have thought all you can do is have a really short timeout and risk missing slow responding servers.
Logged
Broadband: Zen Full Fibre 900 + Three 5G Routers: pfSense (Intel N100) + Huawei CPE Pro 2 H122-373 WiFi: Zyxel NWA210AX
Switches: Netgear MS510TXUP, Netgear MS510TXPP, Netgear GS110EMX My Broadband History & Ping Monitors

Weaver

  • Senior Kitizen
  • ******
  • Posts: 11459
  • Retd s/w dev; A&A; 4x7km ADSL2 lines; Firebrick
Re: Testing for existence of HTTP server without hang
« Reply #2 on: August 12, 2022, 08:50:10 PM »

Quite true, don’t have a timeout parameter though. I need something that will just fail straight away or work.
Logged

Alex Atkin UK

  • Addicted Kitizen
  • *****
  • Posts: 5273
    • Thinkbroadband Quality Monitors
Re: Testing for existence of HTTP server without hang
« Reply #3 on: August 13, 2022, 12:43:46 AM »

That's problematic, I assume this is something you're running on the iPad?
Logged
Broadband: Zen Full Fibre 900 + Three 5G Routers: pfSense (Intel N100) + Huawei CPE Pro 2 H122-373 WiFi: Zyxel NWA210AX
Switches: Netgear MS510TXUP, Netgear MS510TXPP, Netgear GS110EMX My Broadband History & Ping Monitors

burakkucat

  • Respected
  • Senior Kitizen
  • *
  • Posts: 38300
  • Over the Rainbow Bridge
    • The ELRepo Project
Re: Testing for existence of HTTP server without hang
« Reply #4 on: August 13, 2022, 01:03:28 AM »

. . . I assume this is something you're running on the iPad?

The iOS shortcuts.
Logged
:cat:  100% Linux and, previously, Unix. Co-founder of the ELRepo Project.

Please consider making a donation to support the running of this site.

Weaver

  • Senior Kitizen
  • ******
  • Posts: 11459
  • Retd s/w dev; A&A; 4x7km ADSL2 lines; Firebrick
Re: Testing for existence of HTTP server without hang
« Reply #5 on: August 13, 2022, 01:22:06 AM »

@Alex indeed. Program written in iOS Shortcuts. I’m trying to think of some way to grope a modem, to see if it’s alive and connected, and check if it’s not even a ZyXEL modem but a lawnmower, and check that it has Mr Johnson’s good custom firmware in it which gives us a second webserver as mentioned earlier.

I currently attempt to do a GET from a well-known johnson-modem-stats URL, rather than just from "/", because I want to check that it really is Mr Johnson that I’m seeing and not some other random http-speaking thing. If I get a reply, but the reply looks like a mere ASCII decimal number, then I assume it’s an http error code and handle that accordingly with a whinge. But in practice if things go wrong because the modem is disconnected or dead, then I get a hang, because the routine I’m calling is synchronous. This is a bad thing and the resulting hang is very much not good, so I really need something safe to do first. Iirc there will be a timeout, but it’s far far too long.
Logged

Alex Atkin UK

  • Addicted Kitizen
  • *****
  • Posts: 5273
    • Thinkbroadband Quality Monitors
Re: Testing for existence of HTTP server without hang
« Reply #6 on: August 13, 2022, 03:37:06 AM »

I'm guessing you're out of luck. https://discussions.apple.com/thread/251788606
Logged
Broadband: Zen Full Fibre 900 + Three 5G Routers: pfSense (Intel N100) + Huawei CPE Pro 2 H122-373 WiFi: Zyxel NWA210AX
Switches: Netgear MS510TXUP, Netgear MS510TXPP, Netgear GS110EMX My Broadband History & Ping Monitors

Chrysalis

  • Content Team
  • Addicted Kitizen
  • *
  • Posts: 7391
  • VM Gig1 - AAISP L2TP
Re: Testing for existence of HTTP server without hang
« Reply #7 on: August 13, 2022, 07:55:30 AM »

You cant do a telnet command with a short timeout?
Logged

Weaver

  • Senior Kitizen
  • ******
  • Posts: 11459
  • Retd s/w dev; A&A; 4x7km ADSL2 lines; Firebrick
Re: Testing for existence of HTTP server without hang
« Reply #8 on: August 13, 2022, 09:01:39 AM »

@Alex thanks for spotting that. iOS 16 is just around the corner so can only hope they see this deficiency.

@Chrysalis Oh how I wish for telnet support in Shortcuts. I have a command called ‘run remote script via ssh’ or some such, so I wonder if a zero-length script would work, but in any case there’s no timeout parameter to that either, which is bonkers.
Logged