File: simple_urlenc.htb

package info (click to toggle)
httest 2.2.6-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 4,188 kB
  • sloc: ansic: 17,134; sh: 10,389; makefile: 490; lisp: 145
file content (28 lines) | stat: -rw-r--r-- 528 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# A simple way to build up urlencoded postbodies

MODULE SIMPLE

BLOCK _FORM_URLENC : HOOK
_SET HOOK=_SIMPLE:FORM_URLENC_ARG
__Content-Type: application/x-www-form-urlencoded
__
END

BLOCK _FORM_URLENC_ARG HOOK VAR VAL : RET
_DEBUG VAL=$VAL
_URLENC "$VAL" VALUE
_DEBUG VALUE=$VALUE
_IF "$HOOK" NOT MATCH "_SIMPLE:FORM_URLENC_ARG"
  _SET RET=${HOOK}&${VAR}=${VALUE}
_END IF
_IF "$HOOK" MATCH "_SIMPLE:FORM_URLENC_ARG"
  _SET RET=${VAR}=${VALUE}
_END IF
END

BLOCK _FORM_URLENC_END HOOK
_-$HOOK
_SIMPLE:FOLLOW 0
_PLAY SOCKET
END