Jump to content
--- Ω ---

Stuart's TI-99/4A - Internet Web Browser

Recommended Posts

This might have been asked, or I am doing something wrong but...

 

Can you just put an ip address into the adress bar. I am testing something utilizing a local webserver, that the script on your server that resolves DNS does not know about.

 

If you run a local DNS-Server in your LAN, (ie on Win/AD-Server), can´t you add a DNS-A-Record to point to this local IP-address ?

(or is Stuart´s Browser using a "fixed" DNS-Server to resolve requests)

Share this post


Link to post
Share on other sites

This might have been asked, or I am doing something wrong but...

 

Can you just put an ip address into the adress bar. I am testing something utilizing a local webserver, that the script on your server that resolves DNS does not know about.

 

It will treat the IP address as a host name and try to convert it to an IP address (which with the current PHP script will fail), as ElectricLab says. If the have the means to hex-edit the browser disk or EPROM image you're using, it should be possible to modify the program to point to your own server to do the DNS conversion - but you'll need details of the syntax the browser is using/expecting. I'll try to sort out some details over the weekend.

  • Like 1

Share this post


Link to post
Share on other sites

Stuart, wouldn't it be possible to modify the PHP script to realize it's been passed an IP address via a regex and then just return the address back to the browser?

 

If you want, I'd be glad to host a backup of this DNS script here in the States. The browser could be modified to set mine as secondary and automatically check the secondary

if the primary doesn't answer.

Share this post


Link to post
Share on other sites
ElectricLab, on 27 Oct 2016 - 7:32 PM, said:

Stuart, wouldn't it be possible to modify the PHP script to realize it's been passed an IP address via a regex and then just return the address back to the browser?

 

 

Could you conjure the PHP line needed to determine if its an IP address rather than a host name?

Edited by Stuart

Share this post


Link to post
Share on other sites

Any disadvantage to using ...

 

$valid = filter_var($string, FILTER_VALIDATE_IP);

 

... instead of a regex?

Share this post


Link to post
Share on other sites

This code should do it:

 

<?php

# $host_name = 'myti99.com';

# $host_name = '10.192.2.4';

$host_name = '10.2.3.4/test.html';

print "host_name: $host_name\n";

if (preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/', $host_name)) {

print "That's an IP address\n";

}

else {

print "That's a hostname!\n";

}

?>

I'm not sure if the IP address is passed by itself or has '/somefile.html' along with it when it's passed to your PHP script, so I wrote this regex to account for it.

You could change the preg_match to this to match only an IP address and nothing else like this:

if (preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $host_name)) {

Share this post


Link to post
Share on other sites

Any disadvantage to using ...

 

$valid = filter_var($string, FILTER_VALIDATE_IP);

 

... instead of a regex?

 

I've not used filter_var, but it looks handy.

Share this post


Link to post
Share on other sites

Thanks Corey. I actually need to park this for a couple of days until I can look at the browser source code (I'm away from home at the moment). I've a vague memory that the "www." prefix is required/expected in some areas of the program, which would give a problem if using an IP address. I need to check that before playing with the PHP script.

Share this post


Link to post
Share on other sites

Thanks Corey. I actually need to park this for a couple of days until I can look at the browser source code (I'm away from home at the moment). I've a vague memory that the "www." prefix is required/expected in some areas of the program, which would give a problem if using an IP address. I need to check that before playing with the PHP script.

 

Sounds good. I'll be happy to test IP address functionality when you do modify the script.

I know you can leave off the 'www' when entering a URL into your browser, and it works OK.

  • Like 1

Share this post


Link to post
Share on other sites

Yeah, and not all addresses contain "www"

 

Yeah, 192.168.1.102/test would be normal. Basically like a real web-server, that doesn't have a domain name, because it is internal.

 

I actually thought about rerouting traffic to your IP that does DNS resolution, internally, so I could do my own DNS resolution.

Share this post


Link to post
Share on other sites

Maybe you can define an alias/IP-redirect for Stuart´s DNS´ external IP, to your internal DNS-Server, on your firewall ?

Share this post


Link to post
Share on other sites

I believe the browser makes a call to his DNS resolver script, via a hard-coded IP address. You'd not be able to redirect this which is why Stuart suggested a hex/edit of the browser to change this to your local IP address.

 

There are two fixes I can think of:

 

1) Stuart could modify his DNS resolver script to detect that it's being sent an IP address and not a host name, and simply return the IP address it was given.

 

2) Stuart could modify the browser to detect that it's been asked to go to an IP address and bypass the host name lookup, and pass this IP address on to the code which generates the call to the serial adapter.

 

I think the first solution is OK since the browser does cache 5 or so IP addresses so it doesn't keep trying to resolve names.

Share this post


Link to post
Share on other sites

Yeah, and not all addresses contain "www"

 

Yeah, 192.168.1.102/test would be normal. Basically like a real web-server, that doesn't have a domain name, because it is internal.

 

I actually thought about rerouting traffic to your IP that does DNS resolution, internally, so I could do my own DNS resolution.

 

Indeed it would be handy to have it work with IP addresses instead of hostnames so you could experiment with it. What I did when I was developing was create a dev hostname, which I had to create DNS records for. I've taken to using name-based virtual hosts (Apache FTW!) and puttign some default page up if you connect to it by its IP address only.

Share this post


Link to post
Share on other sites

 

If you run a local DNS-Server in your LAN, (ie on Win/AD-Server), can´t you add a DNS-A-Record to point to this local IP-address ?

(or is Stuart´s Browser using a "fixed" DNS-Server to resolve requests)

You can't, even if you run a local DNS server. The issue is that if you're dealing with an IP address, DNS wouldn't be queried so you can't redirect it.

Share this post


Link to post
Share on other sites

You could get the IP range that Stuart uses on your internal network. Not the best practice, but...

Edited by slinkeey

Share this post


Link to post
Share on other sites

You could get the IP range that Stuart uses on your internal network.

 

Yes, you could certainly create a local static route on your network to encompass the IP address where the DNS resolver script currently resides. You could then proxy it to an internal machine running the same script or bring up a machine on that external IP address on your local subnet. This would be a bit of a nasty hack, and I don't think you'll have to do it since it sounds like Stuart is going to put a fix in place.

Share this post


Link to post
Share on other sites

I believe the browser makes a call to his DNS resolver script, via a hard-coded IP address. You'd not be able to redirect this which is why Stuart suggested a hex/edit of the browser to change this to your local IP address.

 

There are two fixes I can think of:

 

1) Stuart could modify his DNS resolver script to detect that it's being sent an IP address and not a host name, and simply return the IP address it was given.

 

