Cookie Handling
This commit is contained in:
parent
5f81ea4ebf
commit
d2429b4b9a
4 changed files with 20 additions and 5 deletions
3
lweb.pbi
3
lweb.pbi
|
@ -778,6 +778,9 @@ Module lhs_web
|
|||
Else
|
||||
Header(#http_head_status) = "200 OK"
|
||||
EndIf
|
||||
If Response(#http_head_set_cookie) <> ""
|
||||
Header(#http_head_set_cookie) = Response(#http_head_set_cookie)
|
||||
EndIf
|
||||
|
||||
Header(#http_head_content_length) = Str(thread_data_size)
|
||||
Header(#http_head_content_type) = thread_type
|
||||
|
|
8
lweb.pbp
8
lweb.pbp
|
@ -8,7 +8,7 @@
|
|||
<section name="data">
|
||||
<explorer view="../../../bin/purebasic/examples/" pattern="0"/>
|
||||
<log show="1"/>
|
||||
<lastopen date="2020-12-01 19:05" user="renlin" host="linux-mvsk"/>
|
||||
<lastopen date="2020-12-10 14:36" user="renlin" host="linux-mvsk"/>
|
||||
</section>
|
||||
<section name="files">
|
||||
<file name="inc/lweb_file_cache.pbi">
|
||||
|
@ -53,11 +53,11 @@
|
|||
</file>
|
||||
<file name="ltls.pbi">
|
||||
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="+"/>
|
||||
<fingerprint md5="4eb44cc5a5ded25e6fb846e383bde4d4"/>
|
||||
<fingerprint md5="efc4d65a4adb80fc827e361e97db90f2"/>
|
||||
</file>
|
||||
<file name="lweb.pbi">
|
||||
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="+"/>
|
||||
<fingerprint md5="2cfde7875923d4d1579b7dfc9d36a86f"/>
|
||||
<fingerprint md5="d5a653369623d1188bf1c0e5c87fcd7e"/>
|
||||
</file>
|
||||
<file name="lweb_header.pbi">
|
||||
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="+"/>
|
||||
|
@ -65,7 +65,7 @@
|
|||
</file>
|
||||
<file name="server_example.pb">
|
||||
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="+"/>
|
||||
<fingerprint md5="673ffbaa7cffa71aa8800de858882da9"/>
|
||||
<fingerprint md5="8fd31e2ee49fe63d07942aa8d2672094"/>
|
||||
</file>
|
||||
</section>
|
||||
<section name="targets">
|
||||
|
|
|
@ -82,6 +82,8 @@ DeclareModule lhs_web
|
|||
#http_head_content_type = "content-type:"
|
||||
#http_head_connection = "connection:"
|
||||
#http_head_keep_alive = "keep-alive:"
|
||||
#http_head_cookie = "cookie:"
|
||||
#http_head_set_cookie = "set-cookie:"
|
||||
|
||||
#http_content_type_application_x_www_form_urlencoded = "application/x-www-form-urlencoded"
|
||||
#http_content_type_multipart_form_data = "multipart/form-data"
|
||||
|
|
|
@ -44,10 +44,16 @@ Procedure.s Sample_Header(Map Header.s())
|
|||
Define *Text
|
||||
Define.s Encoded, ZumSenden, TBD, Text
|
||||
NewMap Response.s()
|
||||
If Header("cookie:") <> ""
|
||||
Debug "A Cookie is set :" + Header("cookie:")
|
||||
Else
|
||||
Debug "No Cookie."
|
||||
EndIf
|
||||
|
||||
TBD="<div><div><h1>Header</h1></div><br/>"+#CRLF$
|
||||
ResetMap(Header())
|
||||
While NextMapElement(Header())
|
||||
TBD = TBD+"<div>"+MapKey(Header())+" : "+Header()+" </div><br/>"+#CRLF$
|
||||
TBD = TBD+"<div>"+MapKey(Header())+" "+Header()+" </div><br/>"+#CRLF$
|
||||
Wend
|
||||
|
||||
Text = "<!DOCTYPE html><html><header><title>Alle Client Headers</title></header><body>"+TBD+"</body></html>"
|
||||
|
@ -59,6 +65,10 @@ Procedure.s Sample_Header(Map Header.s())
|
|||
Response(lhs_web::#cha_R_StringBase64) = Encoded
|
||||
Response(lhs_web::#cha_R_ResponseType) = lhs_web::mimetype("html")
|
||||
Response(lhs_web::#cha_R_http_head_status) = "200 OK"
|
||||
If Header("cookie:") = ""
|
||||
Response(lhs_web::#http_head_set_cookie) = "session=test"
|
||||
EndIf
|
||||
|
||||
ZumSenden = lhs_web::MapToJSONString(Response())
|
||||
Debug "ZumSenden: " + ZumSenden
|
||||
ProcedureReturn ZumSenden
|
||||
|
|
Loading…
Reference in a new issue