View | Details | Raw Unified | Return to bug 47788
Collapse All | Expand All

(-)support/ab.c (-8 / +27 lines)
Lines 763-770 Link Here
763
    if (keepalive)
763
    if (keepalive)
764
        printf("Keep-Alive requests:    %d\n", doneka);
764
        printf("Keep-Alive requests:    %d\n", doneka);
765
    printf("Total transferred:      %" APR_INT64_T_FMT " bytes\n", totalread);
765
    printf("Total transferred:      %" APR_INT64_T_FMT " bytes\n", totalread);
766
    if (posting > 0)
766
    if (posting == 1)
767
        printf("Total POSTed:           %" APR_INT64_T_FMT "\n", totalposted);
767
        printf("Total POSTed:           %" APR_INT64_T_FMT "\n", totalposted);
768
    if (posting == 2)
769
        printf("Total PUT:              %" APR_INT64_T_FMT "\n", totalposted);
768
    printf("HTML transferred:       %" APR_INT64_T_FMT " bytes\n", totalbread);
770
    printf("HTML transferred:       %" APR_INT64_T_FMT " bytes\n", totalbread);
769
771
770
    /* avoid divide by zero */
772
    /* avoid divide by zero */
Lines 1048-1057 Link Here
1048
    printf("<tr %s><th colspan=2 %s>Total transferred:</th>"
1050
    printf("<tr %s><th colspan=2 %s>Total transferred:</th>"
1049
       "<td colspan=2 %s>%" APR_INT64_T_FMT " bytes</td></tr>\n",
1051
       "<td colspan=2 %s>%" APR_INT64_T_FMT " bytes</td></tr>\n",
1050
       trstring, tdstring, tdstring, totalread);
1052
       trstring, tdstring, tdstring, totalread);
1051
    if (posting > 0)
1053
    if (posting == 1)
1052
        printf("<tr %s><th colspan=2 %s>Total POSTed:</th>"
1054
        printf("<tr %s><th colspan=2 %s>Total POSTed:</th>"
1053
           "<td colspan=2 %s>%" APR_INT64_T_FMT "</td></tr>\n",
1055
           "<td colspan=2 %s>%" APR_INT64_T_FMT "</td></tr>\n",
1054
           trstring, tdstring, tdstring, totalposted);
1056
           trstring, tdstring, tdstring, totalposted);
1057
    if (posting == 2)
1058
        printf("<tr %s><th colspan=2 %s>Total PUT:</th>"
1059
           "<td colspan=2 %s>%" APR_INT64_T_FMT "</td></tr>\n",
1060
           trstring, tdstring, tdstring, totalposted);
1055
    printf("<tr %s><th colspan=2 %s>HTML transferred:</th>"
1061
    printf("<tr %s><th colspan=2 %s>HTML transferred:</th>"
1056
       "<td colspan=2 %s>%" APR_INT64_T_FMT " bytes</td></tr>\n",
1062
       "<td colspan=2 %s>%" APR_INT64_T_FMT " bytes</td></tr>\n",
1057
       trstring, tdstring, tdstring, totalbread);
1063
       trstring, tdstring, tdstring, totalbread);
Lines 1606-1617 Link Here
1606
    }
1612
    }
