perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: modperl-2.0/xs/maps apache_functions.map
Date Tue, 13 Mar 2001 06:32:28 GMT
dougm       01/03/12 22:32:28

  Modified:    xs/maps  apache_functions.map
  Added:       xs/Apache/RequestUtil Apache__RequestUtil.h
  Log:
  add a few protocol module helper methods
  
  Revision  Changes    Path
  1.1                  modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h
  
  Index: Apache__RequestUtil.h
  ===================================================================
  /*
   * XXX: these three should be part of the apache api
   * for protocol module helpers
   */
  
  static MP_INLINE request_rec *mpxs_Apache__RequestRec_new(SV *classname,
                                                            conn_rec *c)
  {
      apr_pool_t *p;
      request_rec *r;
      server_rec *s = c->base_server;
  
      apr_pool_create(&p, c->pool);
      r = apr_pcalloc(p, sizeof(request_rec));
  
      r->pool = p;
      r->connection = c;
      r->server = s;
  
      r->hostname = s->server_hostname;
      r->request_config = ap_create_request_config(p);
      r->per_dir_config = s->lookup_defaults;
      r->method = "GET";
      r->method_number = M_GET;
      r->uri = "/";
      r->filename = (char *)ap_server_root_relative(p, r->uri);
  
      r->the_request = "UNKNOWN";
      r->assbackwards = 1;
      r->protocol = "UNKNOWN";
  
      r->status = HTTP_OK;
  
      r->headers_in = apr_table_make(p, 1);
      r->headers_out = apr_table_make(p, 1);
      r->err_headers_out = apr_table_make(p, 1);
      r->notes = apr_table_make(p, 1);
  
      return r;
  }
  
  static MP_INLINE int mpxs_Apache__RequestRec_location_merge(request_rec *r,
                                                              char *location)
  {
      apr_pool_t *p = r->pool;
      server_rec *s = r->server;
      core_server_config *sconf = ap_get_module_config(s->module_config,
                                                       &core_module);
      ap_conf_vector_t **sec = (ap_conf_vector_t **)sconf->sec_url->elts;
      int num_sec = sconf->sec_url->nelts;
      int i;
  
      for (i=0; i<num_sec; i++) {
          core_dir_config *entry =
              (core_dir_config *)ap_get_module_config(sec[i],
                                                      &core_module);
  
          if (strEQ(entry->d, location)) {
              if (!entry->ap_auth_type) {
                  entry->ap_auth_type = "Basic";
              }
              if (!entry->ap_auth_name) {
                  entry->ap_auth_name = apr_pstrdup(p, location);
              }
              r->per_dir_config =
                  ap_merge_per_dir_configs(p, s->lookup_defaults, sec[i]);
              return 1;
          }
      }
  
      return 0;
  }
  
  static MP_INLINE void
  mpxs_Apache__RequestRec_set_basic_credentials(request_rec *r,
                                                char *username,
                                                char *password)
  {
      char encoded[1024];
      int elen;
      char *auth_value, *auth_cat;
  
      auth_cat = apr_pstrcat(r->pool,
                             username, ":", password, NULL);
      elen = apr_base64_encode(encoded, auth_cat, strlen(auth_cat));
      encoded[elen] = '\0';
  
      auth_value = apr_pstrcat(r->pool, "Basic ", encoded, NULL);
      apr_table_setn(r->headers_in, "Authorization", auth_value);
  }
  
  
  
  1.2       +6 -0      modperl-2.0/xs/maps/apache_functions.map
  
  Index: apache_functions.map
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/maps/apache_functions.map,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- apache_functions.map	2001/03/05 03:49:12	1.1
  +++ apache_functions.map	2001/03/13 06:32:28	1.2
  @@ -45,6 +45,12 @@
    ap_get_status_line
    ap_is_initial_req
   
  + #protocol module helpers
  + int:DEFINE_location_merge | | request_rec *:r, char *:location
  + void:DEFINE_set_basic_credentials | | request_rec *:r, char *:username, char *:password
  +PACKAGE=Apache::RequestRec
  + request_rec *:DEFINE_new | | SV *:classname, conn_rec *:c
  +
   #MODULE=Apache::RequestConfig
    ap_document_root
    ap_get_limit_req_body
  
  
  

Mime
View raw message