-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[URLSession] Refactor common protocol code into a new class #1355
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
Conversation
Looks like there's some problem here? Status checks still running. |
They were going to take the systems down to install new versions of Xcode - there was a mail out about it. We should try kicking it off again later. |
@swift-ci please test |
70d6d78
to
647ba90
Compare
TransferState has 1-on-1 relationship with EasyHandle and is independent of protocol.Hence it has been moved out of the http folder
Common implementation of header parsing has been moved to new file Message.swift and the code specific to HTTP has been retained in HTTPMessage.swift
The new class called NativeProtocol now contains a protocol-agnostic implementation which is currently used by HTTPURLProtocol, and in future will be used by other native protocols - FTP, Data etc.
647ba90
to
86c1f65
Compare
Splitting the commits to improve readability of each commit. |
@swift-ci please test |
1 similar comment
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we split this up into separate PRs that can be independently tested and reviewed?
I appreciate that you've split the commits up, but in fact, the commits won't build independently (because you've defined the build file to move the files in one commit, then performed the move in another commit). As such anyone doing bisect-style debugging might land on something that hasn't been tested and isn't going to work.
You've also mixed a couple of things here; there are a couple of moves, and an extracted class. I'd prefer these to be done in separate PRs, because then they can be tested independently of one another (and so that it's easier to review them - GitHub isn't great at showing you single commits for review purposes).
I'd recommend doing the moves first (along with the changes to references in the Xcode project), then we can test and build that - after that's done, we can look at the refactoring.
I agree with Al. |
@alblue Thanks for the review .The code under TransferState.swift and Message.swift are extensions of _NativeProtocol class.So to compile TransferState.swift and Message.swift individually _NativeProtocol class should be in place.Hence I had to raise the PR with movement and refactoring together. |
The new class called
NativeProtocol
now contains a protocol-agnostic implementation which is currently used by HTTPURLProtocol, and in future will be used by other native protocols - FTP, Data etc.TransferState has 1-on-1 relationship with EasyHandle and is independent of protocol.Hence it has been moved out of the
http
folder.HTTPCharacters
has been renamed toDelimiters
which has characters or delimiters like CRLF which is common across the protocols.eg: FTP headers and HTTP headers end with CRLF characters.
Common implementation of header parsing has been moved to new file
Message.swift
and the code specific toHTTP
has been retained in HTTPMessage.swift.