Changeset 30980 in project


Ignore:
Timestamp:
06/07/14 14:12:31 (6 years ago)
Author:
sjamaan
Message:

uri-common: Do not reset the port when switching schemes, to reduce confusion

Location:
release/4/uri-common/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/uri-common/trunk/tests/run.scm

    r28532 r30980  
    106106     ("http://a" 80 "http://a")
    107107     ("http://a:1234" 8080 "http://a:8080"))
    108     ("scheme" scheme:    ;; scheme causes reset of port, in all cases
     108    ("scheme" scheme:    ;; port is kept around when non-#f
    109109     ("https://a" http "http://a")
    110110     ("https://a:80" http "http://a")
    111      ("https://a:123" http "http://a")
    112      ("http://a:8080" https "https://a"))
     111     ("https://a:123" http "http://a:123")
     112     ("http://a:8080" https "https://a:8080"))
    113113    ))
    114114
  • release/4/uri-common/trunk/uri-common.scm

    r28531 r30980  
    55;; encoding/decoding
    66;;
    7 ; Copyright (c) 2008-2013, Peter Bex
     7; Copyright (c) 2008-2014, Peter Bex
    88; All rights reserved.
    99;
     
    169169                       '(/ "") ; normalize path
    170170                       path))
    171              ;; XXX is this really the desired behaviour?
    172              ;; maybe simpler is better: do not reset to #f on default port?
    173              (port (if (or
    174                         (and (not (eq? scheme unset)) ; scheme specified...
    175                              (eq? port unset)) ; ...and no explicit port?
    176                         (default-port? port actual-scheme)) ; or default port?
    177                        #f               ; then clear port
     171             ;; Clear port if it's the default for this scheme
     172             (actual-port (if (eq? port unset)
     173                              (generic:uri-port (URI-common-generic uc))
     174                              port))
     175             (port (if (default-port? actual-port actual-scheme)
     176                       #f
    178177                       port)))
    179178        ;; This code is ugly!
Note: See TracChangeset for help on using the changeset viewer.