def resolve_path_parts(path_parts):
    """Normalize the URL path by resolving segments of '.' and '..',
    resulting in a dot-free path.  See RFC 3986 section 5.2.4, Remove
    Dot Segments.
    """
    ret = []
    for part in path_parts:
        if part == u'.':
            pass
        elif part == u'..':
            if ret and (len(ret) > 1 or ret[0]):
                ret.pop()
        else:
            ret.append(part)
    if list(path_parts[-1:]) in ([u'.'], [u'..']):
        ret.append(u'')
    return ret
