Difference between revisions of "SendHeader"
From Wiki
(→Example) |
|||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | {{header|result|rw|The system variable #sendHeader is a variable that lets you add additional header lines to the post request sent by the send command. Each line must be finished with a $ to mark the end. | + | {{header|result|rw|The system variable #sendHeader is a variable that lets you add additional header lines to the post request sent by the send command. Each line must be finished with a $ to mark the end.}} |
− | |||
<pre>set #sendheader content-type: , #spc , blabla$line2: , #spc , blabla2$</pre> | <pre>set #sendheader content-type: , #spc , blabla$line2: , #spc , blabla2$</pre> | ||
− | If #sendheader doesn't contain any $ signs at all then no additional lines will be added to the header. Setting #sendheader to $$$ will obviously mess up the outgoing packet so that is not recommended. | + | *If #sendheader doesn't contain any $ signs at all then no additional lines will be added to the header. Setting #sendheader to $$$ will obviously mess up the outgoing packet so that is not recommended. |
− | First let's look at EUO default format for http requests: | + | *First let's look at EUO default format for http requests: |
<pre>; test1 | <pre>; test1 | ||
Line 12: | Line 11: | ||
halt</pre> | halt</pre> | ||
− | Outgoing HTTP request: | + | *Outgoing HTTP request: |
<pre>POST /euo/action.php?getvar<nowiki>=</nowiki>getvalue HTTP/1.0 Host: localhost Content-Length: 17 postVar<nowiki>=</nowiki>postValue</pre> | <pre>POST /euo/action.php?getvar<nowiki>=</nowiki>getvalue HTTP/1.0 Host: localhost Content-Length: 17 postVar<nowiki>=</nowiki>postValue</pre> | ||
− | Supposing you want your HTTP request to be identifiied as issued by EasyUO by adding the directive "User-Agent: EasyUO #cliVer" to the HTTP header: | + | *Supposing you want your HTTP request to be identifiied as issued by EasyUO by adding the directive "User-Agent: EasyUO #cliVer" to the HTTP header: |
<pre>; test2 | <pre>; test2 | ||
Line 23: | Line 22: | ||
halt</pre> | halt</pre> | ||
− | Outgoing HTTP request: | + | *Outgoing HTTP request: |
<pre>POST /euo/action.php?getvar<nowiki>=</nowiki>getvalue HTTP/1.0 Host: localhost Content-Length: 17 user-agent: easyuo 4.0.0e postVar<nowiki>=</nowiki>postValue</pre> | <pre>POST /euo/action.php?getvar<nowiki>=</nowiki>getvalue HTTP/1.0 Host: localhost Content-Length: 17 user-agent: easyuo 4.0.0e postVar<nowiki>=</nowiki>postValue</pre> | ||
− | If you need to specify more than one http directive, you may use the following syntax: | + | *If you need to specify more than one http directive, you may use the following syntax: |
<pre>set #sendHeader User-Agent: , #spc , EasyUO , #spc , #cliVer , $ , | <pre>set #sendHeader User-Agent: , #spc , EasyUO , #spc , #cliVer , $ , | ||
+ Content-type: , #spc , application/x-www-form-urlencoded$</pre> | + Content-type: , #spc , application/x-www-form-urlencoded$</pre> | ||
− | or | + | :or |
<pre>set #sendHeader User-Agent: , #spc , EasyUO , #spc , #cliVer , $ | <pre>set #sendHeader User-Agent: , #spc , EasyUO , #spc , #cliVer , $ | ||
set #sendHeader #sendHeader , Content-type: , #spc , application/x-www-form-urlencoded$</pre> | set #sendHeader #sendHeader , Content-type: , #spc , application/x-www-form-urlencoded$</pre> | ||
− | In order to reset #sendHeader, try any of these: | + | *In order to reset #sendHeader, try any of these: |
<pre>set #sendHeader N/A | <pre>set #sendHeader N/A | ||
− | set #sendHeader invalid content</pre> | + | set #sendHeader invalid content</pre> |
− | |||
+ | {{note| | ||
+ | *Two consecutive '$' will break the header structure and are likely to cause inpredictable results! | ||
+ | *You cannot SET a value containing spaces to #sendHeader without 'escaping' them using the #spc constant. | ||
+ | *The value of #sendHeader is converted to lowercase when added to the HTTP header. | ||
+ | *It must be terminated by a single end-of-line symbol '$'. Without this symbol, #sendHeader value will be ignored and not added to the HTTP header.}} | ||
− | + | ==== Example ==== | |
+ | <pre> | ||
+ | set #sendHeader Content-type: , #spc , application/x-www-form-urlencoded$ | ||
− | + | </pre> | |
+ | == Send cookie == | ||
+ | set #sendheader Cookie:Var1=Val1 , #smc , Var2=Val2 $ <br> <br> | ||
+ | Example ( send cookie for php session ): <br> | ||
+ | set #sendheader Cookie: , #spc , PHPSESSID= , %sessionid , #smc , #spc , path=/ $ | ||
− | |||
− | |||
− | |||
− | + | == HTTP POST == | |
− | + | set %USERID_POST userid= , %username | |
− | {{ | + | set %PASSWD_POST passwd= , %password |
+ | |||
+ | set #sendheader Content-Type: , #spc , application/x-www-form-urlencoded , $ ;without headers, no post data | ||
+ | send DebugHTTPPost localhost /login.php !USERID_POST , & , !PASSWD_POST | ||
+ | |||
+ | =See Also= | ||
+ | {{result}} |
Latest revision as of 15:11, 25 May 2008
⇔ | The system variable #sendHeader is a variable that lets you add additional header lines to the post request sent by the send command. Each line must be finished with a $ to mark the end. |
set #sendheader content-type: , #spc , blabla$line2: , #spc , blabla2$
- If #sendheader doesn't contain any $ signs at all then no additional lines will be added to the header. Setting #sendheader to $$$ will obviously mess up the outgoing packet so that is not recommended.
- First let's look at EUO default format for http requests:
; test1 send debugHTTPPost localhost /euo/action.php?getVar=getValue postVar=postValue halt
- Outgoing HTTP request:
POST /euo/action.php?getvar=getvalue HTTP/1.0 Host: localhost Content-Length: 17 postVar=postValue
- Supposing you want your HTTP request to be identifiied as issued by EasyUO by adding the directive "User-Agent: EasyUO #cliVer" to the HTTP header:
; test2 set #sendHeader User-Agent: , #spc , EasyUO , #spc , #cliVer , $ send debugHTTPPost localhost /euo/action.php?getVar=getValue postVar=postValue halt
- Outgoing HTTP request:
POST /euo/action.php?getvar=getvalue HTTP/1.0 Host: localhost Content-Length: 17 user-agent: easyuo 4.0.0e postVar=postValue
- If you need to specify more than one http directive, you may use the following syntax:
set #sendHeader User-Agent: , #spc , EasyUO , #spc , #cliVer , $ , + Content-type: , #spc , application/x-www-form-urlencoded$
- or
set #sendHeader User-Agent: , #spc , EasyUO , #spc , #cliVer , $ set #sendHeader #sendHeader , Content-type: , #spc , application/x-www-form-urlencoded$
- In order to reset #sendHeader, try any of these:
set #sendHeader N/A set #sendHeader invalid content
Note: |
|
Example
set #sendHeader Content-type: , #spc , application/x-www-form-urlencoded$
Send cookie
set #sendheader Cookie:Var1=Val1 , #smc , Var2=Val2 $
Example ( send cookie for php session ):
set #sendheader Cookie: , #spc , PHPSESSID= , %sessionid , #smc , #spc , path=/ $
HTTP POST
set %USERID_POST userid= , %username set %PASSWD_POST passwd= , %password
set #sendheader Content-Type: , #spc , application/x-www-form-urlencoded , $ ;without headers, no post data send DebugHTTPPost localhost /login.php !USERID_POST , & , !PASSWD_POST
See Also
Result
- Result variables hold values that are the direct by-product of actions taken by commands in a script. The exact details of what they contain is determined by the command and variable.
#menuButton | ⇔ | Returns the name of the last clicked menu Button |
#menuRes | ⇒ | Returns the result of the last menu Get or menu GetNum command |
#sendHeader | ⇔ | Holds HTTP header information for the send command |
#strRes | ⇔ | Returns the result of the last str command |
#property | ⇒ | Returns the result of the last event Property command |
#result | ⇔ | Returns the result of the last return command |
#opts | ⇒ | Determines which EasyUO configuration options are active |
#lpc | ⇔ | Determines the number of lines that are executed per cycle |