Skip to content

Commit

Permalink
Merge branch 'hotfix/Fix_redirect_bug'
Browse files Browse the repository at this point in the history
  • Loading branch information
ktekinay committed Jan 6, 2015
2 parents 0ac5ae3 + b66799b commit 0877ab6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
41 changes: 23 additions & 18 deletions Kaju Classes/Kaju/HTTPSSocket.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,43 @@ Protected Class HTTPSSocket
Inherits HTTPSecureSocket
#tag Method, Flags = &h0
Sub Get(url As String)
self.Secure = IsURLSecure( url )
SetSecure( url )
super.Get( url )
End Sub
#tag EndMethod

#tag Method, Flags = &h0
Sub Get(url As String, file As FolderItem)
self.Secure = IsURLSecure( url )
SetSecure( url )
super.Get( url, file )
End Sub
#tag EndMethod

#tag Method, Flags = &h0
Function Get(url As String, file As FolderItem, timeout As Integer) As Boolean
self.Secure = IsURLSecure( url )
SetSecure( url )
return super.Get( url, file, timeout )
End Function
#tag EndMethod

#tag Method, Flags = &h0
Function Get(url As String, timeout As Integer) As String
self.Secure = IsURLSecure( url )
SetSecure( url )
return super.Get( url, timeout )
End Function
#tag EndMethod

#tag Method, Flags = &h0
Sub GetHeaders(url As String)
self.Secure = IsURLSecure( url )
SetSecure( url )
super.GetHeaders( url )

End Sub
#tag EndMethod

#tag Method, Flags = &h0
Function GetHeaders(url As String, timeout As Integer) As InternetHeaders
self.Secure = IsURLSecure( url )
SetSecure( url )
return super.GetHeaders( url, timeout )
End Function
#tag EndMethod
Expand All @@ -62,7 +62,6 @@ Inherits HTTPSecureSocket
do
dim headers as InternetHeaders = GetHeaders( url, timeout )
if headers is nil then
url = ""
exit
elseif headers.Value( "Location" ) <> "" then
url = headers.Value( "Location" )
Expand All @@ -79,40 +78,46 @@ Inherits HTTPSecureSocket
End Function
#tag EndMethod

#tag Method, Flags = &h21
Private Function IsURLSecure(url As String) As Boolean
return ForceSecure or url.Trim.Left( 8 ) = "https://"
End Function
#tag EndMethod

#tag Method, Flags = &h0
Sub SendRequest(method As String, url As String)
self.Secure = IsURLSecure( url )
SetSecure( url )
super.SendRequest( method, url )
End Sub
#tag EndMethod

#tag Method, Flags = &h0
Sub SendRequest(method As String, url As String, file As FolderItem)
self.Secure = IsURLSecure( url )
SetSecure( url )
super.SendRequest( method, url, file )
End Sub
#tag EndMethod

#tag Method, Flags = &h0
Function SendRequest(method As String, url As String, file As FolderItem, timeout As Integer) As Boolean
self.Secure = IsURLSecure( url )
SetSecure( url )
return super.SendRequest( method, url, file, timeout )
End Function
#tag EndMethod

#tag Method, Flags = &h0
Function SendRequest(method As String, url As String, timeout As Integer) As String
self.Secure = IsURLSecure( url )
SetSecure( url )
return super.SendRequest( method, url, timeout )
End Function
#tag EndMethod

#tag Method, Flags = &h21
Private Sub SetSecure(url As String)
if ForceSecure or url.Trim.Left( 8 ) = "https://" then
self.Secure = true
self.Port = 443
else
self.Secure = false
self.Port = 80
end if
End Sub
#tag EndMethod


#tag Property, Flags = &h0
ForceSecure As Boolean
Expand Down Expand Up @@ -154,7 +159,7 @@ Inherits HTTPSecureSocket
#tag ViewProperty
Name="ForceSecure"
Group="Behavior"
Type="Integer"
Type="Boolean"
#tag EndViewProperty
#tag ViewProperty
Name="Index"
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,4 +301,8 @@ No. Thanks to John Hansen and code he provided on the [Xojo Forums](https://foru

1.0 (Jan. 5, 2015)

- Initial release.
- Initial release.

1.0.1 (Jan. 5, 2015)

- Fixed redirect bug.

0 comments on commit 0877ab6

Please sign in to comment.