Parse an HTTP serve address from a "Serving HTTP on http://addr/" line.
(line: &str)
| 252 | |
| 253 | /// Parse an HTTP serve address from a "Serving HTTP on http://addr/" line. |
| 254 | fn parse_http_addr(line: &str) -> Result<SocketAddr> { |
| 255 | line.find("127.0.0.1") |
| 256 | .and_then(|start| { |
| 257 | let addr = &line[start..]; |
| 258 | let end = addr.find('/')?; |
| 259 | addr[..end].parse().ok() |
| 260 | }) |
| 261 | .ok_or_else(|| format_err!("failed to parse HTTP address from: {line}")) |
| 262 | } |
| 263 | |
| 264 | /// Start serve under debugger, continue, and send multiple HTTP requests |
| 265 | /// to verify instance reuse works correctly under the debugger. |
no test coverage detected