Ground0
2cbfdceaac
Every Include should now have some procedure who are standalone usable. lweb_http Has a lot of changes todo (Full HTTP 1.1 Compliance) lweb_file_cache, is realy buggy. A lot of todo's lweb_IP is Only IsIPStringValid in lweb_helper, there is only some help procedures. To Do: lweb_http_post (Everything Post Specific) lweb_http_get (Everything Get Specific) lweb_http_put (Complete todo nothing done until now) lweb_server_http (Specific http only Server) lweb_server_https (Specific https only Server) lweb_server (Common Server Things) Maybe everything more generic to use standalone...
40 lines
No EOL
1.2 KiB
Text
40 lines
No EOL
1.2 KiB
Text
;********************************
|
|
;*
|
|
;* lweb_IP.pbi
|
|
;*
|
|
|
|
|
|
Procedure IsIPStringValid(Adress.s)
|
|
Static My_Regex_v4
|
|
Static My_Regex_v6_nocompress
|
|
Static My_Regex_v6_compress
|
|
Static Valid = 0
|
|
|
|
My_Regex_v4 = CreateRegularExpression(#PB_Any, "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$")
|
|
My_Regex_v6_nocompress = CreateRegularExpression(#PB_Any, "^[0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){7}$")
|
|
My_Regex_v6_compress = CreateRegularExpression(#PB_Any, "^(([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,5})?)::(([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,5})?)$")
|
|
|
|
If MatchRegularExpression(My_Regex_v4, Adress) And Valid = 0
|
|
Debug "My_Regex_v4"
|
|
Valid = 1
|
|
EndIf
|
|
If MatchRegularExpression(My_Regex_v6_nocompress, Adress) And Valid = 0
|
|
Debug "My_Regex_v6_nocompress"
|
|
Valid = 1
|
|
EndIf
|
|
If MatchRegularExpression(My_Regex_v6_compress, Adress) And Valid = 0
|
|
Debug "My_Regex_v6_compress"
|
|
Valid = 1
|
|
EndIf
|
|
|
|
FreeRegularExpression(My_Regex_v4)
|
|
FreeRegularExpression(My_Regex_v6_nocompress)
|
|
FreeRegularExpression(My_Regex_v6_compress)
|
|
|
|
If Valid = 1
|
|
ProcedureReturn #True
|
|
Else
|
|
ProcedureReturn #False
|
|
EndIf
|
|
|
|
EndProcedure |