File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -221,7 +221,7 @@ impl<'a> RobotFileParser<'a> {
221
221
disallow_all : Cell :: new ( false ) ,
222
222
allow_all : Cell :: new ( false ) ,
223
223
url : parsed_url. clone ( ) ,
224
- host : parsed_url. domain ( ) . unwrap ( ) . to_owned ( ) ,
224
+ host : parsed_url. host_str ( ) . unwrap ( ) . to_owned ( ) ,
225
225
path : parsed_url. path ( ) . to_owned ( ) ,
226
226
last_checked : Cell :: new ( 0i64 ) ,
227
227
}
@@ -246,7 +246,7 @@ impl<'a> RobotFileParser<'a> {
246
246
pub fn set_url < T : AsRef < str > > ( & mut self , url : T ) {
247
247
let parsed_url = Url :: parse ( url. as_ref ( ) ) . unwrap ( ) ;
248
248
self . url = parsed_url. clone ( ) ;
249
- self . host = parsed_url. domain ( ) . unwrap ( ) . to_owned ( ) ;
249
+ self . host = parsed_url. host_str ( ) . unwrap ( ) . to_owned ( ) ;
250
250
self . path = parsed_url. path ( ) . to_owned ( ) ;
251
251
self . last_checked . set ( 0i64 ) ;
252
252
}
Original file line number Diff line number Diff line change @@ -268,3 +268,9 @@ fn test_robots_text_request_rate() {
268
268
let req_rate = parser. get_req_rate ( "Google" ) ;
269
269
assert ! ( req_rate. is_none( ) ) ;
270
270
}
271
+
272
+ #[ test]
273
+ fn test_robots_127_0_0_1 ( ) {
274
+ // Ensure it does not panic
275
+ RobotFileParser :: new ( "http://127.0.0.1:4000/robots.txt" ) ;
276
+ }
You can’t perform that action at this time.
0 commit comments