189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
-
-
-
|
catch {
tclLog [appendArgs \
[pid] " : " [clock seconds] " : http : " $string]
}
}
}
#
# NOTE: This procedure was stolen from the "common.tcl" script. It is
# designed to setup the pending progress indicator callback and
# save its working state.
#
proc setupPageProgress { channel type milliseconds } {
#
# NOTE: This variable is used to keep track of the currently scheduled
# (i.e. pending) [after] event.
#
variable afterForPageProgress
#
# NOTE: Scheduled the necessary [after] event, using the [pageProgress]
# procedure, which is defined further down in this file.
#
set afterForPageProgress [after $milliseconds [namespace code \
[list pageProgress $channel $type $milliseconds]]]
}
#
# NOTE: This procedure was stolen from the "common.tcl" script. It is
# designed to cancel the pending progress indicator callback and
# cleanup its working state.
#
proc cancelPageProgress {} {
#
# NOTE: This variable is used to keep track of the currently scheduled
# (i.e. pending) [after] event.
#
variable afterForPageProgress
#
# NOTE: If there is a currently scheduled [after] event, cancel it.
#
if {[info exists afterForPageProgress]} then {
catch {after cancel $afterForPageProgress}
unset -nocomplain afterForPageProgress
}
}
#
# NOTE: This procedure was stolen from the "common.tcl" script. It is
# designed to emit a progress indicator while an HTTP request is
# being processed. The channel argument is the Tcl channel where
# the progress indicator should be emitted. The type argument is
# the single-character progress indicator. The milliseconds
# argument is the number of milliseconds to wait until the next
# periodic progress indicator should be emitted. This procedure
# reschedules its own execution.
#
proc pageProgress { channel type milliseconds } {
#
# NOTE: This variable is used to keep track of the currently scheduled
# (i.e. pending) [after] event.
#
variable afterForPageProgress
#
# NOTE: Show that something is happening...
#
pageOut $channel $type
#
# NOTE: Make sure that we are scheduled to run again, if requested.
# NOTE: Make sure that we are scheduled to run again, if requested;
# also, before doing that, make sure there is not already an
# associated [after] event pending.
#
cancelPageProgress
if {$milliseconds > 0} then {
set afterForPageProgress [after $milliseconds \
[namespace code [list pageProgress $channel $type \
setupPageProgress $channel $type $milliseconds
$milliseconds]]]
} else {
unset -nocomplain afterForPageProgress
}
}
#
# NOTE: This procedure was stolen from the "common.tcl" script. It is
# designed to process a single HTTP request, including any HTTP
# 3XX redirects (up to the specified limit), and return the raw
|
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
|
303
304
305
306
307
308
309
310
311
312
313
314
315
316
|
-
-
-
-
-
-
|
#
# NOTE: This variable is used to determine if plain HTTP is allowed if
# an HTTP redirect response contains an HTTP URI and the original
# URI was HTTPS.
#
variable allowInsecureRedirect
#
# NOTE: This variable is used to keep track of the currently scheduled
# (i.e. pending) [after] event.
#
variable afterForPageProgress
#
# NOTE: This variable is used to determine the timeout milliseconds for
# HTTP requests.
#
variable timeoutGetUrl
#
|
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
|
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
|
-
-
-
+
-
|
}
}
}
#
# NOTE: If there is a currently scheduled [after] event, cancel it.
#
if {[info exists afterForPageProgress]} then {
catch {after cancel $afterForPageProgress}
unset -nocomplain afterForPageProgress
cancelPageProgress
}
#
# NOTE: If progress messages were emitted, start a fresh line.
#
if {!$quiet} then {
pageOut $channel [appendArgs " " $uri \n]
}
|