-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Add redirect follow feature #934
Conversation
416e8e0
to
ea79bdb
Compare
src/http.rs
Outdated
.to_str() | ||
.unwrap() | ||
.to_string(); | ||
println!("Redirecting to {}...", &new_url_string); |
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.
Make this a debug!()
@@ -33,24 +31,46 @@ pub fn get_client() -> Client<Connector, hyper::Body> { | |||
pub fn fetch_sync_string(module_name: &str) -> DenoResult<String> { |
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.
It would be very nice to have a unit test here... Not necessary but can you try uncommenting the test below? Maybe it has spontaneously been fixed...
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.
Seems that test would still get stuck
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.
I think there is a bug similar to #919 here, adding a println!
in the test unblocks the 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.
Ugh. Ok. Good find - I will look into it tomorrow
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.
@ry Actually, tests somehow start to run again by removing the outer tokio_util::block_on
. There is already another block_on
inside of fetch_sync_string
so it is not needed.
More mysteries to solve...
(At least we have runnable unit tests)
Apologies in advance if you intended to address it here and just didn't get to it yet or something like that: Glad to see #931 addressed so quickly, but the description says that this also closes #930. It does fix the original problem that led me to find those two issues, but I don't see how it really fixes #930. deno shouldn't be resolving |
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.
LGTM - thanks Kevin - especially for adding the tests. Sorry for the delay.
s = SocketServer.TCPServer(("", REDIRECT_PORT), Handler) | ||
print "Deno redirect server http:https://localhost:%d/ -> http:https://localhost:%d/" % ( | ||
REDIRECT_PORT, PORT) | ||
return s |
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.
Cool - well done
Can you rebase? |
46e81e9
to
d2f27eb
Compare
@ry No hurries! Rebased. |
- Add --types command line flag. - Add metrics() - Add redirect follow feature denoland#934 - Fix clearTimer bug denoland#942 - Improve error printing denoland#935 - Expose I/O interfaces Closer, Seeker, ReaderCloser, WriteCloser, ReadSeeker, WriteSeeker, ReadWriteCloser, ReadWriteSeeker - Fix silent death on double await denoland#919 - Add Conn.closeRead() and Conn.closeWrite() denoland#903
- Fix promise reject issue (denoland#936) - Add --types command line flag. - Add metrics() - Add redirect follow feature denoland#934 - Fix clearTimer bug denoland#942 - Improve error printing denoland#935 - Expose I/O interfaces Closer, Seeker, ReaderCloser, WriteCloser, ReadSeeker, WriteSeeker, ReadWriteCloser, ReadWriteSeeker - Fix silent death on double await denoland#919 - Add Conn.closeRead() and Conn.closeWrite() denoland#903
- Fix promise reject issue (#936) - Add --types command line flag. - Add metrics() - Add redirect follow feature #934 - Fix clearTimer bug #942 - Improve error printing #935 - Expose I/O interfaces Closer, Seeker, ReaderCloser, WriteCloser, ReadSeeker, WriteSeeker, ReadWriteCloser, ReadWriteSeeker - Fix silent death on double await #919 - Add Conn.closeRead() and Conn.closeWrite() #903
Closes #931
fetch_sync_string
now follows redirect.There was something called
RedirectPolicy
in an older version of hyper, but is currently dropped. I admit the code does not look very elegant, would try to simplify...