You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by "Damien.Garrido" <Da...@gmail.com> on 2013/02/20 17:46:16 UTC

How to send relative URL in the HTTP Request sampler ?

Hello,

I need some help regarding the use of the /HTTP Request sampler/.
I'm trying to send a POST HTTP request to a virtual host with a relative
URI.
I'm not sure if I'm able to do this with JMeter...

More precisely, what Id' like to do is to send to the IP address
123.456.789.012:

*POST /my_path/to/the_file HTTP/1.1
Host: server.domain.com
*
instead of

*POST http://server.domain.com/my_path/to/the_file HTTP/1.1
Host: server.domain.com
*
Any help much appreciated !




--
View this message in context: http://jmeter.512774.n5.nabble.com/How-to-send-relative-URL-in-the-HTTP-Request-sampler-tp5716187.html
Sent from the JMeter - User mailing list archive at Nabble.com.

Re: How to send relative URL in the HTTP Request sampler ?

Posted by sebb <se...@gmail.com>.
On 22 February 2013 18:59, Damien Garrido <da...@gmail.com> wrote:
> As per my understanding of the RFC, it should accept absolute path (what I
> used to call a relative URI, but which is an agregate of absolute path,
> relative path and net path) :
>
> *5.1)*
>
>         Request-Line   = Method SP Request-URI SP HTTP-Version CRLF
>
>
> *5.1.1)*
>
> Method         = "OPTIONS"                ; Section 9.2
> <http://tools.ietf.org/html/rfc2616#section-9.2>
>                       | "GET"                    ; Section 9.3
> <http://tools.ietf.org/html/rfc2616#section-9.3>
>                       | "HEAD"                   ; Section 9.4
> <http://tools.ietf.org/html/rfc2616#section-9.4>
>                       | "POST"                   ; Section 9.5
> <http://tools.ietf.org/html/rfc2616#section-9.5>
>                       | "PUT"                    ; Section 9.6
> <http://tools.ietf.org/html/rfc2616#section-9.6>
>                       | "DELETE"                 ; Section 9.7
> <http://tools.ietf.org/html/rfc2616#section-9.7>
>                       | "TRACE"                  ; Section 9.8
> <http://tools.ietf.org/html/rfc2616#section-9.8>
>                       | "CONNECT"                ; Section 9.9
> <http://tools.ietf.org/html/rfc2616#section-9.9>
>                       | extension-method
>        extension-method = token
>
>
> So let's pick for example the "POST" method.
>
> *5.1.2)*
>
>       Request-URI    = "*" | absoluteURI | *abs_path* | authority
>
>
> So l let the common absoluteURI alone which is working, and I pick the*abs_path
> *.
>
> The definition of abs_path is taken, according to paragraph 3.2.1, from the
> RFC 2396.
> This RFC 2396 defines it as :
>
> abs_path      = "/"  path_segments
>
> path_segments = segment *( "/" segment )
> segment       = *pchar *( ";" param )
> param         = *pchar
> pchar         = unreserved | escaped |
>                 ":" | "@" | "&" | "=" | "+" | "$" | ","
>
> unreserved  = alphanum | mark
> mark        = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"
>
> escaped     = "%" hex hex
> hex         = digit | "A" | "B" | "C" | "D" | "E" | "F" |
>                       "a" | "b" | "c" | "d" | "e" | "f"
>
> The RFC 3986, which obsoletes the RFC 2396, replace abs_path with path-absolute
> which is defined as:
>
> path-absolute = "/" [ segment-nz *( "/" segment ) ]
>
> segment       = *pchar
> segment-nz    = 1*pchar
> segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" )
>                     ; non-zero-length segment without any colon ":"
> pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"
>
> Which are both definitions of an absolute path, so, I should be able to use
> an absolute path (and not a relative URI sorry about that) as a Request-URI,
> shouldn't I ?

Yes, and that is what the mirror server shows me:

GET /abcd/def HTTP/1.1

Try it and see.

