Example #1
0
static inline void
clean_cli(client_t *client)
{
    write_access_log(client, log_fd, log_path);
    if(client->req){
        free_request(client->req);
        client->req = NULL;
    }
    Py_CLEAR(client->http_status);
    Py_CLEAR(client->headers);
    Py_CLEAR(client->response_iter);
    
    Py_CLEAR(client->response);
#ifdef DEBUG
    printf("clean_cli environ status_code %d address %p \n", client->status_code, client->environ);
#endif
    if(client->environ){ 
        PyDict_Clear(client->environ);
        Py_DECREF(client->environ);
    }
    if(client->body){
        if(client->body_type == BODY_TYPE_TMPFILE){
            fclose(client->body);
        }else{
            free_buffer(client->body);
        }
        client->body = NULL;
    }
    client->header_done = 0;
    client->response_closed = 0;
    client->chunked_response = 0;
    client->content_length_set = 0;
    client->content_length = 0;
    client->write_bytes = 0;
}
Example #2
0
static void
clean_cli(client_t *client)
{
  write_access_log(client, log_fd, log_path); 
  if(client->req){
    free_request(client->req);
    client->req = NULL;
  }
#ifdef DEBUG
  printf("close environ %p \n", client->environ);
#endif

  // force clear
  client->environ = rb_hash_new();

  if(client->http != NULL){
    ruby_xfree(client->http);
    client->http = NULL;
  }
}