~ubuntu-branches/ubuntu/hardy/apache2/hardy-proposed

« back to all changes in this revision

Viewing changes to server/scoreboard.c

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Fritsch
  • Date: 2008-01-17 20:27:56 UTC
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: james.westby@ubuntu.com-20080117202756-hv38rjknhwa2ilwi
Tags: upstream-2.2.8
ImportĀ upstreamĀ versionĀ 2.2.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
AP_DECLARE_DATA scoreboard *ap_scoreboard_image = NULL;
41
41
AP_DECLARE_DATA const char *ap_scoreboard_fname = NULL;
42
42
AP_DECLARE_DATA int ap_extended_status = 0;
 
43
AP_DECLARE_DATA int ap_mod_status_reqtail = 0;
43
44
 
44
45
#if APR_HAS_SHARED_MEMORY
45
46
 
157
158
    rv = apr_shm_create(&ap_scoreboard_shm, scoreboard_size, fname, pool);
158
159
    if (rv != APR_SUCCESS) {
159
160
        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
160
 
                     "unable to create scoreboard \"%s\" "
 
161
                     "unable to create or access scoreboard \"%s\" "
161
162
                     "(name-based shared memory failure)", fname);
162
163
        return rv;
163
164
    }
204
205
                            global_pool); /* anonymous shared memory */
205
206
        if ((rv != APR_SUCCESS) && (rv != APR_ENOTIMPL)) {
206
207
            ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
207
 
                         "Unable to create scoreboard "
 
208
                         "Unable to create or access scoreboard "
208
209
                         "(anonymous shared memory failure)");
209
210
            return rv;
210
211
        }
380
381
    (*new_sbh)->thread_num = thread_num;
381
382
}
382
383
 
 
384
static void copy_request(char *rbuf, apr_size_t rbuflen, request_rec *r)
 
385
{
 
386
    char *p;
 
387
 
 
388
    if (r->the_request == NULL) {
 
389
        apr_cpystrn(rbuf, "NULL", rbuflen);
 
390
        return; /* short circuit below */
 
391
    }
 
392
 
 
393
    if (r->parsed_uri.password == NULL) {
 
394
        p = r->the_request;
 
395
    }
 
396
    else {
 
397
        /* Don't reveal the password in the server-status view */
 
398
        p = apr_pstrcat(r->pool, r->method, " ",
 
399
                        apr_uri_unparse(r->pool, &r->parsed_uri,
 
400
                        APR_URI_UNP_OMITPASSWORD),
 
401
                        r->assbackwards ? NULL : " ", r->protocol, NULL);
 
402
    }
 
403
 
 
404
    /* now figure out if we copy over the 1st rbuflen chars or the last */
 
405
    if (!ap_mod_status_reqtail) {
 
406
        apr_cpystrn(rbuf, p, rbuflen);
 
407
    }
 
408
    else {
 
409
        apr_size_t slen = strlen(p);
 
410
        if (slen < rbuflen) {
 
411
            /* it all fits anyway */
 
412
            apr_cpystrn(rbuf, p, rbuflen);
 
413
        }
 
414
        else {
 
415
            apr_cpystrn(rbuf, p+(slen-rbuflen+1), rbuflen);
 
416
        }
 
417
    }
 
418
}
 
419
 
383
420
AP_DECLARE(int) ap_update_child_status_from_indexes(int child_num,
384
421
                                                    int thread_num,
385
422
                                                    int status,
422
459
            conn_rec *c = r->connection;
423
460
            apr_cpystrn(ws->client, ap_get_remote_host(c, r->per_dir_config,
424
461
                        REMOTE_NOLOOKUP, NULL), sizeof(ws->client));
425
 
            if (r->the_request == NULL) {
426
 
                apr_cpystrn(ws->request, "NULL", sizeof(ws->request));
427
 
            } else if (r->parsed_uri.password == NULL) {
428
 
                apr_cpystrn(ws->request, r->the_request, sizeof(ws->request));
429
 
            } else {
430
 
                /* Don't reveal the password in the server-status view */
431
 
                apr_cpystrn(ws->request, apr_pstrcat(r->pool, r->method, " ",
432
 
                            apr_uri_unparse(r->pool, &r->parsed_uri,
433
 
                            APR_URI_UNP_OMITPASSWORD),
434
 
                            r->assbackwards ? NULL : " ", r->protocol, NULL),
435
 
                            sizeof(ws->request));
436
 
            }
 
462
            copy_request(ws->request, sizeof(ws->request), r);
437
463
            apr_cpystrn(ws->vhost, r->server->server_hostname,
438
464
                        sizeof(ws->vhost));
439
465
        }