TCP/IP Volume 2 User’s Manual rabbit.com 4
4. HTTP Server................................................................................................................................................161
4.1 HTTP Server Data Structures.............................................................................................................162
4.1.1 HttpState.......................................................................................................................................162
4.2 Configuration Macros..........................................................................................................................165
4.2.1 Sending Customized HTTP Headers to the Client.......................................................................167
4.2.2 Saving Custom Headers from the Client......................................................................................168
4.3 Authentication Methods......................................................................................................................169
4.4 Setting the Time Zone.........................................................................................................................170
4.5 Sample Programs..................................................................................................................................170
4.5.1 Serving Static Web Pages ............................................................................................................170
4.5.2 Dynamic Web Pages Without HTML Forms...............................................................................173
4.5.3 Web Pages With HTML Forms ...................................................................................................177
4.5.4 HTML Forms Using Zserver.lib..................................................................................................183
4.6 HTTP File Upload................................................................................................................................188
4.6.1 What is a CGI Function and Why is It Useful? ...........................................................................188
4.6.2 How Do I Use the New CGI Facility?.........................................................................................189
4.7 API Functions for HTTP Servers.......................................................................................................209
5. RabbitWeb....................................................................................................................................................283
5.1 Getting Started: A Simple Example..................................................................................................283
5.1.1 Dynamic C Application Code for Humidity Detector .................................................................283
5.1.2 HTML Pages for Humidity Detector ...........................................................................................288
5.2 Dynamic C Language Enhancements for RabbitWeb....................................................................293
5.2.1 Registering Variables, Arrays and Structures..............................................................................293
5.2.2 Web Guards..................................................................................................................................294
5.2.3 Security Features..........................................................................................................................297
5.2.4 Handling Variable Changes .........................................................................................................299
5.3 ZHTML Scripting Language..............................................................................................................301
5.3.1 SSI Tags, Statements and Variables.............................................................................................301
5.3.2 Flow Control ................................................................................................................................302
5.3.3 Selection Variables.......................................................................................................................304
5.3.4 Checkboxes and RadioButtons ....................................................................................................305
5.3.5 Error Handling .............................................................................................................................306
5.3.6 Security: Permissions and Authentication ...................................................................................307
5.4 TCP to Serial Port Configuration Example......................................................................................308
5.4.1 Dynamic C Application Code......................................................................................................308
5.4.2 HTML Page for TCP to Serial Port Example ..............................................................................320
5.5 RabbitWeb Reference..........................................................................................................................322
5.5.1 Language Enhancements Grammar .............................................................................................322
5.5.2 Configuration Macros ..................................................................................................................323
5.5.3 Compiler Directives.....................................................................................................................324
5.5.4 ZHTML Grammar........................................................................................................................325
5.5.5 RabbitWeb Functions...................................................................................................................326
6. HTTP Client..................................................................................................................................................328
6.1 Configuration Macros..........................................................................................................................328
6.2 API Functions.......................................................................................................................................329
6.2.1 Initialization Functions.................................................................................................................329
6.2.2 Connect and Request Functions...................................................................................................329
6.2.3 Read Server Response Functions.................................................................................................329
6.2.4 Miscellaneous Functions..............................................................................................................329
6.2.5 Function Descriptions ..................................................................................................................330