| 386 | } |
| 387 | |
| 388 | static int url_at(const uint32_t *t, int n, int p, url_cache_t *uc) { |
| 389 | if (lit_at(t, n, p, "https://") || lit_at(t, n, p, "http://") || lit_at(t, n, p, "ftp://") || |
| 390 | lit_at(t, n, p, "file://")) { |
| 391 | int q = p; |
| 392 | while (t[q] != '/') { |
| 393 | q++; |
| 394 | } |
| 395 | q += 2; |
| 396 | if (q < n && !pdf_u_space(t[q])) { |
| 397 | return run_end_from(t, n, q); |
| 398 | } |
| 399 | } |
| 400 | if (lit_at(t, n, p, "www.") && p + 4 < n && !pdf_u_space(t[p + 4])) { |
| 401 | return run_end_from(t, n, p + 4); |
| 402 | } |
| 403 | if (pdf_u_space(t[p])) { |
| 404 | return -1; |
| 405 | } |
| 406 | url_cache_run(t, n, p, uc); |
| 407 | if (uc->at > p) { |
| 408 | return uc->at_end; |
| 409 | } |
| 410 | return -1; |
| 411 | } |
| 412 | |
| 413 | /* PATH_RE's body after the optional prefix: (?:[seg]+/)+[tail]*[end] */ |
| 414 | static int path_body(const uint32_t *t, int n, int q) { |
no test coverage detected