> Thanks for reading.
>
> 2013/2/22 sebb <se...@gmail.com>
>
>> On 22 February 2013 17:09, Damien Garrido <da...@gmail.com>
>> wrote:
>> > 2013/2/22 sebb <se...@gmail.com>
>> >
>> >> On 22 February 2013 15:49, Damien.Garrido <
>> Damien.Garrido.Work@gmail.com>
>> >> wrote:
>> >> > Is JMeter compliant with the 2616 (Hyper Text Protocol -- HTTP/1.1)
>> and
>> >> 3986
>> >> > (Uniform Resource Identifier (URI): Generic Syntax) RFCs ?
>> >>
>> >> JMeter uses 3 different external HTTP implementations:
>> >> - Java
>> >> - Apache HttpClient 3.1
>> >> - Apache HttpComponents 4.x
>> >>
>> >> AFAIK these are RFC compliant.
>> >>
>> >> I meant: let me use a relative URI instead of forcing me using an
>> absolute
>> > URL.
>>
>> But are relative URIs spec compliant?
>>
>> According to RFC 2616 they are only used for Content-Location and Referer.
>>
>> > I haven't used those implementation enough to say that they will let me
>> use
>> > a relative URI or not, and I haven't tested it yet, but I had a look at
>> the
>> >  implementation of JMeter, and it is using intensively the URL Java class
>> > and not the URI Java class.
>> > This URL class forces the scheme and hostname to be present, so I would
>> say
>> > that it not possible to use relative URI unless if some or all URL
>> classes
>> > are changed by URI classes in the JMeter source code... Or it does not
>> come
>> > from that point, and something else I haven't thought of yet is hassling
>> > me! :/
>> >
>> >> Is it possible to specify in the Request-Line of the HTTP request, an
>> >> > abs_path (or path-absolute) form of a Request-URI as specified in the
>> >> > paragraph 5.1.2 of the RFC 2616 ?
>> >>
>> >> Yes, though not directly, as JMeter does not create the request
>> directly.
>> >> The HTTP request is built by the HTTP implementation from the
>> >> parameters JMeter provides, which in turn are provided by the test
>> >> script.
>> >>
>> >> You can see the request in the Tree View Listener.
>> >> Or use the Mirror Server to see exactly what is sent.
>> >>
>> > I saw in this Tree View Listerner that JMeter is sending a full URI,
>> (and I
>> > also checked with Wireshark...)
>> >
>> >>
>> >
>> > It looks like they all provide abs_path requests, for example:
>> >>
>> >> GET /abcd/def HTTP/1.1
>> >> Host: a.b.c
>> >>
>> > I have to find what prevents me to get what you got...
>> >
>> >>
>> >> You can use the Header Manager to override the Host: header.
>> >>
>> > I'm already using this Header Manager to override the Host header, but it
>> > seems that Apache isn't routing to the right virtual host if the URI is
>> > absolute, or I'm missing something...
>> >
>> >>
>> >>
>> >> Should I post on the dev mailing-list ?
>> >>
>> >> No.
>> >>
>> > Ok. :)
>> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>> >> For additional commands, e-mail: user-help@jmeter.apache.org
>> >>
>> >>
>> > Thanks for your reply anyway !
>> >
>> > --
>> > Damien Garrido
>> > Sogeti High Tech
>> > Mobile:+33 (0)6 15 077 001
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>> For additional commands, e-mail: user-help@jmeter.apache.org
>>
>>
>
>
> --
> Damien Garrido
> Sogeti High Tech
> Mobile:+33 (0)6 15 077 001

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Re: How to send relative URL in the HTTP Request sampler ?

Posted by Damien Garrido <da...@gmail.com>.
As per my understanding of the RFC, it should accept absolute path (what I
used to call a relative URI, but which is an agregate of absolute path,
relative path and net path) :

*5.1)*

        Request-Line   = Method SP Request-URI SP HTTP-Version CRLF


*5.1.1)*

Method         = "OPTIONS"                ; Section 9.2
<http://tools.ietf.org/html/rfc2616#section-9.2>
                      | "GET"                    ; Section 9.3
<http://tools.ietf.org/html/rfc2616#section-9.3>
                      | "HEAD"                   ; Section 9.4
