davidw      02/01/18 11:08:53

  Modified:    src      make.tcl rivetWWW.c
  Added:       src      TclWeb.c TclWeb.h TclWebapache.c TclWebcgi.c
  Log:
  * src/TclWebcgi.c: New file for stand-alone implementations of common
    web API.
  
  * src/TclWebapache.c: New file for apache-based implementations of web
    API.
  
  * src/TclWeb.c: Common code for TclWeb API.
  
  * src/TclWeb.h: TclWeb web interaction API.
  
  Revision  Changes    Path
  1.11      +2 -2      tcl-rivet/src/make.tcl
  
  Index: make.tcl
  ===================================================================
  RCS file: /home/cvs/tcl-rivet/src/make.tcl,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- make.tcl  12 Jan 2002 00:54:38 -0000      1.10
  +++ make.tcl  18 Jan 2002 19:08:53 -0000      1.11
  @@ -2,7 +2,7 @@
   # the next line restarts using tclsh \
        exec tclsh "$0" "$@"
   
  -# $Id: make.tcl,v 1.10 2002/01/12 00:54:38 damonc Exp $
  +# $Id: make.tcl,v 1.11 2002/01/18 19:08:53 davidw Exp $
   
   # this file actually runs things, making use of the aardvark build
   # system.
  @@ -16,7 +16,7 @@
   
   # add variables
   
  -set APXS "/usr/local/apache-1.3/bin/apxs"
  +set APXS "apxs"
   
   set INC "-I[exec $APXS -q INCLUDEDIR] -I$TCL_PREFIX/include"
   
  
  
  
  1.2       +1 -1      tcl-rivet/src/rivetWWW.c
  
  Index: rivetWWW.c
  ===================================================================
  RCS file: /home/cvs/tcl-rivet/src/rivetWWW.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- rivetWWW.c        11 Jan 2002 06:47:48 -0000      1.1
  +++ rivetWWW.c        18 Jan 2002 19:08:53 -0000      1.2
  @@ -17,7 +17,7 @@
    *
    
