Permalink
Browse files

Merge branch 'master' of git.process-one.net:tsung/mainline

Conflicts:
	src/tsung_stats.pl.in
	tsung-1.0.dtd
  • Loading branch information...
2 parents f684964 + 6464f42 commit 11c9caaeea03fd2560e248e3add8f7fb59710133 @nniclausse nniclausse committed Sep 11, 2012
Showing with 3,197 additions and 215 deletions.
  1. +6 −1 Makefile.in
  2. +9 −9 configure
  3. +81 −4 doc/user_manual.html
  4. +68 −5 doc/user_manual.tex
  5. +57 −0 examples/http-digest.xml.in
  6. +68 −0 examples/http-oauth.xml.in
  7. +12 −1 include/ts_http.hrl
  8. +0 −1 include/ts_jabber.hrl
  9. +299 −0 src/lib/mochiweb_headers.erl
  10. +486 −0 src/lib/mochiweb_util.erl
  11. +139 −0 src/lib/oauth.erl
  12. +35 −0 src/lib/oauth_hmac_sha1.erl
  13. +52 −0 src/lib/oauth_http.erl
  14. +34 −0 src/lib/oauth_plaintext.erl
  15. +55 −0 src/lib/oauth_rsa_sha1.erl
  16. +39 −0 src/lib/oauth_unix.erl
  17. +128 −0 src/lib/oauth_uri.erl
  18. +8 −0 src/templates/graph.thtml
  19. +26 −1 src/test/ts_test_http.erl
  20. +0 −4 src/test/ts_test_recorder.erl
  21. +37 −0 src/tsung/gen_ts_transport.erl
  22. +552 −0 src/tsung/ts_bosh.erl
  23. +51 −0 src/tsung/ts_bosh_ssl.erl
  24. +61 −112 src/tsung/ts_client.erl
  25. +26 −1 src/tsung/ts_erlang.erl
  26. +15 −4 src/tsung/ts_http.erl
  27. +67 −11 src/tsung/ts_http_common.erl
  28. +23 −6 src/tsung/ts_jabber.erl
  29. +10 −1 src/tsung/ts_jabber_common.erl
  30. +94 −0 src/tsung/ts_search.erl
  31. +48 −0 src/tsung/ts_ssl.erl
  32. +62 −0 src/tsung/ts_ssl6.erl
  33. +70 −0 src/tsung/ts_tcp.erl
  34. +56 −0 src/tsung/ts_tcp6.erl
  35. +66 −0 src/tsung/ts_udp.erl
  36. +57 −0 src/tsung/ts_udp6.erl
  37. +3 −12 src/tsung/ts_utils.erl
  38. +146 −0 src/tsung/ts_websocket.erl
  39. +21 −20 src/tsung_controller/ts_config.erl
  40. +66 −13 src/tsung_controller/ts_config_http.erl
  41. +23 −1 src/tsung_controller/ts_config_server.erl
  42. +9 −1 src/tsung_recorder/ts_client_proxy.erl
  43. +3 −2 src/tsung_recorder/ts_proxy_listener.erl
  44. +8 −0 src/tsung_stats.pl.in
  45. +20 −4 tsung-1.0.dtd
  46. +1 −1 vsn.mk