<http://tools.ietf.org/html/rfc2616#section-9.4>
                      | "POST"                   ; Section 9.5
<http://tools.ietf.org/html/rfc2616#section-9.5>
                      | "PUT"                    ; Section 9.6
<http://tools.ietf.org/html/rfc2616#section-9.6>
                      | "DELETE"                 ; Section 9.7
<http://tools.ietf.org/html/rfc2616#section-9.7>
                      | "TRACE"                  ; Section 9.8
<http://tools.ietf.org/html/rfc2616#section-9.8>
                      | "CONNECT"                ; Section 9.9
<http://tools.ietf.org/html/rfc2616#section-9.9>
                      | extension-method
       extension-method = token


So let's pick for example the "POST" method.

*5.1.2)*

      Request-URI    = "*" | absoluteURI | *abs_path* | authority


So l let the common absoluteURI alone which is working, and I pick the*abs_path
*.

The definition of abs_path is taken, according to paragraph 3.2.1, from the
RFC 2396.
This RFC 2396 defines it as :

abs_path      = "/"  path_segments

path_segments = segment *( "/" segment )
segment       = *pchar *( ";" param )
param         = *pchar
pchar         = unreserved | escaped |
                ":" | "@" | "&" | "=" | "+" | "$" | ","

unreserved  = alphanum | mark
mark        = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"

escaped     = "%" hex hex
hex         = digit | "A" | "B" | "C" | "D" | "E" | "F" |
                      "a" | "b" | "c" | "d" | "e" | "f"

The RFC 3986, which obsoletes the RFC 2396, replace abs_path with path-absolute
which is defined as:

path-absolute = "/" [ segment-nz *( "/" segment ) ]

segment       = *pchar
segment-nz    = 1*pchar
segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" )
                    ; non-zero-length segment without any colon ":"
pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"

Which are both definitions of an absolute path, so, I should be able to use
an absolute path (and not a relative URI sorry about that) as a Request-URI,
shouldn't I ?

Thanks for reading.

2013/2/22 sebb <se...@gmail.com>

> On 22 February 2013 17:09, Damien Garrido <da...@gmail.com>
> wrote:
> > 2013/2/22 sebb <se...@gmail.com>
> >
> >> On 22 February 2013 15:49, Damien.Garrido <
> Damien.Garrido.Work@gmail.com>
> >> wrote:
> >> > Is JMeter compliant with the 2616 (Hyper Text Protocol -- HTTP/1.1)
> and
> >> 3986
> >> > (Uniform Resource Identifier (URI): Generic Syntax) RFCs ?
> >>
> >> JMeter uses 3 different external HTTP implementations:
> >> - Java
> >> - Apache HttpClient 3.1
> >> - Apache HttpComponents 4.x
> >>
> >> AFAIK these are RFC compliant.
> >>
> >> I meant: let me use a relative URI instead of forcing me using an
> absolute
> > URL.
>
> But are relative URIs spec compliant?
>
> According to RFC 2616 they are only used for Content-Location and Referer.
>
> > I haven't used those implementation enough to say that they will let me
> use
> > a relative URI or not, and I haven't tested it yet, but I had a look at
> the
> >  implementation of JMeter, and it is using intensively the URL Java class
> > and not the URI Java class.
> > This URL class forces the scheme and hostname to be present, so I would
> say
> > that it not possible to use relative URI unless if some or all URL
> classes
> > are changed by URI classes in the JMeter source code... Or it does not
> come
> > from that point, and something else I haven't thought of yet is hassling
> > me! :/
> >
> >> Is it possible to specify in the Request-Line of the HTTP request, an
> >> > abs_path (or path-absolute) form of a Request-URI as specified in the
> >> > paragraph 5.1.2 of the RFC 2616 ?
> >>
> >> Yes, though not directly, as JMeter does not create the request
> directly.
> >> The HTTP request is built by the HTTP implementation from the
> >> parameters JMeter provides, which in turn are provided by the test
> >> script.
> >>
> >> You can see the request in the Tree View Listener.
> >> Or use the Mirror Server to see exactly what is sent.
> >>
> > I saw in this Tree View Listerner that JMeter is sending a full URI,
> (and I
> > also checked with Wireshark...)
> >
> >>
> >
> > It looks like they all provide abs_path requests, for example:
> >>
> >> GET /abcd/def HTTP/1.1
> >> Host: a.b.c
> >>
> > I have to find what prevents me to get what you got...
> >
> >>
> >> You can use the Header Manager to override the Host: header.
> >>
> > I'm already using this Header Manager to override the Host header, but it
> > seems that Apache isn't routing to the right virtual host if the URI is
> > absolute, or I'm missing something...
> >
> >>
> >>
> >> Should I post on the dev mailing-list ?
> >>
> >> No.
> >>
> > Ok. :)
> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> >> For additional commands, e-mail: user-help@jmeter.apache.org
> >>
> >>
> > Thanks for your reply anyway !
> >
> > --
> > Damien Garrido
> > Sogeti High Tech
> > Mobile:+33 (0)6 15 077 001
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>