*-----------------------------------------------------------------------------
    */
  -static int 
  +static int
   Rivet_HexToDigit(int c) {
   
       if (c >= 'a' && c <= 'f') {
  
  
  
  1.1                  tcl-rivet/src/TclWeb.c
  
  Index: TclWeb.c
  ===================================================================
  /*
   * TclWeb.c --
   *    Common API layer.
   */
  
  /* $Id: TclWeb.c,v 1.1 2002/01/18 19:08:53 davidw Exp $ */
  
  #include <tcl.h>
  #include "TclWeb.h"
  
  
  
  int
  TclWeb_SendHeaders(TclWebRequest *req)
  {
  #ifdef APACHE_MODULE
      ap_send_header(req->req);
  #else
  
  #endif /* APACHE_MODULE */
      return TCL_OK;
  }
  
  int
  TclWeb_HeaderSet(char *header, char *val, void *arg);
  
  int
  TclWeb_SetStatus(int status, void *arg);
  
  int
  TclWeb_GetCGIVars(Tcl_Obj *list, void *arg);
  
  int
  TclWeb_GetEnvVars(Tcl_Obj *list, void *arg);
  
  int
  TclWeb_Base64Encode(char *out, char *in, int len, void *arg);
  
  int
  TclWeb_Base64Decode(char *out, char *in, int len, void *arg);
  
  int
  TclWeb_EscapeShellCommand(char *out, char *in, void *arg);
  
  /* output/write/flush?  */
  
  /* error (log) ? */
  
  
  
  1.1                  tcl-rivet/src/TclWeb.h
  
  Index: TclWeb.h
  ===================================================================
  /*
   * TclWeb.c --
   *    Common API layer.
   */
  
  
  /*
   
*-----------------------------------------------------------------------------
   *
   * TclWeb_InitRequest --
   * Initializes the request structure.
   *
   
*-----------------------------------------------------------------------------
   */
  
  int TclWeb_InitRequest(TclWebRequest *req, void *arg);
  
  
  /*
   
*-----------------------------------------------------------------------------
   *
   * TclWeb_SendHeaders --
   * Sends HTTP headers.
   *
   * Results:
   * HTTP headers output.  Things like cookies may no longer be manipulated.
   *
   
*-----------------------------------------------------------------------------
   */
  
  int TclWeb_SendHeaders(TclWebRequest *req);
  
  
  /*
   
*-----------------------------------------------------------------------------
   *
   * TclWeb_HeaderSet --
   * Sets HTTP headers.
   *
   
*-----------------------------------------------------------------------------
   */
  
  int TclWeb_HeaderSet(char *header, char *val, TclWebRequest *req);
  
  
  /*
   
*-----------------------------------------------------------------------------
   *
   * TclWeb_SetStatus --
   * Sets status number (200, 404) for reply.
   *
   
*-----------------------------------------------------------------------------
   */
  
  int TclWeb_SetStatus(int status, TclWebRequest *req);
  
  
  /*
   
*-----------------------------------------------------------------------------
   *
   * TclWeb_Cookie --
   * Make cookie.
   *
   
*-----------------------------------------------------------------------------
   */
  
  int TclWeb_Cookie(Tcl_Obj *list, TclWebRequest *req);
  
  int TclWeb_GetCookie(Tcl_Obj *list, TclWebRequest *req);
  
  int TclWeb_GetCGIVars(Tcl_Obj *list, TclWebRequest *req);
  
  int TclWeb_GetEnvVars(Tcl_Obj *list, TclWebRequest *req);
  
  /* upload stuff goes here */
  
  int TclWeb_Escape(char *out, char *in, int len, void *var);
  
  int TclWeb_UnEscape(char *out, char *in, int len, void *var);
  
  int TclWeb_Base64Encode(char *out, char *in, int len, TclWebRequest *req);
  
  int TclWeb_Base64Decode(char *out, char *in, int len, TclWebRequest *req);
  
  int TclWeb_EscapeShellCommand(char *out, char *in, TclWebRequest *req);
  
  /* output/write/flush?  */
  
  /* error (log) ? */
  
  
  
  1.1                  tcl-rivet/src/TclWebapache.c
  
  Index: TclWebapache.c
  ===================================================================
  /*
   * TclWeb.c --
   *    Common API layer.
   *
   * This file contains the Apache-based versions of the functions in
   * TclWeb.h.  They rely on Apache and apreq to perform the underlying
   * operations.
   */
  
  /* $Id: TclWebapache.c,v 1.1 2002/01/18 19:08:53 davidw Exp $ */
  
  #include <tcl.h>
  #include "TclWeb.h"
  
  typedef struct _TclWebRequest {
      request_rec *req;
      ApacheRequest *apachereq;
  } TclWebRequest;
  
  int
  TclWeb_InitRequest(TclWebRequest *req, void *arg)
  {
      req = Tcl_Alloc(sizeof(TclWebRequest));
      req->req = (request_rec *)arg;
      req->apacherequest = ApacheRequest_new(r);
      return TCL_OK;
  }
  
  int
  TclWeb_SendHeaders(TclWebRequest *req)
  {
      ap_send_header(req->req);
      return TCL_OK;
  }
  
  int
  TclWeb_HeaderSet(char *header, char *val, TclWebRequest *req)
  {
      ap_table_set(req->req->headers_out, header, val);
      return TCL_OK;
  }
  
  int
  TclWeb_SetStatus(int status, TclWebRequest *req)
  {
      req->req->status = status;
      return TCL_OK;
  }
  
  int
  TclWeb_GetCGIVars(Tcl_Obj *list, TclWebRequest *req)
  {
  
  }
  
  int
  TclWeb_GetEnvVars(Tcl_Obj *list, TclWebRequest *req);
  
  int
  TclWeb_Base64Encode(char *out, char *in, int len, TclWebRequest *req);
  
  int
  TclWeb_Base64Decode(char *out, char *in, int len, TclWebRequest *req);
  
  int
  TclWeb_EscapeShellCommand(char *out, char *in, TclWebRequest *req);
  
  /* output/write/flush?  */
  
  /* error (log) ? */
  
  
  
  1.1                  tcl-rivet/src/TclWebcgi.c
  
  Index: TclWebcgi.c
  ===================================================================
  /*
   * TclWeb.c --
   *    Common API layer.
   *
   * These are the standalone (CGI) variants of the functions found in
   * TclWeb.h.  Low-level implementations are provided in this file.
   */
  
  /* $Id: TclWebcgi.c,v 1.1 2002/01/18 19:08:53 davidw Exp $ */
  
  #include <tcl.h>
  #include "TclWeb.h"
  
  typedef struct _TclWebRequest {
      int header_sent;
      Tcl_HashTable *headers;
      int status;
  } TclWebRequest;
  
  int
  TclWeb_InitRequest(TclWebRequest *req, void *arg)
  {
      req = Tcl_Alloc(sizeof(TclWebRequest));
      req->headers = Tcl_Alloc(sizeof(Tcl_HashTable));
      Tcl_InitHashTable(req->headers, TCL_STRING_KEYS);
      return TCL_OK;
  }
  
  int
  TclWeb_SendHeaders(TclWebRequest *req)
  {
      return TCL_OK;
  }
  
  int
  TclWeb_HeaderSet(char *header, char *val, TclWebRequest *req);
  
  int
  TclWeb_SetStatus(int status, TclWebRequest *req);
  
  int
  TclWeb_GetCGIVars(Tcl_Obj *list, TclWebRequest *req);
  
  int
  TclWeb_GetEnvVars(Tcl_Obj *list, TclWebRequest *req);
  
  int
  TclWeb_Base64Encode(char *out, char *in, int len, TclWebRequest *req);
  
  int
  TclWeb_Base64Decode(char *out, char *in, int len, TclWebRequest *req);
  
  int
  TclWeb_EscapeShellCommand(char *out, char *in, TclWebRequest *req);
  
  /* output/write/flush?  */
  
  /* error (log) ? */
  
  
  

Reply via email to