View
@@ -82,7 +82,7 @@ MAN_DIR = $(datadir)/man/man1/
DOC_DIR = $(docdir)
# custom behaviours
-BEHAVIORS = ebin/ts_plugin.beam
+BEHAVIORS = ebin/ts_plugin.beam ebin/gen_ts_transport.beam
BUILDER_LOG = /tmp/builder-tsung.log
@@ -436,6 +436,11 @@ ebin/ts_plugin.beam: src/$(APPLICATION)/ts_plugin.erl $(INC_FILES)
@echo "Compiling $< ... "
@$(CC) $(OPT) -I $(INC) -I $(ERLANG_XMERL_DIR) -pa ebin -o ebin $<
+# to avoid circular dependency
+ebin/gen_ts_transport.beam: src/$(APPLICATION)/gen_ts_transport.erl $(INC_FILES)
+ @echo "Compiling $< ... "
+ @$(CC) $(OPT) -I $(INC) -I $(ERLANG_XMERL_DIR) -pa ebin -o ebin $<
+
ebin/%.beam: src/$(APPLICATION)/%.erl $(INC_FILES) $(BEHAVIORS)
@echo "Compiling $< ... "
@$(CC) $(OPT) -I $(INC) -I $(ERLANG_XMERL_DIR) -pa ebin -o ebin $<
View
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for tsung 1.4.3a.
+# Generated by GNU Autoconf 2.68 for tsung 1.5.0a.
#
# Report bugs to <tsung-users@process-one.net>.
#
@@ -561,8 +561,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='tsung'
PACKAGE_TARNAME='tsung'
-PACKAGE_VERSION='1.4.3a'
-PACKAGE_STRING='tsung 1.4.3a'
+PACKAGE_VERSION='1.5.0a'
+PACKAGE_STRING='tsung 1.5.0a'
PACKAGE_BUGREPORT='tsung-users@process-one.net'
PACKAGE_URL=''
@@ -1188,7 +1188,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures tsung 1.4.3a to adapt to many kinds of systems.
+\`configure' configures tsung 1.5.0a to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1249,7 +1249,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of tsung 1.4.3a:";;
+ short | recursive ) echo "Configuration of tsung 1.5.0a:";;
esac
cat <<\_ACEOF
@@ -1329,7 +1329,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-tsung configure 1.4.3a
+tsung configure 1.5.0a
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1390,7 +1390,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by tsung $as_me 1.4.3a, which was
+It was created by tsung $as_me 1.5.0a, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -3702,7 +3702,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by tsung $as_me 1.4.3a, which was
+This file was extended by tsung $as_me 1.5.0a, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -3755,7 +3755,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-tsung config.status 1.4.3a
+tsung config.status 1.5.0a
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
View
@@ -95,8 +95,8 @@
<!--ENDHTML-->
<!--CUT DEF section 1 --><H1 ALIGN=center>Tsung User’s manual</H1><DIV CLASS="center">
-<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=1><TR><TD ALIGN=left NOWRAP bgcolor="#F2F2F2"> Version:</TD><TD ALIGN=left NOWRAP>1.4.2</TD></TR>
-<TR><TD ALIGN=left NOWRAP bgcolor="#F2F2F2"> Date :</TD><TD ALIGN=left NOWRAP>August 30, 2012</TD></TR>
+<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=1><TR><TD ALIGN=left NOWRAP bgcolor="#F2F2F2"> Version:</TD><TD ALIGN=left NOWRAP>1.5.0</TD></TR>
+<TR><TD ALIGN=left NOWRAP bgcolor="#F2F2F2"> Date :</TD><TD ALIGN=left NOWRAP>September 10, 2012</TD></TR>
</TABLE>
</DIV><!--TOC section Contents-->
<H2 CLASS="section"><!--SEC ANCHOR -->Contents</H2><!--SEC END --><UL CLASS="toc"><LI CLASS="li-toc">
@@ -1452,7 +1452,7 @@ <H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc55">6.6</A>  Sessions</H
<A NAME="sec:sessions"></A></P><P>Sessions define the content of the scenario itself. They describe
the requests to execute.</P><P>Each session has a given probability. This is used to decide which
session a new user will execute. The sum of all session<CODE>'</CODE>s
-probabilities must be 100.</P><P><B>Since Tsung 1.4.3</B>, you can use weights instead of
+probabilities must be 100.</P><P><B>Since Tsung 1.5.0</B>, you can use weights instead of
probabilities. In the following example, there will be twice as many
sessions of type s1 than s2.
</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
@@ -1648,6 +1648,83 @@ <H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc57">6.6.2</A>  HTTP</
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
+</TABLE><!--TOC paragraph Authentication-->
+<H5 CLASS="paragraph"><!--SEC ANCHOR -->Authentication</H5><!--SEC END --><P>Until Tsung 1.5.0, only Basic authentication was implemented. You can
+now use Digest Authentication and OAuth 1.0.</P><P>To use Digest authentication:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
+CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
+</TD></TR>
+</TABLE></TD></TR>
+<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
+</TD></TR>
+</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;!-- 1. First request return 401. We use dynvars to fetch nonce and realm --&gt;
+ &lt;request&gt;
+ &lt;dyn_variable name="nonce" header="www-authenticate/nonce"/&gt;
+ &lt;dyn_variable name="realm" header="www-authenticate/realm"/&gt;
+ &lt;http url="/digest" method="GET" version="1.1"/&gt;
+ &lt;/request&gt;
+
+ &lt;!--
+ 2. This request will be authenticated. Type="digest" is important.
+ We use the nonce and realm values returned from the previous
+ If the webserver returns the nextnonce we set it to the nonce dynvar
+ for use with the next request.
+ Else it stays set to the old value
+ --&gt;
+ &lt;request subst="true"&gt;
+ &lt;dyn_variable name="nonce" header="authentication-info/nextnonce"/&gt;
+ &lt;http url="/digest" method="GET" version="1.1"&gt;
+ &lt;www_authenticate userid="user" passwd="passwd" type="digest" realm="%%_realm%%" nonce="%%_nonce%%"/&gt;
+ &lt;/http&gt;
+ &lt;/request&gt;
+</PRE></TD></TR>
+</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
+</TD></TR>
+</TABLE></TD></TR>
+<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
+</TD></TR>
+</TABLE></TD></TR>
+</TABLE></TD></TR>
+</TABLE><P>To use OAuth authentication:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
+CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
+</TD></TR>
+</TABLE></TD></TR>
+<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
+</TD></TR>
+</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;!-- Getting a Request Token --&gt;
+
+ &lt;request&gt;
+ &lt;dyn_variable name="access_token" re="oauth_token=([^&amp;amp;]*)"/&gt;
+ &lt;dyn_variable name="access_token_secret" re="oauth_token_secret=([^&amp;amp;]*)" /&gt;
+ &lt;http url="/oauth/example/request_token.php" method="POST" version="1.1" contents="empty"&gt;
+ &lt;oauth consumer_key="key" consumer_secret="secret" method="HMAC-SHA1"/&gt;
+ &lt;/http&gt;
+ &lt;/request&gt;
+
+ &lt;!-- Getting an Access Token --&gt;
+
+ &lt;request subst='true'&gt;
+ &lt;dyn_variable name="access_token" re="oauth_token=([^&amp;amp;]*)"/&gt;
+ &lt;dyn_variable name="access_token_secret" re="oauth_token_secret=([^&amp;amp;]*)"/&gt;
+ &lt;http url="/oauth/example/access_token.php" method="POST" version="1.1" contents="empty"&gt;
+ &lt;oauth consumer_key="key" consumer_secret="secret" method="HMAC-SHA1" access_token="%%_access_token%%" access_token_secret="%%_access_token_secret%%"/&gt;
+ &lt;/http&gt;
+ &lt;/request&gt;
+
+ &lt;!-- Making Authenticated Calls --&gt;
+
+ &lt;request subst="true"&gt;
+ &lt;http url="/oauth/example/echo_api.php" method="GET" version="1.1"&gt;
+ &lt;oauth consumer_key="key" consumer_secret="secret" access_token="%%_access_token%%" access_token_secret="%%_access_token_secret%%"/&gt;
+ &lt;/http&gt;
+ &lt;/request&gt;
+</PRE></TD></TR>
+</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
+</TD></TR>
+</TABLE></TD></TR>
+<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
+</TD></TR>
+</TABLE></TD></TR>
+</TABLE></TD></TR>
</TABLE><!--TOC subsubsection Jabber/XMPP-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc58">6.6.3</A>  Jabber/XMPP</H4><!--SEC END --><P><A NAME="sec:sessions:jabber"></A>
</P><P>Here is an example of a session definition for the Jabber/XMPP protocol:
@@ -2035,7 +2112,7 @@ <H5 CLASS="paragraph"><!--SEC ANCHOR -->raw XML</H5><!--SEC END --><P>
</TABLE><P>Beware: you must encode XML characters like <FONT COLOR=purple>&lt;</FONT>
,<FONT COLOR=purple>&gt;</FONT>, <FONT COLOR=purple>&amp;</FONT>, etc.</P><!--TOC paragraph resource-->
<H5 CLASS="paragraph"><!--SEC ANCHOR -->resource</H5><!--SEC END --><P>By default, the XMPP resource is set to <FONT COLOR=purple>tsung</FONT>. Since
-version 1.4.3, you can override this (in all <TT>auth_*</TT> and
+version 1.5.0, you can override this (in all <TT>auth_*</TT> and
<TT>register</TT> requests) using the <TT>resource</TT> attribute.</P><!--TOC subsubsection PostgreSQL-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc59">6.6.4</A>  PostgreSQL</H4><!--SEC END --><P>For PostgreSQL, 4 types of requests are available:
</P><OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">
View
@@ -14,7 +14,7 @@
%\addauthor{Nicolas}{Niclausse}{nicolas.niclausse@niclux.org}
\doccopyright{Nicolas Niclausse.}
-\docversion{1.4.2}
+\docversion{1.5.0}
\docreldate{\date{}}
\docref{tsung-user-manual}
@@ -171,7 +171,7 @@ \subsection{HTTP related features}
\item Cookies: Automatic cookies management( but you can also manually
add more cookies)
\item \verb|'|GET If-modified since\verb|'| type of request
-\item WWW-authentication Basic
+\item WWW-authentication Basic and Digest. OAuth 1.0
\item User Agent support
\item Any HTTP Headers can be added
\item Proxy mode to record sessions using a Web browser
@@ -196,12 +196,13 @@ \subsection{WEBDAV related features}
\subsection{Jabber/XMPP related features}
\begin{itemize}
-\item Authentication (plain-text, digest and sip-digest)
+\item Authentication (plain-text, digest and sip-digest). STARTTLS
\item presence and register messages
\item Chat messages to online or offline users
\item MUC: join room, send message in room, change nickname
\item Roster set and get requests
\item Global users\verb|'| synchronization can be set on specific actions
+\item BOSH \& XMPP over Websocket
\item raw XML messages
\item PubSub
\item Multiple vhost instances supported
@@ -1187,7 +1188,7 @@ \subsection{Sessions}
session a new user will execute. The sum of all session\verb|'|s
probabilities must be 100.
-\strong{Since Tsung 1.4.3}, you can use weights instead of
+\strong{Since Tsung 1.5.0}, you can use weights instead of
probabilities. In the following example, there will be twice as many
sessions of type s1 than s2.
\begin{Verbatim}
@@ -1314,6 +1315,68 @@ \subsubsection{HTTP}
</http>
\end{Verbatim}
+\paragraph{Authentication}
+
+Until Tsung 1.5.0, only Basic authentication was implemented. You can
+now use Digest Authentication and OAuth 1.0.
+
+To use Digest authentication:
+
+\begin{Verbatim}
+ <!-- 1. First request return 401. We use dynvars to fetch nonce and realm -->
+ <request>
+ <dyn_variable name="nonce" header="www-authenticate/nonce"/>
+ <dyn_variable name="realm" header="www-authenticate/realm"/>
+ <http url="/digest" method="GET" version="1.1"/>
+ </request>
+
+ <!--
+ 2. This request will be authenticated. Type="digest" is important.
+ We use the nonce and realm values returned from the previous
+ If the webserver returns the nextnonce we set it to the nonce dynvar
+ for use with the next request.
+ Else it stays set to the old value
+ -->
+ <request subst="true">
+ <dyn_variable name="nonce" header="authentication-info/nextnonce"/>
+ <http url="/digest" method="GET" version="1.1">
+ <www_authenticate userid="user" passwd="passwd" type="digest" realm="%%_realm%%" nonce="%%_nonce%%"/>
+ </http>
+ </request>
+\end{Verbatim}
+
+To use OAuth authentication:
+
+\begin{Verbatim}
+ <!-- Getting a Request Token -->
+
+ <request>
+ <dyn_variable name="access_token" re="oauth_token=([^&amp;]*)"/>
+ <dyn_variable name="access_token_secret" re="oauth_token_secret=([^&amp;]*)" />
+ <http url="/oauth/example/request_token.php" method="POST" version="1.1" contents="empty">
+ <oauth consumer_key="key" consumer_secret="secret" method="HMAC-SHA1"/>
+ </http>
+ </request>
+
+ <!-- Getting an Access Token -->
+
+ <request subst='true'>
+ <dyn_variable name="access_token" re="oauth_token=([^&amp;]*)"/>
+ <dyn_variable name="access_token_secret" re="oauth_token_secret=([^&amp;]*)"/>
+ <http url="/oauth/example/access_token.php" method="POST" version="1.1" contents="empty">
+ <oauth consumer_key="key" consumer_secret="secret" method="HMAC-SHA1" access_token="%%_access_token%%" access_token_secret="%%_access_token_secret%%"/>
+ </http>
+ </request>
+
+ <!-- Making Authenticated Calls -->
+
+ <request subst="true">
+ <http url="/oauth/example/echo_api.php" method="GET" version="1.1">
+ <oauth consumer_key="key" consumer_secret="secret" access_token="%%_access_token%%" access_token_secret="%%_access_token_secret%%"/>
+ </http>
+ </request>
+\end{Verbatim}
+
\subsubsection{Jabber/XMPP}
\label{sec:sessions:jabber}
@@ -1639,7 +1702,7 @@ \subsubsection{Jabber/XMPP}
\paragraph{resource}
By default, the XMPP resource is set to \userinput{tsung}. Since
-version 1.4.3, you can override this (in all \varname{auth\_*} and
+version 1.5.0, you can override this (in all \varname{auth\_*} and
\varname{register} requests) using the \varname{resource} attribute.
\subsubsection{PostgreSQL}
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<!DOCTYPE tsung SYSTEM "@prefix@/share/@PACKAGE_NAME@/@DTD@">
+<tsung loglevel="debug" dumptraffic="true" version="1.0">
+
+ <clients>
+ <client host="localhost" weight="1" maxusers="1000" use_controller_vm="true"/>
+ </clients>
+
+ <servers>
+ <server host="localhost" port="443" type="ssl"></server>
+ </servers>
+
+ <load>
+ <arrivalphase phase="1" duration="1" unit="second">
+ <users interarrival="1" unit="second"></users>
+ </arrivalphase>
+ </load>
+
+ <sessions>
+ <session name="http_test_1" probability="100" type="ts_http">
+ <!--
+ 1. First request return 401. We use dynvars to fetch nonce and realm
+ -->
+ <request>
+ <dyn_variable name="nonce" header="www-authenticate/nonce"/>
+ <dyn_variable name="realm" header="www-authenticate/realm"/>
+ <http url="/digest" method="GET" version="1.1">
+ </http>
+ </request>
+ <!--
+ 2. This request will be authenticated. Type="digest" is important.
+ We use the nonce and realm values returned from the previous
+ If the webserver returns the nextnonce we set it to the nonce dynvar
+ for use with the next request.
+ Else it stays set to the old value
+ -->
+ <request subst="true">
+ <dyn_variable name="nonce" header="authentication-info/nextnonce"/>
+ <http url="/digest" method="GET" version="1.1">
+ <www_authenticate userid="user" passwd="passwd" type="digest" realm="%%_realm%%" nonce="%%_nonce%%"/>
+ <!--<www_authenticate userid="user" passwd="passwd" type="digest" realm="%%_realm%%" nonce="%%_nonce%%" nc="00000001" cnonce="%%ts_user_server:get_really_unique_id%%"/>-->
+ </http>
+ </request>
+
+ <!--
+ 2. This request will still be authenticated
+ -->
+ <request subst="true">
+ <dyn_variable name="nonce" header="authentication-info/nextnonce"/>
+ <http url="/digest" method="GET" version="1.1">
+ <www_authenticate userid="user" passwd="passwd" type="digest" realm="%%_realm%%" nonce="%%_nonce%%"/>
+ </http>
+ </request>
+ </session>
+</sessions>
+
+</tsung>
Oops, something went wrong.

0 comments on commit 11c9caa

Please sign in to comment.