2) Stuart could modify the browser to detect that it's been asked to go to an IP address and bypass the host name lookup, and pass this IP address on to the code which generates the call to the serial adapter.

 

I think the first solution is OK since the browser does cache 5 or so IP addresses so it doesn't keep trying to resolve names.

 

Yep. I appreciate the help! :)

 

The only reason why option two would not be ideal is if you didn't have your TI on a network with a route to the internet.. Not likely, but who knows.. Not a big deal, just thinking out loud.

Share this post


Link to post
Share on other sites

So it sounds as if the best approach is to determine *in the browser code* whether an IP address has been entered, and if so there is no need to call the DNS PHP script? Then you could use it on an internal network that isn't connected to the Internet.

 

Corey, any idea how big the largest browser page you have is? Interested to see how many bytes I can grab from the page buffer to use for code, if needed.

  • Like 1

Share this post


Link to post
Share on other sites

So it sounds as if the best approach is to determine *in the browser code* whether an IP address has been entered, and if so there is no need to call the DNS PHP script? Then you could use it on an internal network that isn't connected to the Internet.

 

Corey, any idea how big the largest browser page you have is? Interested to see how many bytes I can grab from the page buffer to use for code, if needed.

 

A chess board page on myti99.com is the largest page, and the amount of bytes is around 11,800. This page contains lots of custom character definitions and is probably one of the largest I'd ever make. On the server side I try to keep the size of the page down by automatically removing newline characters and keep whitespace to a minimum. That brings up a question I had - does the browser just discard whitespace/newlines when it's parsing the page such that it doesn't actually affect memory utilization if we get sloppy? I figured it best to reduce the traffic to a minimum to make data transfer faster and the fastest web browsing possible.

 

Since Slinkeey is working on some things too, maybe he can chime in on what he's getting for a page size.

 

Thanks,

Corey.

Share this post


Link to post
Share on other sites

You know me, I'm always tossing out ideas for tweaks and improvements to existing software.

Everyone that uses the browser has an RS-232 card, and everyone of these RS-232 cards has a PIO port... perfect for an inexpensive DIGIPORT.

 

Now that the browser runs at 38.4, the chess game could be spruced up with some vocals... like "Check", " Checkmate", "Draw", "You lose sucker", or whatever... of course the software would have to support it.

 

Just a thought...

Share this post


Link to post
Share on other sites
--- Ω ---, on 29 Oct 2016 - 12:03 AM, said:

 

Everyone that uses the browser has an RS-232 card, and everyone of these RS-232 cards has a PIO port... perfect for an inexpensive DIGIPORT.

 

 

So where's the PIO port on a NanoPEB???

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...