General Notes:

This demo is provided as both interpreted and compiled 4D structures.
This demo will be somewhat slow if run in interpreted mode. Compiled,
however, it will be very fast. This is because of the text parsing and
BLOB manipulation being done by the demo. Usually, you will only want
to use the interpreted version of the demo to see the code. To run the
demo, though, it is probably best to run compiled for the dramatic
speed increase this will afford.



To use HTTPcd_Demo:

Open the database structure ("HTTPcd_Demo.4DB" for interpreted or
"HTTPcd_demo.4DC" for compiled) with 4D 6.8.x. After launching the
HTTPcd_Demo, choose "HTTP Client" from the "View" menu. This will open
a window with an enterable area for a URL. Enter a full URL (e.g.
"http://www.deepskytech.com/") and press the Load button.

The HTTP header and content will be displayed. HTML links will be
parsed out and displayed in the scrolling list. Image links will be
parsed out and displayed in the Images tab of the HTTPcd Browser
window. Double-clicking an HTML link will cause that page to be
loaded.  Double-clicking an image link will cause that image to be
loaded.



Tour of the HTTPcd_Demo code:

All code related to this demo is in the BRS_ module. The HTTP Client
window is started from the method BRS_c. From there, you can see the
form that is loaded.

The method BRS_LoadURL actually loads the specified URL and calls the
parsing routines. In this method, you can see the call to the method
HTTPcd_Get_Simple, which is responsible for loading the requested URL.
Other HTTPcd component methods are used to extract the header from the
response and get the content type. Most of the code you will see in
this demo handles the display of the information; all the work of
getting the information is already done by the HTTPcd component.



Summary:

This demo only scratches the surface of what is possible using the
HTTPcd component. HEAD and POST requests are also supported and are
very easy to use. If you need more control, the method
HTTPcd_Retrieve_Object allows the developer to build the entire
request header and content. The possibilities are limited only by the
developer's imagination!



Troubleshooting:

"I have started HTTPcd_Demo, but I cannot load web pages."

Test the same URL you are trying to load in HTTPcd_Demo in a web
browser. If the web page displays in the web browser, it should
display in HTTPcd_Demo. Also, make sure the URL you are trying to load
begins with "http://". The demo will not automatically prefix URLs
with the protocol. Since HTTPcd_Demo uses Internet Commands, it cannot
use SSL ("https://" URLs) unless you are using 4D v6.8.x or 4D v7.0.x.

"The URL takes a long time to load."

Run the compiled demo! The interpreted demo will run pretty slow
because of the text parsing that is being done. The compiled demo is
much faster than the interpreted demo.

"The demo will not quit."

HTTPcd_Demo should always quit (when you tell it to quit). However, if
it will not quit for some reason, it may be necessary to force quit
the demo.

To force quit the demo on MacOS, press the <command>, <option>, and
<escape> keys simultaneously. A dialog should display asking if you
want to force the 4D application to quit. If the dialog is asking
about quitting some other application, hit the "Cancel" button. 
Otherwise, hit the "Force Quit" button.

To force quit the demo on Windows, press the <control>, <alt>, and
<delete> keys simultaneously. This will bring up the Task Manager.
Choose the 4D application, and click the "End Task" button.

"There are errors related to the plugin commands."

4th Dimension installs 4D Pack (formerly ACI Pack) and Internet
Commands into the system Mac4DX/Win4DX folder so that they can be
available to all 4D databases. The demo includes all necessary plugins
in its own 4DX folder; this includes 4D Pack and a stub for Internet
Commands.  Sometimes, the plugins in the system 4DX folder may cause
resource conflicts with the plugins in the demo's 4DX folder. You can
temporarily remove the conflicting plugins from the system 4DX folder
to see if this is causing the problem.
