Exactly that :)

https://pharo.fogbugz.com/f/cases/21822/Fix-Zn-Tests-due-to-encrypted-google-com-moving

https://github.com/pharo-project/pharo/pull/1290

On Thu, May 3, 2018 at 5:18 PM, Sven Van Caekenberghe <[email protected]> wrote:

>
>
> > On 3 May 2018, at 17:12, Guillermo Polito <[email protected]>
> wrote:
> >
> > Hi all,
> >
> > There are a couple of Zn tests that are failing not even in the CI but
> locally in my machine.
> > This happens because the tests are trying to do a request to
> >
> > encrypted.google.com
> >
> > and expecting a 200, but they are instead receiving:
> >
> > 301 Moved Permanently text/html
> >
> > From the response, I guess we should do the request to
> >
> > https://www.google.com/search?q=Smalltalk
> >
> > instead.
> >
> > This solves the failures on my side. Sven, is that Ok if we push those
> patches to the tests to Pharo?
>
> Right, these would be the changed versions then:
>
> testPlain
>         | query stream request response |
>         self isNativeSSLPluginPresent ifFalse: [ ^ self ].
>         query := 'Smalltalk'.
>         stream := ZdcSecureSocketStream openConnectionToHostNamed: '
> www.google.com' port: 443.
>         [
>                 request := String streamContents: [ :out |
>                         out << 'GET /search?q=' << query << ' HTTP/1.1' <<
> String crlf.
>                         out << 'Host: www.google.com' << String crlf.
>                         out << 'Connection: close' << String crlf.
>                         out << String crlf ].
>                 stream connect.
>                 stream nextPutAll: request asByteArray.
>                 stream flush.
>                 response := stream upToEnd asString.
>         ] ensure: [ stream close ].
>         self assert: (response includesSubstring: '200 OK').
>         self assert: (response includesSubstring: 'Google').
>         self assert: (response includesSubstring: 'Smalltalk').
>
> testRequestResponse
>         | query stream request response |
>         self ensureSocketStreamFactory.
>         self isNativeSSLPluginPresent ifFalse: [ ^ self ].
>         query := 'Smalltalk'.
>         stream := ZdcSecureSocketStream openConnectionToHostNamed: '
> www.google.com' port: 443.
>         [
>                 request := ZnRequest get: 'https://www.google.com/
> search?q=', query.
>                 stream connect.
>                 request writeOn: stream.
>                 stream flush.
>                 response := ZnResponse readFrom: stream.
>         ] ensure: [ stream close ].
>         self assert: response isSuccess.
>         self assert: (response contents includesSubstring: 'Google').
>         self assert: (response contents includesSubstring: 'Smalltalk').
>
> I will apply them upstream as well.
>
> > --
> >
> > Guille Polito
> > Research Engineer
> >
> > Centre de Recherche en Informatique, Signal et Automatique de Lille
> > CRIStAL - UMR 9189
> > French National Center for Scientific Research - http://www.cnrs.fr
> >
> > Web: http://guillep.github.io
> > Phone: +33 06 52 70 66 13
>
>
>


-- 



Guille Polito

Research Engineer

Centre de Recherche en Informatique, Signal et Automatique de Lille

CRIStAL - UMR 9189

French National Center for Scientific Research - *http://www.cnrs.fr
<http://www.cnrs.fr>*


*Web:* *http://guillep.github.io* <http://guillep.github.io>

*Phone: *+33 06 52 70 66 13

Reply via email to