Menu

#162 Use relative URLs instead of full URLs

v1.0 (example)
accepted
None
5
2019-10-21
2019-04-06
Ahasuerus
No

From Jens's message on my Talk page:

Hi, I just noticed that the software is using the full URL for all ISFDB links rendered on a page, which means that depending on page size there can be hundreds of redundant usages of

a href="http://www.isfdb.org/..."

For example, Arthur C. Clark's page currently contains it 2968 times, unnecessarily! By using relative URLs, they can all be removed, which would improve page load time and size even more. For example, it's sufficient for "Recent Edits link to be:

a href="/cgi-bin/recent.cgi"

The slash at the beginning is crucial to make it relative to the root of the site.

Discussion

  • Ahasuerus

    Ahasuerus - 2019-04-06
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -2,10 +2,10 @@
    
     Hi, I just noticed that the software is using the full URL for all ISFDB links rendered on a page, which means that depending on page size there can be hundreds of redundant usages of
    
    -<a href="http://www.isfdb.org/...">
    +a href="http://www.isfdb.org/..."
    
     For example, Arthur C. Clark's page currently contains it 2968 times, unnecessarily! By using relative URLs, they can all be removed, which would improve page load time and size even more. For example, it's sufficient for "Recent Edits link to be:
    
    -<a href="/cgi-bin/recent.cgi">
    +a href="/cgi-bin/recent.cgi"
    
     The slash at the beginning is crucial to make it relative to the root of the site. 
    
     
  • Ahasuerus

    Ahasuerus - 2019-04-06
    • status: open --> accepted
    • assigned_to: Ahasuerus
     
  • Ahasuerus

    Ahasuerus - 2019-04-06

    Part 1 - Made the host URLs relative (except for the schema) everywhere; Made the schema relative for links to ISFDB records:

    biblio/adv_search_menu.py
    common/library.py
    common/localdefs.py
    

    Installed in SVN 378 on 2019-04-06. Keeping the SR open because we still need to make the schema relative.

     
  • Ahasuerus

    Ahasuerus - 2019-04-16

    Part 2 - Rolled back the changes (except the bug fixes in Advanced Search) because some versions of Safari do not support relative URLs, most notably server-side redirects which use relative URLs :

    common/library.py
    common/localdefs.py
    

    Installed in SVN 389 on 2019-04-16. Keeping the SR open in case we can figure out how to fix the problem with Safari.

     
  • Ahasuerus

    Ahasuerus - 2019-10-21

    After more digging, it turns out that some/most of the relative URLs used in SVN 378 (e.g. "http:/cgi-bin/recent.cgi") were invalid. As Dirk Stoecker pointed out in an e-mail:

    See https://tools.ietf.org/html/rfc1738 section 3.3.

    A HTTP-URL has the form

    http://<host>:<port>/<path>?<searchpart></searchpart></path></port></host>

    where anything behind host is optional (see text).

    http:/cgi-bin/recent.cgi violates this. That's no relative URL, but a
    broken one and also can have worked only in fault tolerant environments.

    My Firefox converts this to http://cgi-bin/recent.cgi and thus tries to
    access a server with name cgi-bin.

    Relative URLs start either with text or a single slash. A double slash
    like href="//www.amazon.de/" is also possible. That means "use same
    protocol as current page", so either is http: or https: depending on the
    way the site was called.

     

Anonymous
Anonymous

Add attachments
Cancel