-- 
Damien Garrido
Sogeti High Tech
Mobile:+33 (0)6 15 077 001

Re: How to send relative URL in the HTTP Request sampler ?

Posted by sebb <se...@gmail.com>.
On 22 February 2013 17:09, Damien Garrido <da...@gmail.com> wrote:
> 2013/2/22 sebb <se...@gmail.com>
>
>> On 22 February 2013 15:49, Damien.Garrido <Da...@gmail.com>
>> wrote:
>> > Is JMeter compliant with the 2616 (Hyper Text Protocol -- HTTP/1.1) and
>> 3986
>> > (Uniform Resource Identifier (URI): Generic Syntax) RFCs ?
>>
>> JMeter uses 3 different external HTTP implementations:
>> - Java
>> - Apache HttpClient 3.1
>> - Apache HttpComponents 4.x
>>
>> AFAIK these are RFC compliant.
>>
>> I meant: let me use a relative URI instead of forcing me using an absolute
> URL.

But are relative URIs spec compliant?

According to RFC 2616 they are only used for Content-Location and Referer.

> I haven't used those implementation enough to say that they will let me use
> a relative URI or not, and I haven't tested it yet, but I had a look at the
>  implementation of JMeter, and it is using intensively the URL Java class
> and not the URI Java class.
> This URL class forces the scheme and hostname to be present, so I would say
> that it not possible to use relative URI unless if some or all URL classes
> are changed by URI classes in the JMeter source code... Or it does not come
> from that point, and something else I haven't thought of yet is hassling
> me! :/
>
>> Is it possible to specify in the Request-Line of the HTTP request, an
>> > abs_path (or path-absolute) form of a Request-URI as specified in the
>> > paragraph 5.1.2 of the RFC 2616 ?
>>
>> Yes, though not directly, as JMeter does not create the request directly.
>> The HTTP request is built by the HTTP implementation from the
>> parameters JMeter provides, which in turn are provided by the test
>> script.
>>
>> You can see the request in the Tree View Listener.
>> Or use the Mirror Server to see exactly what is sent.
>>
> I saw in this Tree View Listerner that JMeter is sending a full URI, (and I
> also checked with Wireshark...)
>
>>
>
> It looks like they all provide abs_path requests, for example:
>>
>> GET /abcd/def HTTP/1.1
>> Host: a.b.c
>>
> I have to find what prevents me to get what you got...
>
>>
>> You can use the Header Manager to override the Host: header.
>>
> I'm already using this Header Manager to override the Host header, but it
> seems that Apache isn't routing to the right virtual host if the URI is
> absolute, or I'm missing something...
>
>>
>>
>> Should I post on the dev mailing-list ?
>>
>> No.
>>
> Ok. :)
>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>> For additional commands, e-mail: user-help@jmeter.apache.org
>>
>>
> Thanks for your reply anyway !
>
> --
> Damien Garrido
> Sogeti High Tech
> Mobile:+33 (0)6 15 077 001

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Re: How to send relative URL in the HTTP Request sampler ?

Posted by Damien Garrido <da...@gmail.com>.
2013/2/22 sebb <se...@gmail.com>

