The Trunk: Network-ul.43.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Network-ul.43.mcz

commits-2
Levente Uzonyi uploaded a new version of Network to project The Trunk:
http://source.squeak.org/trunk/Network-ul.43.mcz

==================== Summary ====================

Name: Network-ul.43
Author: ul
Time: 14 December 2009, 2:59:36 am
UUID: e14321f4-7104-4745-bda1-c3138b4f537f
Ancestors: Network-ar.42

- fix: use isKindOf: String instead of class == String

=============== Diff against Network-ar.42 ===============

Item was changed:
  ----- Method: HTTPSocket class>>useProxyServerNamed:port: (in category 'proxy settings') -----
  useProxyServerNamed: proxyServerName port: portNum
  "Direct all HTTP requests to the HTTP proxy server with the given name and port number."
 
  proxyServerName ifNil: [  "clear proxy settings"
  self httpProxyServer: nil.
  self httpProxyPort: 80.
  ^ self].
 
  proxyServerName isString
  ifFalse: [self error: 'Server name must be a String or nil'].
  self httpProxyServer: proxyServerName.
 
  self httpProxyPort: portNum.
+ (self httpProxyPort isKindOf: String) ifTrue: [HTTPPort := portNum asNumber].
- self httpProxyPort class == String ifTrue: [HTTPPort := portNum asNumber].
  self httpProxyPort ifNil: [self httpProxyPort: self defaultPort].!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Network-ul.43.mcz

Igor Stasenko
2009/12/14  <[hidden email]>:

> Levente Uzonyi uploaded a new version of Network to project The Trunk:
> http://source.squeak.org/trunk/Network-ul.43.mcz
>
> ==================== Summary ====================
>
> Name: Network-ul.43
> Author: ul
> Time: 14 December 2009, 2:59:36 am
> UUID: e14321f4-7104-4745-bda1-c3138b4f537f
> Ancestors: Network-ar.42
>
> - fix: use isKindOf: String instead of class == String
>
> =============== Diff against Network-ar.42 ===============
>
> Item was changed:
>  ----- Method: HTTPSocket class>>useProxyServerNamed:port: (in category 'proxy settings') -----
>  useProxyServerNamed: proxyServerName port: portNum
>        "Direct all HTTP requests to the HTTP proxy server with the given name and port number."
>
>        proxyServerName ifNil: [  "clear proxy settings"
>                self httpProxyServer: nil.
>                self httpProxyPort: 80.
>                ^ self].
>
>        proxyServerName isString
>                ifFalse: [self error: 'Server name must be a String or nil'].
>        self httpProxyServer: proxyServerName.
>
>        self httpProxyPort: portNum.
> +       (self httpProxyPort isKindOf: String) ifTrue: [HTTPPort := portNum asNumber].
> -       self httpProxyPort class == String ifTrue: [HTTPPort := portNum asNumber].

why not just do:

portNum ifNotNil: [
  self httpProxyPort: portNum asNumber.
] ifNil: [ ... ]

and get rid of class checking altogether?

>        self httpProxyPort ifNil: [self httpProxyPort: self defaultPort].!
>
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Network-ul.43.mcz

Levente Uzonyi-2
On Mon, 14 Dec 2009, Igor Stasenko wrote:

> why not just do:
>
> portNum ifNotNil: [
>  self httpProxyPort: portNum asNumber.
> ] ifNil: [ ... ]
>
> and get rid of class checking altogether?
>

I didn't look at the code at all, just fixed the issue some way. #isString
would be better than the class check, but your idea is even better. The
"funny" thing is that the HTTPPort variable is never read (I guess this
is the reason why this bug was not fixed before), so something is
broken here.


Levente

>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
>