Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed an infinite loop blocking bug related to multipart requests #92

Merged
merged 1 commit into from
Sep 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds good to me, at least for the moment since it's better to not show the body rather than send the app in an infinite loop.
I opened a related issue here #93

}

/// 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