Skip to content

Commit

Permalink
Merge pull request #92 from yawillianpsb/fix_multipart_requests
Browse files Browse the repository at this point in the history
Fixed an infinite loop blocking bug related to multipart requests
  • Loading branch information
pmusolino authored Sep 7, 2020
2 parents dd9cde0 + f118a24 commit 5fc7811
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
12 changes: 1 addition & 11 deletions Sources/CustomHTTPProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,7 @@ public class CustomHTTPProtocol: URLProtocol {
}

private func body(from request: URLRequest) -> Data? {
return request.httpBody ?? request.httpBodyStream.flatMap { stream in
let data = NSMutableData()
stream.open()
while stream.hasBytesAvailable {
var buffer = [UInt8](repeating: 0, count: 1024)
let length = stream.read(&buffer, maxLength: buffer.count)
data.append(buffer, length: length)
}
stream.close()
return data as Data
}
return request.httpBody
}

/// Inspects the request to see if the host has not been blacklisted and can be handled by this URL protocol.
Expand Down
2 changes: 1 addition & 1 deletion Wormholy.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Wormholy"
s.version = "1.6.2"
s.version = "1.6.3"
s.summary = "Network debugging made easy"
s.description = <<-DESC
Start debugging iOS network calls like a wizard, without extra code! Wormholy makes debugging quick and reliable.
Expand Down

0 comments on commit 5fc7811

Please sign in to comment.