1607
    else {
1613
    else {
1608
        snprintf_res = apr_snprintf(request,  sizeof(_request),
1614
        snprintf_res = apr_snprintf(request,  sizeof(_request),
1609
            "POST %s HTTP/1.0\r\n"
1615
            "%s %s HTTP/1.0\r\n"
1610
            "%s" "%s" "%s"
1616
            "%s" "%s" "%s"
1611
            "Content-length: %" APR_SIZE_T_FMT "\r\n"
1617
            "Content-length: %" APR_SIZE_T_FMT "\r\n"
1612
            "Content-type: %s\r\n"
1618
            "Content-type: %s\r\n"
1613
            "%s"
1619
            "%s"
1614
            "\r\n",
1620
            "\r\n",
1621
            (posting == 1) ? "POST" : "PUT",
1615
            (isproxy) ? fullurl : path,
1622
            (isproxy) ? fullurl : path,
1616
            keepalive ? "Connection: Keep-Alive\r\n" : "",
1623
            keepalive ? "Connection: Keep-Alive\r\n" : "",
1617
            cookie, auth,
1624
            cookie, auth,
Lines 1623-1636 Link Here
1623
    }
1630
    }
1624
1631
1625
    if (verbosity >= 2)
1632
    if (verbosity >= 2)
1626
        printf("INFO: POST header == \n---\n%s\n---\n", request);
1633
        printf("INFO: %s header == \n---\n%s\n---\n", 
1634
                (posting == 2) ? "PUT" : "POST", request);
1627
1635
1628
    reqlen = strlen(request);
1636
    reqlen = strlen(request);
1629
1637
1630
    /*
1638
    /*
1631
     * Combine headers and (optional) post file into one contineous buffer
1639
     * Combine headers and (optional) post file into one contineous buffer
1632
     */
1640
     */
1633
    if (posting == 1) {
1641
    if (posting >= 1) {
1634
        char *buff = malloc(postlen + reqlen + 1);
1642
        char *buff = malloc(postlen + reqlen + 1);
1635
        if (!buff) {
1643
        if (!buff) {
1636
            fprintf(stderr, "error creating request buffer: out of memory\n");
1644
            fprintf(stderr, "error creating request buffer: out of memory\n");
Lines 1831-1836 Link Here
1831
    fprintf(stderr, "    -t timelimit    Seconds to max. wait for responses\n");
1839
    fprintf(stderr, "    -t timelimit    Seconds to max. wait for responses\n");
1832
    fprintf(stderr, "    -b windowsize   Size of TCP send/receive buffer, in bytes\n");
1840
    fprintf(stderr, "    -b windowsize   Size of TCP send/receive buffer, in bytes\n");
1833
    fprintf(stderr, "    -p postfile     File containing data to POST. Remember also to set -T\n");
1841
    fprintf(stderr, "    -p postfile     File containing data to POST. Remember also to set -T\n");
1842
    fprintf(stderr, "    -u putfile      File containing data to PUT. Remember also to set -T\n");
1834
    fprintf(stderr, "    -T content-type Content-type header for POSTing, eg.\n");
1843
    fprintf(stderr, "    -T content-type Content-type header for POSTing, eg.\n");
1835
    fprintf(stderr, "                    'application/x-www-form-urlencoded'\n");
1844
    fprintf(stderr, "                    'application/x-www-form-urlencoded'\n");
1836
    fprintf(stderr, "                    Default is 'text/plain'\n");
1845
    fprintf(stderr, "                    Default is 'text/plain'\n");
Lines 2022-2028 Link Here
2022
#endif
2031
#endif
2023
2032
2024
    apr_getopt_init(&opt, cntxt, argc, argv);
2033
    apr_getopt_init(&opt, cntxt, argc, argv);
2025
    while ((status = apr_getopt(opt, "n:c:t:b:T:p:v:rkVhwix:y:z:C:H:P:A:g:X:de:Sq"
2034
    while ((status = apr_getopt(opt, "n:c:t:b:T:p:u:v:rkVhwix:y:z:C:H:P:A:g:X:de:Sq"
2026
#ifdef USE_SSL
2035
#ifdef USE_SSL
2027
            "Z:f:"
2036
            "Z:f:"
2028
#endif
2037
#endif
Lines 2047-2054 Link Here
2047
                windowsize = atoi(optarg);
2056
                windowsize = atoi(optarg);
2048
                break;
2057
                break;
2049
            case 'i':
2058
            case 'i':
2050
                if (posting == 1)
2059
                if (posting > 0)
2051
                err("Cannot mix POST and HEAD\n");
2060
                err("Cannot mix POST/PUT and HEAD\n");
2052
                posting = -1;
2061
                posting = -1;
2053
                break;
2062
                break;
2054
            case 'g':
2063
            case 'g':
Lines 2073-2078 Link Here
2073
                    exit(r);
2082
                    exit(r);
2074
                }
2083
                }
2075
                break;
2084
                break;
2085
            case 'u':
2086
                if (posting != 0)
2087
                    err("Cannot mix PUT and HEAD\n");
2088
                if (0 == (r = open_postfile(optarg))) {
2089
                    posting = 2;
2090
                }
2091
                else if (postdata) {
2092
                    exit(r);
2093
                }
2094
                break;
2076
            case 'r':
2095
            case 'r':
2077
                recverrok = 1;
2096
                recverrok = 1;
2078
                break;
2097
                break;

Return to bug 47788