Return-Path: Delivered-To: apmail-jakarta-httpclient-commits-archive@www.apache.org Received: (qmail 32115 invoked from network); 21 May 2006 19:53:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 21 May 2006 19:53:44 -0000 Received: (qmail 53219 invoked by uid 500); 21 May 2006 19:53:44 -0000 Mailing-List: contact httpclient-commits-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: httpclient-dev@jakarta.apache.org Delivered-To: mailing list httpclient-commits@jakarta.apache.org Received: (qmail 53207 invoked by uid 99); 21 May 2006 19:53:44 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 21 May 2006 12:53:44 -0700 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 21 May 2006 12:53:43 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 51CE01A983A; Sun, 21 May 2006 12:53:23 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r408474 - /jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/HttpBenchmark.java Date: Sun, 21 May 2006 19:53:22 -0000 To: httpclient-commits@jakarta.apache.org From: olegk@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060521195323.51CE01A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: olegk Date: Sun May 21 12:53:22 2006 New Revision: 408474 URL: http://svn.apache.org/viewvc?rev=408474&view=rev Log: Added CLI option to add an arbitrary header line(s) Modified: jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/HttpBenchmark.java Modified: jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/HttpBenchmark.java URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/HttpBenchmark.java?rev=408474&r1=408473&r2=408474&view=diff ============================================================================== --- jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/HttpBenchmark.java (original) +++ jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/HttpBenchmark.java Sun May 21 12:53:22 2006 @@ -117,9 +117,16 @@ Topt.setRequired(false); Topt.setArgName("content-type"); - Option vopt = new Option("v", true, "Set verbosity level - 4 and above prints " + - "information on headers, 3 and above prints response codes (404, 200, " + - "etc.), 2 and above prints warnings and info."); + Option Hopt = new Option("H", true, "Add arbitrary header line, " + + "eg. 'Accept-Encoding: gzip' inserted after all normal " + + "header lines. (repeatable)"); + Hopt.setRequired(false); + Hopt.setArgName("header"); + + Option vopt = new Option("v", true, "Set verbosity level - 4 and above " + + "prints response content, 3 and above prints " + + "information on headers, 2 and above prints response codes (404, 200, " + + "etc.), 1 and above prints warnings and info."); vopt.setRequired(false); vopt.setArgName("verbosity"); @@ -133,6 +140,7 @@ options.addOption(popt); options.addOption(Topt); options.addOption(vopt); + options.addOption(Hopt); options.addOption(hopt); if (args.length == 0) { @@ -176,7 +184,7 @@ System.exit(-1); } } - + args = cmd.getArgs(); if (args.length != 1) { showUsage(options); @@ -226,6 +234,20 @@ } if (!keepAlive) { request.addHeader(new Header(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE)); + } + + if(cmd.hasOption('H')) { + String[] strs = cmd.getOptionValues('H'); + for (int i = 0; i < strs.length; i++) { + String s = strs[i]; + int pos = s.indexOf(':'); + if (pos != -1) { + Header header = new Header( + s.substring(0, pos).trim(), + s.substring(pos + 1)); + request.addHeader(header); + } + } } // Prepare request executor