Export translations
Views
Special page
From OpenSCADAWiki
Jump to:
navigation
,
search
Settings
Group
About
Documents
Documents/API
Documents/DAQ
Documents/FAQ
Documents/How to
Documents/How to/Build from source
Documents/How to/Crash report
Documents/How to/Create module
Documents/How to/Create multi language project
Documents/How to/Cyclic programming
Documents/How to/Debug
Documents/How to/Install
Documents/How to/Live disk
Documents/How to/Release
Documents/How to/Transferring project configuration
Documents/How to/Violations, alarms and notifications
Documents/Program manual
Documents/Quick start
Documents/Release 0.8.0
Documents/Release 0.8.0/Update10
Documents/Release 0.8.0/Update11
Documents/Release 0.8.0/Update12
Documents/Release 0.8.0/Update13
Documents/Release 0.8.0/Update14
Documents/Release 0.8.0/Update15
Documents/Release 0.8.0/Update16
Documents/Release 0.8.0/Update17
Documents/Release 0.8.0/Update18
Documents/Release 0.8.0/Update19
Documents/Release 0.8.0/Update20
Documents/Release 0.8.0/Update3
Documents/Release 0.8.0/Update4
Documents/Release 0.8.0/Update5
Documents/Release 0.8.0/Update6
Documents/Release 0.8.0/Update7
Documents/Release 0.8.0/Update8
Documents/Release 0.8.0/Update9
Documents/Release 0.9
Documents/Release 0.9/Update 7
Documents/Release 0.9/Update 8
Documents/Release 0.9/Update1
Documents/Release 0.9/Update2
Documents/Release 0.9/Update3
Documents/Release 0.9/Update4
Documents/Release 0.9/Update5
Documents/Release 0.9/Update6
Documents/Release 0.9/Updating 0.8.0 LTS
Documents/Terms
Documents/User API
Functions and demands
Home
Libs
Libs/Devices
Libs/Documents
Libs/Electrical elements
Libs/Generic list
Libs/LowLevelDevices
Libs/Main
Libs/Main graphical elements
Libs/Mnemo elements
Libs/Prescriptions
Libs/Regulation elements
Libs/Service procedures
Libs/Technological apparatuses
Modules
Modules/BFN
Modules/BlockCalc
Modules/Comedi
Modules/DAQGate
Modules/DBArch
Modules/DBF
Modules/DBGate
Modules/DCON
Modules/DiamondBoards
Modules/FireBird
Modules/FLibComplex1
Modules/FLibMath
Modules/FLibSYS
Modules/FSArch
Modules/GPIO
Modules/HTTP
Modules/ICP DAS
Modules/JavaLikeCalc
Modules/LDAP
Modules/LogicLev
Modules/ModBus
Modules/MySQL
Modules/OPC UA
Modules/PostgreSQL
Modules/QTCfg
Modules/QTStarter
Modules/SelfSystem
Modules/Serial
Modules/Siemens
Modules/SMH2Gi
Modules/SNMP
Modules/Sockets
Modules/SoundCard
Modules/SQLite
Modules/SSL
Modules/System
Modules/SystemTests
Modules/UserProtocol
Modules/VCAEngine
Modules/Vision
Modules/WebCfg
Modules/WebCfgD
Modules/WebUser
Modules/WebVision
Sub-projects
Sub-projects/Automatic Builder of OpenSCADA
Sub-projects/Automation Linux distributive
Sub-projects/Embedding and PLC
Sub-projects/Server
Sub-projects/VCA
User:RomanSavochenko
Using
Using/HouseSpirit
Using/Kramatorsk Ball Mills
Using/Kramatorsk Water
Using/Model AGLKS
Using/Model Boiler
Using/OpenWrt TELEOFIS RTU968
Using/Yaroslavskij broiler
Works
Works/Road map
Works/Technical Support
Works/Technical Support/Agreement
Works/To do
Language
aa - Afar
ab - Abkhazian
ace - Achinese
ady - Adyghe
ady-cyrl - адыгабзэ
aeb - Tunisian Arabic
aeb-arab - تونسي
aeb-latn - Tûnsî
af - Afrikaans
ak - Akan
aln - Gheg Albanian
am - Amharic
an - Aragonese
ang - Old English
anp - Angika
ar - Arabic
arc - Aramaic
arn - Mapuche
arq - Algerian Arabic
ary - Moroccan Arabic
arz - Egyptian Arabic
as - Assamese
ase - American Sign Language
ast - Asturian
av - Avaric
avk - Kotava
awa - Awadhi
ay - Aymara
az - Azerbaijani
azb - تۆرکجه
ba - Bashkir
bar - Bavarian
bbc - Batak Toba
bbc-latn - Batak Toba
bcc - Southern Balochi
bcl - Bikol Central
be - Belarusian
be-tarask - Belarusian (Taraškievica orthography)
bg - Bulgarian
bgn - Western Balochi
bho - Bhojpuri
bi - Bislama
bjn - Banjar
bm - Bambara
bn - Bengali
bo - Tibetan
bpy - Bishnupriya
bqi - Bakhtiari
br - Breton
brh - Brahui
bs - Bosnian
bto - Iriga Bicolano
bug - Buginese
bxr - буряад
ca - Catalan
cbk-zam - Chavacano de Zamboanga
cdo - Min Dong Chinese
ce - Chechen
ceb - Cebuano
ch - Chamorro
cho - Choctaw
chr - Cherokee
chy - Cheyenne
ckb - Central Kurdish
co - Corsican
cps - Capiznon
cr - Cree
crh - Crimean Turkish
crh-cyrl - Crimean Turkish (Cyrillic script)
crh-latn - Crimean Turkish (Latin script)
cs - Czech
csb - Kashubian
cu - Church Slavic
cv - Chuvash
cy - Welsh
da - Danish
de - German
de-at - Austrian German
de-ch - Swiss High German
de-formal - German (formal address)
diq - Zazaki
dsb - Lower Sorbian
dtp - Central Dusun
dty - डोटेली
dv - Divehi
dz - Dzongkha
ee - Ewe
egl - Emilian
el - Greek
eml - Emiliano-Romagnolo
en - English
en-ca - Canadian English
en-gb - British English
eo - Esperanto
es - Spanish
et - Estonian
eu - Basque
ext - Extremaduran
fa - Persian
ff - Fulah
fi - Finnish
fit - Tornedalen Finnish
fj - Fijian
fo - Faroese
fr - French
frc - Cajun French
frp - Arpitan
frr - Northern Frisian
fur - Friulian
fy - Western Frisian
ga - Irish
gag - Gagauz
gan - Gan Chinese
gan-hans - Simplified Gan script
gan-hant - Traditional Gan script
gd - Scottish Gaelic
gl - Galician
glk - Gilaki
gn - Guarani
gom - Goan Konkani
gom-deva - Goan Konkani (Devanagari script)
gom-latn - Goan Konkani (Latin script)
got - Gothic
grc - Ancient Greek
gsw - Swiss German
gu - Gujarati
gv - Manx
ha - Hausa
hak - Hakka Chinese
haw - Hawaiian
he - Hebrew
hi - Hindi
hif - Fiji Hindi
hif-latn - Fiji Hindi (Latin script)
hil - Hiligaynon
ho - Hiri Motu
hr - Croatian
hrx - Hunsrik
hsb - Upper Sorbian
ht - Haitian Creole
hu - Hungarian
hy - Armenian
hz - Herero
ia - Interlingua
id - Indonesian
ie - Interlingue
ig - Igbo
ii - Sichuan Yi
ik - Inupiaq
ike-cans - Eastern Canadian (Aboriginal syllabics)
ike-latn - Eastern Canadian (Latin script)
ilo - Iloko
inh - Ingush
io - Ido
is - Icelandic
it - Italian
iu - Inuktitut
ja - Japanese
jam - Jamaican Creole English
jbo - Lojban
jut - Jutish
jv - Javanese
ka - Georgian
kaa - Kara-Kalpak
kab - Kabyle
kbd - Kabardian
kbd-cyrl - Адыгэбзэ
kg - Kongo
khw - Khowar
ki - Kikuyu
kiu - Kirmanjki
kj - Kuanyama
kk - Kazakh
kk-arab - Kazakh (Arabic script)
kk-cn - Kazakh (China)
kk-cyrl - Kazakh (Cyrillic script)
kk-kz - Kazakh (Kazakhstan)
kk-latn - Kazakh (Latin script)
kk-tr - Kazakh (Turkey)
kl - Kalaallisut
km - Khmer
kn - Kannada
ko - Korean
ko-kp - 한국어 (조선)
koi - Komi-Permyak
kr - Kanuri
krc - Karachay-Balkar
kri - Krio
krj - Kinaray-a
ks - Kashmiri
ks-arab - Kashmiri (Arabic script)
ks-deva - Kashmiri (Devanagari script)
ksh - Colognian
ku - Kurdish
ku-arab - كوردي (عەرەبی)
ku-latn - Kurdish (Latin script)
kv - Komi
kw - Cornish
ky - Kyrgyz
la - Latin
lad - Ladino
lb - Luxembourgish
lbe - лакку
lez - Lezghian
lfn - Lingua Franca Nova
lg - Ganda
li - Limburgish
lij - Ligurian
liv - Livonian
lmo - Lombard
ln - Lingala
lo - Lao
loz - Lozi
lrc - Northern Luri
lt - Lithuanian
ltg - Latgalian
lus - Mizo
luz - Southern Luri
lv - Latvian
lzh - Literary Chinese
lzz - Laz
mai - Maithili
map-bms - Basa Banyumasan
mdf - Moksha
mg - Malagasy
mh - Marshallese
mhr - Eastern Mari
mi - Maori
min - Minangkabau
mk - Macedonian
ml - Malayalam
mn - Mongolian
mo - молдовеняскэ
mr - Marathi
mrj - Western Mari
ms - Malay
mt - Maltese
mus - Creek
mwl - Mirandese
my - Burmese
myv - Erzya
mzn - Mazanderani
na - Nauru
nah - Nāhuatl
nan - Min Nan Chinese
nap - Neapolitan
nb - Norwegian Bokmål
nds - Low German
nds-nl - Low Saxon
ne - Nepali
new - Newari
ng - Ndonga
niu - Niuean
nl - Dutch
nl-informal - Nederlands (informeel)
nn - Norwegian Nynorsk
nov - Novial
nrm - Nouormand
nso - Northern Sotho
nv - Navajo
ny - Nyanja
oc - Occitan
olo - Livvi-Karelian
om - Oromo
or - Oriya
os - Ossetic
pa - Punjabi
pag - Pangasinan
pam - Pampanga
pap - Papiamento
pcd - Picard
pdc - Pennsylvania German
pdt - Plautdietsch
pfl - Palatine German
pi - Pali
pih - Norfuk / Pitkern
pl - Polish
pms - Piedmontese
pnb - Western Punjabi
pnt - Pontic
prg - Prussian
ps - Pashto
pt - Portuguese
pt-br - Brazilian Portuguese
qu - Quechua
qug - Chimborazo Highland Quichua
rgn - Romagnol
rif - Riffian
rm - Romansh
rmy - Romani
rn - Rundi
ro - Romanian
roa-tara - tarandíne
ru - Russian
rue - Rusyn
rup - Aromanian
ruq - Megleno-Romanian
ruq-cyrl - Megleno-Romanian (Cyrillic script)
ruq-latn - Megleno-Romanian (Latin script)
rw - Kinyarwanda
sa - Sanskrit
sah - Sakha
sat - Santali
sc - Sardinian
scn - Sicilian
sco - Scots
sd - Sindhi
sdc - Sassarese Sardinian
sdh - Southern Kurdish
se - Northern Sami
sei - Seri
ses - Koyraboro Senni
sg - Sango
sgs - Samogitian
sh - Serbo-Croatian
shi - Tachelhit
shi-latn - Tašlḥiyt
shi-tfng - ⵜⴰⵛⵍⵃⵉⵜ
si - Sinhala
sk - Slovak
sl - Slovenian
sli - Lower Silesian
sm - Samoan
sma - Southern Sami
sn - Shona
so - Somali
sq - Albanian
sr - Serbian
sr-ec - Serbian (Cyrillic script)
sr-el - Serbian (Latin script)
srn - Sranan Tongo
ss - Swati
st - Southern Sotho
stq - Saterland Frisian
su - Sundanese
sv - Swedish
sw - Swahili
szl - Silesian
ta - Tamil
tcy - Tulu
te - Telugu
tet - Tetum
tg - Tajik
tg-cyrl - Tajik (Cyrillic script)
tg-latn - Tajik (Latin script)
th - Thai
ti - Tigrinya
tk - Turkmen
tl - Tagalog
tly - Talysh
tn - Tswana
to - Tongan
tokipona - Toki Pona
tpi - Tok Pisin
tr - Turkish
tru - Turoyo
ts - Tsonga
tt - Tatar
tt-cyrl - Tatar (Cyrillic script)
tt-latn - Tatar (Latin script)
tum - Tumbuka
tw - Twi
ty - Tahitian
tyv - Tuvinian
tzm - Central Atlas Tamazight
udm - Udmurt
ug - Uyghur
ug-arab - Uyghur (Arabic script)
ug-latn - Uyghur (Latin script)
uk - Ukrainian
ur - Urdu
uz - Uzbek
uz-cyrl - ўзбекча
uz-latn - oʻzbekcha
ve - Venda
vec - Venetian
vep - Veps
vi - Vietnamese
vls - West Flemish
vmf - Main-Franconian
vo - Volapük
vot - Votic
vro - Võro
wa - Walloon
war - Waray
wo - Wolof
wuu - Wu Chinese
xal - Kalmyk
xh - Xhosa
xmf - Mingrelian
yi - Yiddish
yo - Yoruba
yue - Cantonese
za - Zhuang
zea - Zeelandic
zh - Chinese
zh-cn - Chinese (China)
zh-hans - Simplified Chinese
zh-hant - Traditional Chinese
zh-hk - Chinese (Hong Kong)
zh-mo - 中文(澳門)
zh-my - 中文(马来西亚)
zh-sg - Chinese (Singapore)
zh-tw - Chinese (Taiwan)
zu - Zulu
qqq - Message documentation
Format
Export for off-line translation
Export in native format
{{DISPLAYTITLE:Modules/HTTP}}<languages/> {| class="wikitable" |- ! Module !! Name !! Version !! License !! Source !! Languages !! Platforms !! Type !! Author !! Description |- <section begin=info /> | [[Special:MyLanguage/Modules/HTTP|HTTP]] || HTTP-realization | 3.9 || GPL2 || prot_HTTP.so || en,uk,ru,de || x86,x86_64,ARM <section end=info /> | Protocol || {{Author|Roman Savochenko|Maxim Lysenko (2009) — the page initial translation}} || Provides support for the HTTP protocol for WWW-based user interfaces. * '''[[Special:MyLanguage/Works/To_do|To Do]]:''' <section begin=ToDo /> <section end=ToDo /> |} Module of the transport protocol HTTP is designed to support the implementation of the network protocol HTTP (Hypertext Transfer Protocol) in OpenSCADA. HTTP protocol is used to transfer the WWW content. For example, via HTTP the following types of documents are transmitted: html, xhtml, png, javascript, and many others. Support HTTP in OpenSCADA together with the transport [[Special:MyLanguage/Modules/Sockets|Sockets]] and [[Special:MyLanguage/Modules/SSL|SSL]] allows to implement various user functions based on the WWW interface. The module initially implements two main methods of the HTTP protocol "GET", "POST", and currently any HTTP method. The module provides control of the integrity of HTTP-queries and, jointly with Sockets and SSL transport, allows to "collect" whole requests from their fragments, as well as hold of the connection "alive" (Keep-Alive). For flexible connection of the user interfaces to this module, the modular mechanism within the module itself is used. In the role of modules the modules of the subsystem "User interfaces" are used with the additional information field "SubType", with the value of "WWW". In the requests for the Web resources the URL(Universal Resource Locator) are commonly used. Hence, the URL is passed as the main parameter via HTTP. The first element of the requested URL is used to identify the module UI. For example, the URL "<nowiki>http://localhost:10002/WebCfg</nowiki>" means requesting to the module "WebCfg" on the host "<nowiki>http://localhost:10002</nowiki>". In the case of an incorrect indication of the module ID, or when you address without identifier of the module at all, the module generates the information dialogue on the entry and the choice of one of the available user interfaces. Example of the dialogue is shown in Figure 1. [[File:HTTP_select.png|center|frame|Fig.1. Dialogue of the WWW-interface module choice.]] The module supports multi-language which one enabled by the [[Documents/Program_manual#ConfigTr|dynamic messages translation of OpenSCADA]]. The language of the final user interface is determined by and in sequence: * URL's parameter "lang". * Authenticated user's language. * Language of the Web-browser from the HTTP property "Accept-Language". * Generic language of the OpenSCADA process. Gotten in the way language used for building interfaces of the module and passes to the WWW sub-modules into the HTTP property "oscd_lang" of the argument "vars" of [[#ModsHTTP|the generic, "GET" and "POST" functions]]. To configure and control this module, you have the configuration page of the OpenSCADA control interface (Fig.3) where you can perform: * Control for the active authentication sessions. * Configuring: ** Rules of accessing for deny and allow. Any line of the rules of accessing is a different rule and you can use here templates, like to "*/WebVision/*"), or regular expressions, like to "/[^/]+/WebVision/.+/". Useful entries for: *** Deny: **** "*/WebCfgD/*" — [[Special:MyLanguage/Modules/WebCfgD|the module WebCfgD]] completely; **** "*/WebVision/*tmplSO/*" — the VCA project "tmplSO" of [[Special:MyLanguage/Modules/WebVision|the module WebVision]]. *** Allow: **** "*" — all, excluding the deny; **** "/^[^/]+/[^/]*$/" — pages of the module with all their resources; **** "*/login/*" — the login page; **** "/^[^/]+/WebVision/[^/]*($|\?)/" — [[Special:MyLanguage/Modules/WebVision|the WebVision module]] main page without the VCA projects accessing; **** "/^[^/]+/WebVision/.+_aviariesOril\d*/.*/" — the VCA project "aviariesOril" of [[Special:MyLanguage/Modules/WebVision|the module WebVision]]. ** HTML-template of the user interface and user main-page. In the HTML-template's fields you must specify an address of the file HTML/XHTML, which will be used for formation of the internal-service and main-page interfaces. Internal-service interfaces for example, it's the WEB-modules selection, the login page and like ones of the WEB-modules. From the template required correct XHTML, allowing parse the file by XML-parser, and the presence of the tag "#####CONTEXT#####" at the location of the dynamic content, for internal-service interfaces it's necessarily. Resource files of the templates represented by images, CSS and JavaScript files and their are searching from the directory in which located the specified template file and from the current directory. If errors are found in the template there will be use a standard builtin interface. For different, to the language, template file you can add the language suffix to the file end like "{My template}_{lang}.html" but select the generic-base template file "{My template}.html" into these configuration fields. For the templates example you can see to the most used templates: *** [[:File:HTTP_webopenscada.html.gz|Internal-service and main-page interfaces template, includes the modules index]]. *** [[:File:HTTP_webopenscada_main.html.gz|Main-page's template]] with a direct link to the [[Special:MyLanguage/Using/Model_AGLKS|AGLKS]] main interface by [[Special:MyLanguage/Modules/WebVision|UI.WebVision]] and without the WEB-modules index. *** [[:File:HTTP_webopenscada_goto.html.gz|Main-page's template]] with a strong redirection to the [[Special:MyLanguage/Using/Model_AGLKS|AGLKS]] main interface by [[Special:MyLanguage/Modules/WebVision|UI.WebVision]]. ** DB of the active authentication sessions provides an external table of the active authentication sessions — "HTTP_AuthSessions", which is enabled for not empty value and provides a possibility of sharing the authentication between different OpenSCADA stations and its short storing at the station shut down time. ** Authentication UID generation space, accessible with the common authentication sessions table to guaranty the cookie difference for different OpenSCADA processes. ** Lifetime of the authentication, list of the users allowed for authentication and set up of the automatic login. [[File:HTTP_mod.png|center|frame|Fig.3. The module configuring page.]] == Authentication == The module supports authentication in OpenSCADA while providing access to the WEB-interface modules (Fig.2). [[File:HTTP_auth.png|center|frame|Fig.2. Authentication dialogue in OpenSCADA.]] The authentication by the module is provided by the cookies with the dynamic name and the User ID space, where the cookie name is "oscd_UID" and is used the User ID space in work with the common authentication sessions table, and the cookie name is "oscd_UID_{PrjNm}" in the work without that. To facilitate with Web-based interfaces, the module provides for automatic login from the specified user's name. Configuring for the automatic login makes by the module settings page (Fig.3). Automatic login performs by matching the address indicated in the column "Address", and on behalf of the user specified in the column "User". For greater security, you can only identify Web users in the list of users allowed to authenticate. == {{Anch|ModsHTTP|Modules of the WEB-interface}} == Modules of the user interface (UI) designed to work with the HTTP module, should indicate the information field "SubType" in the value "WWW" and "Auth" field in the value "1", if the module requires an authentication at login. For communication of the HTTP module and the UI modules an advanced communication mechanism is used. This mechanism involves export of interface functions. In this case, the UI modules must export only one generic function for all methods: * '''void HTTP(const string &meth, const string &uri, string &page, vector<string> &vars, const string &user, TProtocolIn *iprt);''': ::''meth'' — method of the request; ::''uri'' — local address of the request; ::''page'' — page with the answer; ::''sender'' — address of the sender; ::''vars'' — variables of the request; ::''user'' — user, can contain previous user in the second line; ::''iprt'' — pointer to an input part object of the protocol. Or following different functions separately for GET and POST methods: * '''void HTTP_GET(const string &uri, string &page, vector<string> &vars, const string &user, TProtocolIn *iprt);''' OR :'''void HttpGet( const string &uri, string &page, const string &sender, vector<string> &vars, const string &user );''' — GET method with the parameters: ::''uri'' — local address of the request; ::''page'' — page with the answer; ::''sender'' — address of the sender; ::''vars'' — variables of the request; ::''user'' — user, can contain previous user in the second line; ::''iprt'' — pointer to an input part object of the protocol. * '''void HTTP_POST(const string &uri, string &page, vector<string> &vars, const string &user, TProtocolIn *iprt);''' OR :'''void HttpPost( const string &uri, string &page, const string &sender, vector<string> &vars, const string &user );''' — POST method with the parameters: ::''uri'' — local address of the request; ::''page'' — page with the answer and with the content of the body of the POST request; ::''sender'' — address of the sender; ::''vars'' — variables of the request; ::''user'' — user, can contain previous user in the second line; ::''iprt'' — pointer to an input part object of the protocol. Then, in the case of the HTTP "GET" request, the function "HTTP_GET" or "HttpGet" will be called, and in the case of the "POST" request, the function "HTTP_POST" or "HttpPost" will be called in the appropriate UI module, or the function "HTTP" for any method. == Function of the output requests of the user API == The output request function [[Special:MyLanguage/Documents/User_API#SYSTransport|messIO()]] operates the exchange of contents of HTTP requests wrapped in XML packets. The query structure has the form: <syntaxhighlight lang="XML"> <req Host="host" URI="uri"> <prm id="pId">pVal</prm> <cnt name="cName" filename="cFileName"> <prm id="cpId">cpVal</prm> cVal </cnt> reqVal </req> </syntaxhighlight> :Where: :* ''req'' — request method, supported methods "GET" and "POST". :* ''host'' — http-server address in the format ''{HostAddr}:{HostIp}''. If this field is omitted, then the host address specified in the transport address field is used. :* ''uri'' — resource address at the http server, file or directory. :* ''pId'', ''pVal'' — identifier and value of addition http-parameters. You can set multiply http-parameters setting different ''prm'' tags. :* ''cName'', ''cFileName'', ''cVal'' — name, file-name and value of the content-element of the POST-request. You can set multiply content-elements setting different ''cnt'' tags. :* ''cpId'', ''cpVal'' — identifier and value of addition content-parameters. You can set multiply content-parameters setting different ''prm'' tags; :* ''reqVal'' — single content of the POST request. The query result is the response structure: <syntaxhighlight lang="XML"> <req Host="host" URI="uri" err="err" Protocol="prt" RezCod="rCod" RezStr="rStr"> <prm id="pId">pVal</prm> respVal </req> </syntaxhighlight> :Where: :* ''req'' — request method. :* ''host'' — http-server address. :* ''uri'' — resource address. :* ''err'' — error occurring during the request. In the case of a successful request, this field is empty. :* ''RezCod'', ''RezStr'' — query result in the form of code and text. :* ''pId'', ''pVal'' — identifier and value of the addition http-parameter. Http-parameters can be many, defined by the individual ''prm'' tags. :* ''respVal'' — content of the response. Here is the formation of GET and POST requests in the JavaLikeCalc.JavaScript language, as an example of using this function in user procedures: <syntaxhighlight lang="JavaScript"> //GET request for a HTML-page req = SYS.XMLNode("GET"); req.setAttr("URI","/"); SYS.Transport.Sockets.out_testHTTP.messIO(req,"HTTP"); test = req.text(); //GET request and saving a file req = SYS.XMLNode("GET"); req.setAttr("URI","/oscadaArch/Work/openscada-0.9-r2188.tar.lzma"); SYS.Transport.Sockets.out_testHTTP.messIO(req,"HTTP"); if(!req.attr("err").length) SYS.fileWrite("/var/tmp/recvFile.tmp", req.text()); //POST request req = SYS.XMLNode("POST"); req.setAttr("URI","/WebUser/FlowTec.txt"); cntNode = req.childAdd("cnt").setAttr("name","pole0").setAttr("filename","Object2-k001-100309-17.txt"); cntNode.childAdd("prm").setAttr("id","Content-Type").setText("text/plain"); cntText = "Object2-k001\r\n"; cntText += "\r\n"; cntText += "v002\r\n"; cntText += " n1\r\n"; cntText += " 09.03.10 16 Polnyj 7155.25 216.0 32.000 17.5\r\n"; cntText += "v005\r\n"; cntText += " n1\r\n"; cntText += " 09.03.10 16 Polnyj 188.81 350.0 4.000 40.0\r\n"; cntText += "\r\n"; cntNode.setText(cntText); SYS.Transport.Sockets.out_testHTTP.messIO(req,"HTTP"); //POST request with single content req = SYS.XMLNode("POST"); req.setAttr("URI","/WebUser/FlowTec.txt"); req.childAdd("prm").setAttr("id","Content-Type").setText("text/plain"); cntText = "Object2-k001\r\n"; cntText += "\r\n"; cntText += "v002\r\n"; cntText += " n1\r\n"; cntText += " 09.03.10 16 Polnyj 7155.25 216.0 32.000 17.5\r\n"; cntText += "v005\r\n"; cntText += " n1\r\n"; cntText += " 09.03.10 16 Polnyj 188.81 350.0 4.000 40.0\r\n"; cntText += "\r\n"; req.setText(cntText); SYS.Transport.Sockets.out_testHTTP.messIO(req,"HTTP"); </syntaxhighlight> == User programming API == <section begin=API /> '''Input part of the module object (SYS.Protocol.HTTP.{In})''' * ''bool setUser( string user )'' — changes the user linked to the authentication session ID. ** ''user'' — user to change. * ''bool pgAccess(string URL)'' — checks for accessing the page, pointed by the ''URL''. ** ''URL'' — URL of the checking page. * ''string pgCreator(string cnt, string rcode = "", string httpattrs = "Content-Type: text/html;charset={SYS}", string htmlHeadEls = "", string forceTmplFile = "" )'' — forms for a page or a resource from the content ''cnt'', wrapped to HTTP with the result ''rcode'', with HTTP additional attributes ''httpattrs'', HTML additional head's element ''htmlHeadEls'', forced to template file ''forceTmplFile''. ** ''cnt'' — content of the page or the resource (images, XML, CSS, JavaScript, ...) ; ** ''rcode'' — HTTP result code, like to "200 OK"; empty value there disables addition of the HTTP header; ** ''httpattrs'' — additional HTTP-attributes, mostly this is "Content-Type" which by default sets to "text/html;charset={SYS}"; only for "Content-Type: text/html" will be wrapped to internal/service or force ''forceTmplFile'' HTML-template; ** ''htmlHeadEls'' — additional HTML-header's tag, it's mostly META with "Refresh" to the specified URL; ** ''forceTmplFile'' — force template file to override the internal/service or the main-page template. <section end=API />
Navigation menu
OpenSCADA
Site
Download
Old Wiki
OpenSCADA Wiki
Home
About OpenSCADA
Functions and demands
Tasks
Using
Fund
Recent changes
Random page
Search
Tools
Special pages
Printable version
MediaWiki
Help
Personal tools
English
Log in