Jump to content

Photo

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

TI-99/4A SOFTWARE INTERNET

469 replies to this topic

#376 Schmitzi OFFLINE  

Schmitzi

    River Patroller

  • 4,525 posts
  • ToXiC
  • Location:Germany

Posted Thu Oct 27, 2016 3:11 AM

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)



#377 slinkeey OFFLINE  

slinkeey

    Dragonstomper

  • 504 posts
  • Not a Gamer
  • Location:Racine, WI

Posted Thu Oct 27, 2016 6:16 AM

Stuart is hosting a custom DNS server.



#378 Stuart ONLINE  

Stuart

    Dragonstomper

  • 868 posts
  • Location:Southampton, UK

Posted Thu Oct 27, 2016 12:24 PM

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.



#379 ElectricLab OFFLINE  

ElectricLab

    Moonsweeper

  • 260 posts
  • Location:Hillsboro, Oregon

Posted Thu Oct 27, 2016 12:32 PM

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.

#380 Stuart ONLINE  

Stuart

    Dragonstomper

  • 868 posts
  • Location:Southampton, UK

Posted Thu Oct 27, 2016 12:55 PM

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, Thu Oct 27, 2016 12:56 PM.


#381 ElectricLab OFFLINE  

ElectricLab

    Moonsweeper

  • 260 posts
  • Location:Hillsboro, Oregon

Posted Thu Oct 27, 2016 1:09 PM

Sure thing. If you want to email me the script I can change it, or when I get back to the office I'll come up with a regex to do it.

#382 Stuart ONLINE  

Stuart

    Dragonstomper

  • 868 posts
  • Location:Southampton, UK

Posted Thu Oct 27, 2016 1:37 PM

Any disadvantage to using ...

 

$valid = filter_var($string, FILTER_VALIDATE_IP);

 

... instead of a regex?



#383 ElectricLab OFFLINE  

ElectricLab

    Moonsweeper

  • 260 posts
  • Location:Hillsboro, Oregon

Posted Thu Oct 27, 2016 1:39 PM

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)) {



#384 ElectricLab OFFLINE  

ElectricLab

    Moonsweeper

  • 260 posts
  • Location:Hillsboro, Oregon

Posted Thu Oct 27, 2016 1:40 PM

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. 



#385 Stuart ONLINE  

Stuart

    Dragonstomper

  • 868 posts
  • Location:Southampton, UK

Posted Thu Oct 27, 2016 1:56 PM

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.



#386 ElectricLab OFFLINE  

ElectricLab

    Moonsweeper

  • 260 posts
  • Location:Hillsboro, Oregon

Posted Thu Oct 27, 2016 1:59 PM

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.



#387 slinkeey OFFLINE  

slinkeey

    Dragonstomper

  • 504 posts
  • Not a Gamer
  • Location:Racine, WI

Posted Thu Oct 27, 2016 5:39 PM

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.



#388 Schmitzi OFFLINE  

Schmitzi

    River Patroller

  • 4,525 posts
  • ToXiC
  • Location:Germany

Posted Thu Oct 27, 2016 6:29 PM

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



#389 ElectricLab OFFLINE  

ElectricLab

    Moonsweeper

  • 260 posts
  • Location:Hillsboro, Oregon

Posted Thu Oct 27, 2016 6:47 PM

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.

#390 ElectricLab OFFLINE  

ElectricLab

    Moonsweeper

  • 260 posts
  • Location:Hillsboro, Oregon

Posted Thu Oct 27, 2016 6:57 PM

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.



#391 ElectricLab OFFLINE  

ElectricLab

    Moonsweeper

  • 260 posts
  • Location:Hillsboro, Oregon

Posted Thu Oct 27, 2016 7:00 PM

 

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. 



#392 slinkeey OFFLINE  

slinkeey

    Dragonstomper

  • 504 posts
  • Not a Gamer
  • Location:Racine, WI

Posted Thu Oct 27, 2016 7:02 PM

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


Edited by slinkeey, Thu Oct 27, 2016 7:08 PM.


#393 ElectricLab OFFLINE  

ElectricLab

    Moonsweeper

  • 260 posts
  • Location:Hillsboro, Oregon

Posted Thu Oct 27, 2016 7:08 PM

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.



#394 slinkeey OFFLINE  

slinkeey

    Dragonstomper

  • 504 posts
  • Not a Gamer
  • Location:Racine, WI

Posted Thu Oct 27, 2016 9:18 PM

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.



#395 Stuart ONLINE  

Stuart

    Dragonstomper

  • 868 posts
  • Location:Southampton, UK

Posted Fri Oct 28, 2016 3:33 AM

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.



#396 --- Ω --- OFFLINE  

--- Ω ---

    Hexacorerunner

  • Topic Starter
  • 13,924 posts
  • Location:82.102.25.76

Posted Fri Oct 28, 2016 5:11 AM

Hmmmm, that sounds interesting.  Are you considering making it SAMS aware and capable or something?



#397 ElectricLab OFFLINE  

ElectricLab

    Moonsweeper

  • 260 posts
  • Location:Hillsboro, Oregon

Posted Fri Oct 28, 2016 2:33 PM

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.



#398 --- Ω --- OFFLINE  

--- Ω ---

    Hexacorerunner

  • Topic Starter
  • 13,924 posts
  • Location:82.102.25.76

Posted Fri Oct 28, 2016 5:03 PM

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...



#399 Stuart ONLINE  

Stuart

    Dragonstomper

  • 868 posts
  • Location:Southampton, UK

Posted Fri Oct 28, 2016 5:34 PM

--- Ω ---, 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???



#400 --- Ω --- OFFLINE  

--- Ω ---

    Hexacorerunner

  • Topic Starter
  • 13,924 posts
  • Location:82.102.25.76

Posted Fri Oct 28, 2016 5:43 PM

 

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

 

 Oh, you got me!  I honestly didn't think about that thing.  







Also tagged with one or more of these keywords: TI-99/4A, SOFTWARE, INTERNET

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users