kcassell    2003/03/04 11:28:17

  Modified:    src/protocol/http/org/apache/jmeter/protocol/http/sampler
                        HTTPSampler.java
  Log:
  Changes so that a default port specified in the HTTPDefaults object
  won't appear in an HTTPRequest generated by the HTTPRoxyServer.
  
  Revision  Changes    Path
  1.24      +12 -9     
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java
  
  Index: HTTPSampler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- HTTPSampler.java  20 Feb 2003 02:59:16 -0000      1.23
  +++ HTTPSampler.java  4 Mar 2003 19:28:17 -0000       1.24
  @@ -2,7 +2,7 @@
    * ====================================================================
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -123,6 +123,9 @@
       public final static String NORMAL_FORM = "normal_form";
       public final static String MULTIPART_FORM = "multipart_form";
       public final static String ENCODED_PATH = "HTTPSampler.encoded_path";
  +    
  +    /** A number to indicate that the port has not been set.  **/
  +    public static final int UNSPECIFIED_PORT = 0;
       private static final int MAX_REDIRECTS = 10;
       protected static String encoding = "iso-8859-1";
       private static final PostWriter postWriter = new PostWriter();
  @@ -279,7 +282,7 @@
       public int getPort()
       {
           int port = getPropertyAsInt(PORT);
  -        if (port == 0)
  +        if (port == UNSPECIFIED_PORT)
           {
               if ("https".equalsIgnoreCase(getProtocol()))
               {
  @@ -465,7 +468,7 @@
           {
               pathAndQuery = "/" + pathAndQuery;
           }
  -        if (getPort() == 0)
  +        if (getPort() == UNSPECIFIED_PORT)
           {
               return new URL(getProtocol(), getDomain(), pathAndQuery);
           }
  @@ -891,8 +894,8 @@
        *
        [EMAIL PROTECTED] e           <code>Entry</code> to be sampled
        [EMAIL PROTECTED] redirects   the level of redirection we're processing (0 
means
  -     *                       original request) -- just used to prevent
  -     *                       an infinite loop.
  +     *                  original request) -- just used to prevent
  +     *                  an infinite loop.
        [EMAIL PROTECTED]            results of the sampling
        ***************************************/
       private SampleResult sample(int redirects)
  @@ -976,7 +979,7 @@
           catch (IOException ex)
           {
               log.warn(ex.getMessage(), ex);
  -            res.setDataType(res.TEXT);
  +            res.setDataType(SampleResult.TEXT);
               res.setResponseData(ex.toString().getBytes());
               res.setResponseCode(NON_HTTP_RESPONSE_CODE);
               res.setResponseMessage(NON_HTTP_RESPONSE_MESSAGE);
  @@ -1003,7 +1006,7 @@
       }
       private long bundleResponseInResult(long time, SampleResult res, 
HttpURLConnection conn) throws IOException, FileNotFoundException
       {
  -        res.setDataType(res.TEXT);
  +        res.setDataType(SampleResult.TEXT);
           byte[] ret = readResponse(conn);
           byte[] head = getResponseHeaders(conn, res);
           time = System.currentTimeMillis() - time;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to