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

(-)/src/core/org/apache/jmeter/resources/messages.properties (+1 lines)
Lines 923-928 Link Here
923
web_server_client=Client implementation:
924
web_server_client=Client implementation:
924
web_server_domain=Server Name or IP\:
925
web_server_domain=Server Name or IP\:
925
web_server_port=Port Number\:
926
web_server_port=Port Number\:
927
web_testing2_source_ip=Source IP address:
926
web_testing2_title=HTTP Request HTTPClient
928
web_testing2_title=HTTP Request HTTPClient
927
web_testing_embedded_url_pattern=Embedded URLs must match\:
929
web_testing_embedded_url_pattern=Embedded URLs must match\:
928
web_testing_retrieve_images=Retrieve All Embedded Resources from HTML Files
930
web_testing_retrieve_images=Retrieve All Embedded Resources from HTML Files
(-)/src/core/org/apache/jmeter/resources/messages_fr.properties (+1 lines)
Lines 789-794 Link Here
789
web_server_timeout_connect=Connexion \:
789
web_server_timeout_connect=Connexion \:
790
web_server_timeout_response=R\u00E9ponse \:
790
web_server_timeout_response=R\u00E9ponse \:
791
web_server_timeout_title=D\u00E9lai expiration (ms)
791
web_server_timeout_title=D\u00E9lai expiration (ms)
792
web_testing2_source_ip=Adresse IP source \:
792
web_testing2_title=Requ\u00EAte HTTP HTTPClient
793
web_testing2_title=Requ\u00EAte HTTP HTTPClient
793
web_testing_embedded_url_pattern=Les URL \u00E0 inclure doivent correspondre \u00E0 \:
794
web_testing_embedded_url_pattern=Les URL \u00E0 inclure doivent correspondre \u00E0 \:
794
web_testing_retrieve_images=R\u00E9cup\u00E9rer les ressources incluses
795
web_testing_retrieve_images=R\u00E9cup\u00E9rer les ressources incluses
(-)/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/HttpTestSampleGui.java (-2 / +2 lines)
Lines 113-119 Link Here
113
        add(createOptionalTasksPanel(), BorderLayout.SOUTH);
113
        add(createOptionalTasksPanel(), BorderLayout.SOUTH);
114
    }
114
    }
115
115
116
    private JPanel createOptionalTasksPanel() {
116
    protected JPanel createOptionalTasksPanel() {
117
        // OPTIONAL TASKS
117
        // OPTIONAL TASKS
118
        JPanel optionalTasksPanel = new VerticalPanel();
118
        JPanel optionalTasksPanel = new VerticalPanel();
119
        optionalTasksPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), JMeterUtils
119
        optionalTasksPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), JMeterUtils
Lines 134-140 Link Here
134
134
135
        // Embedded URL match regex
135
        // Embedded URL match regex
136
        embeddedRE = new JLabeledTextField(JMeterUtils.getResString("web_testing_embedded_url_pattern"),30); // $NON-NLS-1$
136
        embeddedRE = new JLabeledTextField(JMeterUtils.getResString("web_testing_embedded_url_pattern"),30); // $NON-NLS-1$
137
        optionalTasksPanel.add(embeddedRE);
137
        optionalTasksPanel.add(embeddedRE, BorderLayout.CENTER);
138
        return optionalTasksPanel;
138
        return optionalTasksPanel;
139
    }
139
    }
140
140
(-)/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/HttpTestSampleGui2.java (-1 / +53 lines)
Lines 18-27 Link Here
18
18
19
package org.apache.jmeter.protocol.http.control.gui;
19
package org.apache.jmeter.protocol.http.control.gui;
20
20
21
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerFactory;
21
import java.awt.BorderLayout;
22
import java.awt.Dimension;
23
24
import javax.swing.Box;
25
import javax.swing.JPanel;
26
27
import org.apache.jmeter.protocol.http.sampler.HTTPSampler2;
22
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
28
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
29
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerFactory;
23
import org.apache.jmeter.testelement.TestElement;
30
import org.apache.jmeter.testelement.TestElement;
24
import org.apache.jmeter.util.JMeterUtils;
31
import org.apache.jmeter.util.JMeterUtils;
32
import org.apache.jorphan.gui.JLabeledTextField;
25
33
26
/**
34
/**
27
 * HTTP Sampler GUI for Apache HTTPClient HTTP implementation
35
 * HTTP Sampler GUI for Apache HTTPClient HTTP implementation
Lines 27-32 Link Here
27
 * HTTP Sampler GUI for Apache HTTPClient HTTP implementation
35
 * HTTP Sampler GUI for Apache HTTPClient HTTP implementation
28
 */
