@@ -311,7 +311,6 @@ extension _EasyHandle {
311
311
///
312
312
/// - SeeAlso: https://curl.haxx.se/libcurl/c/curl_easy_pause.html
313
313
func pauseReceive( ) {
314
- URLSession . printDebug ( " [EasyHandle] pause receive ( \( pauseState) ) " )
315
314
guard !pauseState. contains ( . receivePaused) else { return }
316
315
pauseState. insert ( . receivePaused)
317
316
pauseState. setState ( on: self )
@@ -322,7 +321,6 @@ extension _EasyHandle {
322
321
/// will be called before this method returns.
323
322
/// - SeeAlso: https://curl.haxx.se/libcurl/c/curl_easy_pause.html
324
323
func unpauseReceive( ) {
325
- URLSession . printDebug ( " [EasyHandle] unpause receive ( \( pauseState) ) " )
326
324
guard pauseState. contains ( . receivePaused) else { return }
327
325
pauseState. remove ( . receivePaused)
328
326
pauseState. setState ( on: self )
@@ -331,7 +329,6 @@ extension _EasyHandle {
331
329
///
332
330
/// - SeeAlso: https://curl.haxx.se/libcurl/c/curl_easy_pause.html
333
331
func pauseSend( ) {
334
- URLSession . printDebug ( " [EasyHandle] pause send ( \( pauseState) ) " )
335
332
guard !pauseState. contains ( . sendPaused) else { return }
336
333
pauseState. insert ( . sendPaused)
337
334
pauseState. setState ( on: self )
@@ -342,7 +339,6 @@ extension _EasyHandle {
342
339
/// will be called before this method returns.
343
340
/// - SeeAlso: https://curl.haxx.se/libcurl/c/curl_easy_pause.html
344
341
func unpauseSend( ) {
345
- URLSession . printDebug ( " [EasyHandle] unpause send ( \( pauseState) ) " )
346
342
guard pauseState. contains ( . sendPaused) else { return }
347
343
pauseState. remove ( . sendPaused)
348
344
pauseState. setState ( on: self )
@@ -461,53 +457,45 @@ fileprivate extension _EasyHandle {
461
457
///
462
458
/// - SeeAlso: <https://curl.haxx.se/libcurl/c/CURLOPT_WRITEFUNCTION.html>
463
459
func didReceive( data: UnsafeMutablePointer < Int8 > , size: Int , nmemb: Int ) -> Int {
464
- URLSession . printDebug ( " [EasyHandle] -> write callback \( size * nmemb) " )
465
460
let d : Int = {
466
461
let buffer = Data ( bytes: data, count: size*nmemb)
467
462
switch delegate. didReceive ( data: buffer) {
468
463
case . proceed: return size * nmemb
469
464
case . abort: return 0
470
465
case . pause:
471
- URLSession . printDebug ( " [EasyHandle] pausing receive from callback ( \( pauseState) ) " )
472
466
pauseState. insert ( . receivePaused)
473
467
return Int ( CFURLSessionWriteFuncPause)
474
468
}
475
469
} ( )
476
- URLSession . printDebug ( " [EasyHandle] <- write callback \( d) " )
477
470
return d
478
471
}
479
472
/// This callback function gets called by libcurl when it receives header
480
473
/// data.
481
474
///
482
475
/// - SeeAlso: <https://curl.haxx.se/libcurl/c/CURLOPT_HEADERFUNCTION.html>
483
476
func didReceive( headerData data: UnsafeMutablePointer < Int8 > , size: Int , nmemb: Int , fileLength: Double ) -> Int {
484
- URLSession . printDebug ( " [EasyHandle] -> header callback \( size * nmemb) " )
485
477
self . fileLength = Int64 ( fileLength)
486
478
let d : Int = {
487
479
let buffer = Data ( bytes: data, count: size*nmemb)
488
480
switch delegate. didReceive ( headerData: buffer) {
489
481
case . proceed: return size * nmemb
490
482
case . abort: return 0
491
483
case . pause:
492
- URLSession . printDebug ( " [EasyHandle] pausing receive from callback ( \( pauseState) ) " )
493
484
pauseState. insert ( . receivePaused)
494
485
return Int ( CFURLSessionWriteFuncPause)
495
486
}
496
487
} ( )
497
- URLSession . printDebug ( " [EasyHandle] <- header callback \( d) " )
498
488
return d
499
489
}
500
490
/// This callback function gets called by libcurl when it wants to send data
501
491
/// it to the network.
502
492
///
503
493
/// - SeeAlso: <https://curl.haxx.se/libcurl/c/CURLOPT_READFUNCTION.html>
504
494
func fill( writeBuffer data: UnsafeMutablePointer < Int8 > , size: Int , nmemb: Int ) -> Int {
505
- URLSession . printDebug ( " [EasyHandle] -> read callback \( size * nmemb) " )
506
495
let d : Int = {
507
496
let buffer = UnsafeMutableBufferPointer ( start: data, count: size * nmemb)
508
497
switch delegate. fill ( writeBuffer: buffer) {
509
498
case . pause:
510
- URLSession . printDebug ( " [EasyHandle] pausing send from callback ( \( pauseState) ) " )
511
499
pauseState. insert ( . sendPaused)
512
500
return Int ( CFURLSessionReadFuncPause)
513
501
case . abort:
@@ -516,12 +504,10 @@ fileprivate extension _EasyHandle {
516
504
return length
517
505
}
518
506
} ( )
519
- URLSession . printDebug ( " [EasyHandle] <- read callback \( d) " )
520
507
return d
521
508
}
522
509
523
510
func setSocketOptions( for fd: CInt ) throws {
524
- URLSession . printDebug ( " [EasyHandle] -- socket options callback \( fd) " )
525
511
//TODO: At this point we should call setsockopt(2) to set the QoS on
526
512
// the socket based on the QoS of the request.
527
513
//
@@ -539,7 +525,6 @@ fileprivate extension _EasyHandle {
539
525
}
540
526
541
527
func seekInputStream( offset: Int64 , origin: CInt ) -> CInt {
542
- URLSession . printDebug ( " [EasyHandle] -> seek callback \( offset) \( origin) " )
543
528
let d : Int32 = {
544
529
/// libcurl should only use SEEK_SET
545
530
guard origin == SEEK_SET else { fatalError ( " Unexpected 'origin' in seek. " ) }
@@ -550,7 +535,6 @@ fileprivate extension _EasyHandle {
550
535
return CFURLSessionSeekCantSeek
551
536
}
552
537
} ( )
553
- URLSession . printDebug ( " [EasyHandle] <- seek callback \( d) " )
554
538
return d
555
539
}
556
540
}
0 commit comments