> On 22 February 2013 15:49, Damien.Garrido <Da...@gmail.com>
> wrote:
> > Is JMeter compliant with the 2616 (Hyper Text Protocol -- HTTP/1.1) and
> 3986
> > (Uniform Resource Identifier (URI): Generic Syntax) RFCs ?
>
> JMeter uses 3 different external HTTP implementations:
> - Java
> - Apache HttpClient 3.1
> - Apache HttpComponents 4.x
>
> AFAIK these are RFC compliant.
>
> I meant: let me use a relative URI instead of forcing me using an absolute
URL.
I haven't used those implementation enough to say that they will let me use
a relative URI or not, and I haven't tested it yet, but I had a look at the
 implementation of JMeter, and it is using intensively the URL Java class
and not the URI Java class.
This URL class forces the scheme and hostname to be present, so I would say
that it not possible to use relative URI unless if some or all URL classes
are changed by URI classes in the JMeter source code... Or it does not come
from that point, and something else I haven't thought of yet is hassling
me! :/

> Is it possible to specify in the Request-Line of the HTTP request, an
> > abs_path (or path-absolute) form of a Request-URI as specified in the
> > paragraph 5.1.2 of the RFC 2616 ?
>
> Yes, though not directly, as JMeter does not create the request directly.
> The HTTP request is built by the HTTP implementation from the
> parameters JMeter provides, which in turn are provided by the test
> script.
>
> You can see the request in the Tree View Listener.
> Or use the Mirror Server to see exactly what is sent.
>
I saw in this Tree View Listerner that JMeter is sending a full URI, (and I
also checked with Wireshark...)

>

It looks like they all provide abs_path requests, for example:
>
> GET /abcd/def HTTP/1.1
> Host: a.b.c
>
I have to find what prevents me to get what you got...

>
> You can use the Header Manager to override the Host: header.
>
I'm already using this Header Manager to override the Host header, but it
seems that Apache isn't routing to the right virtual host if the URI is
absolute, or I'm missing something...

>
>
> Should I post on the dev mailing-list ?
>
> No.
>
Ok. :)

>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>
Thanks for your reply anyway !

-- 
Damien Garrido
Sogeti High Tech
Mobile:+33 (0)6 15 077 001

Re: How to send relative URL in the HTTP Request sampler ?

Posted by sebb <se...@gmail.com>.
On 22 February 2013 15:49, Damien.Garrido <Da...@gmail.com> wrote:
> Is JMeter compliant with the 2616 (Hyper Text Protocol -- HTTP/1.1) and 3986
> (Uniform Resource Identifier (URI): Generic Syntax) RFCs ?

JMeter uses 3 different external HTTP implementations:
- Java
- Apache HttpClient 3.1
- Apache HttpComponents 4.x

AFAIK these are RFC compliant.

> Is it possible to specify in the Request-Line of the HTTP request, an
> abs_path (or path-absolute) form of a Request-URI as specified in the
> paragraph 5.1.2 of the RFC 2616 ?

Yes, though not directly, as JMeter does not create the request directly.
The HTTP request is built by the HTTP implementation from the
parameters JMeter provides, which in turn are provided by the test
script.

You can see the request in the Tree View Listener.
Or use the Mirror Server to see exactly what is sent.

It looks like they all provide abs_path requests, for example:

GET /abcd/def HTTP/1.1
Host: a.b.c

You can use the Header Manager to override the Host: header.

> Should I post on the dev mailing-list ?

No.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Re: How to send relative URL in the HTTP Request sampler ?

Posted by "Damien.Garrido" <Da...@gmail.com>.
Is JMeter compliant with the 2616 (Hyper Text Protocol -- HTTP/1.1) and 3986
(Uniform Resource Identifier (URI): Generic Syntax) RFCs ?

Is it possible to specify in the Request-Line of the HTTP request, an
abs_path (or path-absolute) form of a Request-URI as specified in the
paragraph 5.1.2 of the RFC 2616 ?

Should I post on the dev mailing-list ?



--
View this message in context: http://jmeter.512774.n5.nabble.com/How-to-send-relative-URL-in-the-HTTP-Request-sampler-tp5716187p5716211.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org