36
 */
29
public class HttpTestSampleGui2 extends HttpTestSampleGui {
37
public class HttpTestSampleGui2 extends HttpTestSampleGui {
38
    
39
    private static final long serialVersionUID = 240L;
40
    
41
    private JLabeledTextField sourceIpAddr;
30
42
31
    public HttpTestSampleGui2() {
43
    public HttpTestSampleGui2() {
32
        super();
44
        super();
Lines 51-54 Link Here
51
        return super.getStaticLabel().replace(' ', '_'); // $NON-NLS-1$  // $NON-NLS-2$
63
        return super.getStaticLabel().replace(' ', '_'); // $NON-NLS-1$  // $NON-NLS-2$
52
    }
64
    }
53
65
66
    @Override
67
    protected JPanel createOptionalTasksPanel() {
68
        JPanel optionalTasksPanel = super.createOptionalTasksPanel();
69
        // Add a new field source ip address
70
        sourceIpAddr = new JLabeledTextField(JMeterUtils
71
                .getResString("web_testing2_source_ip"), 15); // $NON-NLS-1$
72
        optionalTasksPanel.add(sourceIpAddr, BorderLayout.EAST);
73
        
74
        return optionalTasksPanel;
75
    }
76
    
77
    /* (non-Javadoc)
78
     * @see org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui#clearGui()
79
     */
80
    @Override
81
    public void clearGui() {
82
        super.clearGui();
83
        sourceIpAddr.setText(""); // $NON-NLS-1$
84
    }
85
86
    /* (non-Javadoc)
87
     * @see org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui#configure(org.apache.jmeter.testelement.TestElement)
88
     */
89
    @Override
90
    public void configure(TestElement element) {
91
        super.configure(element);
92
        final HTTPSampler2 samplerBase = (HTTPSampler2) element;
93
        sourceIpAddr.setText(samplerBase.getIpSource());
94
    }
95
96
    /* (non-Javadoc)
97
     * @see org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui#modifyTestElement(org.apache.jmeter.testelement.TestElement)
98
     */
99
    @Override
100
    public void modifyTestElement(TestElement sampler) {
101
        // TODO Auto-generated method stub
102
        super.modifyTestElement(sampler);
103
        final HTTPSampler2 samplerBase = (HTTPSampler2) sampler;
104
        samplerBase.setIpSource(sourceIpAddr.getText());
105
    }
54
}
106
}
(-)/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java (+15 lines)
Lines 119-124 Link Here
119
119
120
    private static final String PROXY_DOMAIN =
120
    private static final String PROXY_DOMAIN =
121
        JMeterUtils.getPropDefault("http.proxyDomain",""); // $NON-NLS-1$ $NON-NLS-2$
121
        JMeterUtils.getPropDefault("http.proxyDomain",""); // $NON-NLS-1$ $NON-NLS-2$
122
    
123
    public static final String IP_SOURCE = "HTTPSampler.ipSource"; // $NON-NLS-1$
122
124
123
    static final InetAddress localAddress;
125
    static final InetAddress localAddress;
124
126
Lines 536-541 Link Here
536
        // Set up the local address if one exists
538
        // Set up the local address if one exists
537
        if (localAddress != null){
539
        if (localAddress != null){
538
            hc.setLocalAddress(localAddress);
540
            hc.setLocalAddress(localAddress);
541
        } // Use special field ip source address (for pseudo 'ip spoofing') 
542
        else if (getIpSource() != null && getIpSource().length() > 0) {
543
            InetAddress inetAddr = InetAddress.getByName(getIpSource());
544
            hc.setLocalAddress(inetAddr);
539
        }
545
        }
