Difference between revisions of "SendHeader"
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.}} | |
− | + | ||
− | + | ||
− | + | ||
− | {{rw}} | + | |
− | + | For example: | |
− | + | <tt>set #sendheader content-type: , #spc , blabla$line2: , #spc , blabla2$</tt> | |
− | < | + | |
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. | ||
Line 13: | Line 8: | ||
First let's look at EUO default format for http requests: | First let's look at EUO default format for http requests: | ||
− | < | + | <tt>; test1 |
send debugHTTPPost localhost /euo/action.php?getVar=getValue postVar=postValue | send debugHTTPPost localhost /euo/action.php?getVar=getValue postVar=postValue | ||
− | halt</ | + | halt</tt> |
Outgoing HTTP request: | Outgoing HTTP request: | ||
− | < | + | <tt>POST /euo/action.php?getvar=getvalue HTTP/1.0 Host: localhost Content-Length: 17 postVar=postValue</tt> |
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: | ||
− | < | + | <tt>; test2 |
set #sendHeader User-Agent: , #spc , EasyUO , #spc , #cliVer , $ | set #sendHeader User-Agent: , #spc , EasyUO , #spc , #cliVer , $ | ||
send debugHTTPPost localhost /euo/action.php?getVar=getValue postVar=postValue | send debugHTTPPost localhost /euo/action.php?getVar=getValue postVar=postValue | ||
− | halt</ | + | halt</tt> |
Outgoing HTTP request: | Outgoing HTTP request: | ||
− | < | + | <tt>POST /euo/action.php?getvar=getvalue HTTP/1.0 Host: localhost Content-Length: 17 user-agent: easyuo 4.0.0e postVar=postValue</tt> |
A few things are worth mentioning here: | A few things are worth mentioning here: | ||
Line 39: | Line 34: | ||
*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. | *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. | ||
− | |||
'''''Warning: Two consecutive '$' will break the header structure and are likely to cause inpredictable results!'' | '''''Warning: Two consecutive '$' will break the header structure and are likely to cause inpredictable results!'' | ||
''' | ''' | ||
− | |||
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: | ||
− | < | + | <tt>set #sendHeader User-Agent: , #spc , EasyUO , #spc , #cliVer , $ , |
− | + Content-type: , #spc , application/x-www-form-urlencoded$</ | + | + Content-type: , #spc , application/x-www-form-urlencoded$</tt> |
or | or | ||
− | < | + | <tt>set #sendHeader User-Agent: , #spc , EasyUO , #spc , #cliVer , $ |
− | set #sendHeader #sendHeader , Content-type: , #spc , application/x-www-form-urlencoded$</ | + | set #sendHeader #sendHeader , Content-type: , #spc , application/x-www-form-urlencoded$</tt> |
In order to reset #sendHeader, try any of these: | In order to reset #sendHeader, try any of these: | ||
− | < | + | <tt>set #sendHeader N/A |
− | set #sendHeader invalid content</ | + | set #sendHeader invalid content</tt> |
==== Example ==== | ==== Example ==== | ||
Line 66: | Line 59: | ||
</pre> | </pre> | ||
− | + | {{footer}} | |
− | { | + | |
− | + | ||
− | + | ||
− | + | ||
− | { | + | |
− | + | ||
− | + |
Revision as of 11:20, 26 August 2005
⇔ | 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. |
For example: 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
A few things are worth mentioning here:
- 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.
Warning: Two consecutive '$' will break the header structure and are likely to cause inpredictable results!
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
Example
set #sendHeader Content-type: , #spc , application/x-www-form-urlencoded$
See also
Main Page | Documentation |