Skip to content

Commit

Permalink
Merge 51ed0ec
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins committed Jun 3, 2024
2 parents 9fd970c + 51ed0ec commit b32696a
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ setupTLSTo: url
connection sslSession certificateName: self certificate.

[ connection sslSession serverName: url host ]
on: PrimitiveFailed
on: (ZnUtils exceptionSet: #( #SocketError #PrimitiveFailed ))
do: [ :error | "log it?" ].

connection connect

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ readRequestBadExceptionSet
"Return the set of exceptions which, when they occur while reading a request,
are interpreted as equivalent to a request parse error or bad request."

^ self
^ ZnUtils
exceptionSet:
#(#ZnParseError #ZnCharacterEncodingError #ZnUnknownScheme #ZnPortNotANumber #ZnTooManyDictionaryEntries #ZnEntityTooLarge)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ readRequestTerminationExceptionSet
"Return the set of exceptions which, when they occur while reading a request,
are interpreted as equivalent to a timeout or connection close."

^ self
^ ZnUtils
exceptionSet:
#(#ConnectionClosed #ConnectionTimedOut #PrimitiveFailed)
#(#ConnectionClosed #ConnectionTimedOut #SocketError #PrimitiveFailed)
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ writeResponseTerminationExceptionSet
"Return the set of exceptions which, when they occur while writing a response,
are interpreted as equivalent to a timeout or connection close."

^ self exceptionSet: #(#ConnectionClosed #ConnectionTimedOut #PrimitiveFailed)
^ ZnUtils
exceptionSet:
#(#ConnectionClosed #ConnectionTimedOut #SocketError #PrimitiveFailed)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
converting
exceptionSet: classNames
^ classNames inject: ExceptionSet new into: [ :set :each |
(Smalltalk globals includesKey: each)
ifTrue: [
set
add: (Smalltalk at: each);
yourself ]
ifFalse: [ set ] ]
8 changes: 0 additions & 8 deletions repository/Zinc-HTTP.package/monticello.meta/categories.st
Original file line number Diff line number Diff line change
@@ -1,8 +0,0 @@
SystemOrganization addCategory: #'Zinc-HTTP'!
SystemOrganization addCategory: #'Zinc-HTTP-Client-Server'!
SystemOrganization addCategory: #'Zinc-HTTP-Core'!
SystemOrganization addCategory: #'Zinc-HTTP-Exceptions'!
SystemOrganization addCategory: #'Zinc-HTTP-Logging'!
SystemOrganization addCategory: #'Zinc-HTTP-Streaming'!
SystemOrganization addCategory: #'Zinc-HTTP-Support'!
SystemOrganization addCategory: #'Zinc-HTTP-Variables'!
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
testing
testLogging

| client logEventCollection count |
logEventCollection := OrderedCollection new.
ZnLogEvent announcer
when: ZnLogEvent do: [ :event | logEventCollection add: event ].
when: ZnLogEvent
do: [ :event | logEventCollection add: event ]
for: self.
(client := ZnClient new)
clientId: #C1;
beOneShot.
client get: self smallHtmlUrl.
client close.
count := ZnLogEvent announcer numberOfSubscriptions.
ZnLogEvent announcer
unsubscribe: self.
self assert: ZnLogEvent announcer numberOfSubscriptions equals: count -1.
ZnLogEvent announcer unsubscribe: self.
self
assert: ZnLogEvent announcer numberOfSubscriptions
equals: count - 1.
self deny: logEventCollection isEmpty.
self assert: logEventCollection anyOne clientId equals: #C1
Original file line number Diff line number Diff line change
@@ -1,27 +1,40 @@
tests
testLogging

| client logEventCollection count renderedLogEvents |
logEventCollection := OrderedCollection new.
ZnLogEvent announcer
when: ZnLogEvent do: [ :event | logEventCollection add: event ].
when: ZnLogEvent
do: [ :event | logEventCollection add: event ]
for: self.
self withServerDo: [ :server |
1 to: 3 do: [ :logLevel |
server serverId: ('S' , logLevel asString) ; logLevel: logLevel.
server
serverId: 'S' , logLevel asString;
logLevel: logLevel.
client := ZnClient new.
client clientId: ('C' , logLevel asString); logLevel: logLevel.
client
clientId: 'C' , logLevel asString;
logLevel: logLevel.
client get: (server localUrl addPathSegment: #small).
self assert: client isSuccess.
client get: (server localUrl addPathSegment: #error).
self deny: client isSuccess.
server delegate map: #redirect to: [ :request | ZnResponse redirect: #welcome ].
server delegate
map: #redirect
to: [ :request | ZnResponse redirect: #welcome ].
client get: (server localUrl addPathSegment: #redirect).
self assert: client isSuccess.
self assert: client isSuccess.
client close ] ].
count := ZnLogEvent announcer numberOfSubscriptions.
ZnLogEvent announcer
unsubscribe: self.
self assert: ZnLogEvent announcer numberOfSubscriptions equals: count -1.
ZnLogEvent announcer unsubscribe: self.
self
assert: ZnLogEvent announcer numberOfSubscriptions
equals: count - 1.
self deny: logEventCollection isEmpty.
renderedLogEvents := String streamContents: [ :out |
logEventCollection do: [ :event | out print: event; cr ] ].
renderedLogEvents := String streamContents: [ :out |
logEventCollection do: [ :event |
out
print: event;
cr ] ].
self deny: renderedLogEvents isEmpty
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
SystemOrganization addCategory: #'Zinc-Tests'!

0 comments on commit b32696a

Please sign in to comment.