540
546
541
        boolean useStaticProxy = PROXY_DEFINED && !isNonProxy(host);
547
        boolean useStaticProxy = PROXY_DEFINED && !isNonProxy(host);
Lines 1162-1165 Link Here
1162
        }
1168
        }
1163
        return client != null;
1169
        return client != null;
1164
    }
1170
    }
1171
1172
    
1173
    public void setIpSource(String value) {
1174
        setProperty(IP_SOURCE, value);
1175
    }
1176
1177
    public String getIpSource() {
1178
        return getPropertyAsString(IP_SOURCE);
1179
    }
1165
}
1180
}
(-)/xdocs/usermanual/component_reference.xml (-1 / +11 lines)
Lines 81-87 Link Here
81
81
82
</component>
82
</component>
83
83
84
<component name="HTTP Request" index="&sect-num;.1.2"  width="730" height="618" screenshot="webtest/http-request.png">
84
<component name="HTTP Request" index="&sect-num;.1.2"  width="735" height="646" screenshot="webtest/http-request.png">
85
85
86
<description>
86
<description>
87
        <p>This sampler lets you send an HTTP/HTTPS request to a web server.  It
87
        <p>This sampler lets you send an HTTP/HTTPS request to a web server.  It
Lines 176-181 Link Here
176
        <property name="Port" required="No">Port the web server is listening to. Default: 80</property>
176
        <property name="Port" required="No">Port the web server is listening to. Default: 80</property>
177
        <property name="Connect Timeout" required="No">Connection Timeout. Number of milliseconds to wait for a connection to open.</property>
177
        <property name="Connect Timeout" required="No">Connection Timeout. Number of milliseconds to wait for a connection to open.</property>
178
        <property name="Response Timeout" required="No">Response Timeout. Number of milliseconds to wait for a response.</property>
178
        <property name="Response Timeout" required="No">Response Timeout. Number of milliseconds to wait for a response.</property>
179
        <property name="Server (proxy)" required="No">Hostname or IP address of a proxy server to perform request. [Do not include the http:// prefix.]</property>
180
        <property name="Port" required="No">Port the proxy server is listening to.</property>
181
        <property name="Username" required="No">(Optional) username to login proxy server.</property>
182
        <property name="Password" required="No">(Optional) password to login proxy server.</property>
179
        <property name="Protocol" required="No">HTTP, HTTPS or FILE. Default: HTTP</property>
183
        <property name="Protocol" required="No">HTTP, HTTPS or FILE. Default: HTTP</property>
180
        <property name="Method" required="Yes">GET, POST, HEAD, TRACE, OPTIONS, PUT, DELETE</property>
184
        <property name="Method" required="Yes">GET, POST, HEAD, TRACE, OPTIONS, PUT, DELETE</property>
181
        <property name="Content Encoding" required="No">Content encoding to be used (for POST and FILE)</property>
185
        <property name="Content Encoding" required="No">Content encoding to be used (for POST and FILE)</property>
Lines 252-257 Link Here
252
        So if you only want to download embedded resources from http://example.com/, use the expression:
256
        So if you only want to download embedded resources from http://example.com/, use the expression:
253
        http://example\.com/.*
257
        http://example\.com/.*
254
        </property>
258
        </property>
259
        <property name="Source IP address:" required="No">
260
        [Only on HTTP Request HTTPClient] Permit to define a specific source IP address  on the HTTP request. 
261
        Combine with a CSV Data Set Config element which have several valid sources IP addresses, this allow
262
         to create some test plan with several source IP address. To do this, the JMeter machine must have 
263
         several IP aliasing or network interfaces with allowed ip addresses on network.
264
        </property>
255
</properties>
265
</properties>
256
<p>
266
<p>
257
<b>N.B.</b> when using Automatic Redirection, cookies are only sent for the initial URL.
267
<b>N.B.</b> when using Automatic Redirection, cookies are only sent for the initial URL.

Return to bug 48300