Classic Mac OS Software (Discussions on Applications) > Browsers, FTP, & Remote Control

Learning to program internet connections

(1/5) > >>

OS923:
I'm learning to program internet connections with Real Basic 5.5.5.
The manual/help is not always accurate.
For example, it says that you can call the functions of the internet classes synchronously if you use the timeOut parameter, but if you try this then it will complain that you used too many parameters.
It says also that you can listen at an SSLSocket, but if you try this then it will make an unencrypted connection.
I tried that and it was encrypted.

I tried a HTTP client, HTTP server and MAIL client some time ago.
I've just finished a HTTP proxy.
I want to extend it with HTTPS using the CONNECT command.
Then I want to do filtering of HTTP as well as HTTPS, starting with URL blocking, but I plan also to change HTML by deleting undesired scripts, frames and ads.

The problem is that I can't test it.
I have Apache on XP but I don't get the SSL installed and I prefer to write the program on OS 9.
I search server software which supports SSL and a browser which supports the CONNECT method.

MacTron:
Real Basic is not for *real* development. IMHO.
You should consider Codewarrior in Pascal or C fashion, even the old Symantec stuff do a better job than Real Basic.

nanopico:
I would agree with MacTron on his sentiments completely.

But I can offer a bit of help in this specific instance.

--- Quote from: OS923 on March 01, 2016, 06:35:00 AM ---For example, it says that you can call the functions of the internet classes synchronously if you use the timeOut parameter, but if you try this then it will complain that you used too many parameters.

--- End quote ---

Are you using the HttpSocket class?
If you are how many parameters are you passing 1, 2 or 3? I assume 2 or 3 since you are setting a timeout?

if 2 parameters the Get method returns a string of what was retrieved.  If 3 parameters it returns a boolean if the call succeeded or failed.  In either case,  the compiler expects that return value to be assigned to something.  Failure to do so will result int the too many parameters error. 

So this will work and put the results in the string result.

--- Code: ---Dim h as new HTTPSocker
Dim result as string
result = h.Get("www.macos9lives.com", 30)

--- End code ---

This will fail to compile with the too many parameters error.

--- Code: ---Dim h as new HTTPSocker
h.Get("www.macos9lives.com", 30)

--- End code ---

This will also fail like the one above

--- Code: ---Dim h as new HTTPSocker
Dim f as FolderItem
f = GetFolderItem("Drive:SomeFile")
h.Get("www.macos9lives.com", f, 30)

--- End code ---

But this will work

--- Code: ---Dim h as new HTTPSocker
Dim f as FolderItem
Dim result as Boolean
f = GetFolderItem("Drive:SomeFile")
result = h.Get("www.macos9lives.com", f, 30)

--- End code ---


--- Quote from: OS923 on March 01, 2016, 06:35:00 AM ---I want to extend it with HTTPS using the CONNECT command.

--- End quote ---

Using the HttpSocket won't help you with trying to use the CONNECT command.
That just creates a sort of man in the middle proxy where the raw tcp stream is marshaled between the two end points through the proxy.  The HttpSocket runs and connects at the Application level of the OSI stack.  For using Connect you need to control the stream at the Transport level of the OSI stack (TCP).

OS923:

--- Quote from: nanopico on March 01, 2016, 08:33:20 PM ---But this will work

--- Code: ---Dim h as new HTTPSocker
Dim f as FolderItem
Dim result as Boolean
f = GetFolderItem("Drive:SomeFile")
result = h.Get("www.macos9lives.com", f, 30)

--- End code ---

--- End quote ---
This might indeed work. I'll try it.

OS923:

--- Quote from: nanopico on March 01, 2016, 08:33:20 PM ---Using the HttpSocket won't help you with trying to use the CONNECT command.
That just creates a sort of man in the middle proxy where the raw tcp stream is marshaled between the two end points through the proxy.  The HttpSocket runs and connects at the Application level of the OSI stack.  For using Connect you need to control the stream at the Transport level of the OSI stack (TCP).

--- End quote ---
I'm using an SSLSocket.
I tried this on XP with Firefox:
Window1 has an SSLSocket a
a.secure=false
a.port=444
a.Listen()

Firefox has proxy settings 192.168.1.4:444

I type "https://192.168.1.4"

Then I get the Connected event in a.

s=ReadAll()

=> s = "CONNECT 192.168.1.4:443 HTTP/1.0"

At this point I have an unencrypted connection between Firefox and my program, which is what I wanted.

Then I want an encrypted connection between my program and the server.

So I type:

dim b as HTTPSecureSocket
b=new HTTPSecureSocket
b.Get("https://192.168.1.4",f)

Whatever data arrives now in b can be sent to a.
They are both unencrypted.
That should work, but I can't test it.
First I need a server with secure connections.

Navigation

[0] Message Index

[#] Next page

Go to full version