URL linebreaks W/O \sloppy

Hours of reading the different articles on url linebreaking did not reveal a solution for the following problem:

I've got a long url, which I do not intend to short using online services. The url package and pdfLaTeX output is used. The line break occurs at a place, that looks ugly and that I cannot understand, why a tool that fortunately takes proper layout so serious, wraps here.

My MWE is:

\documentclass[10pt,a5paper]{book} % Regular text font size is 10 pt.

\usepackage{lipsum} % load paragraphs of filler text

\setlength{\oddsidemargin}{20mm}
\setlength{\textwidth}{108.5mm}

\usepackage{url}
\makeatletter
\makeatother

\begin{document}

\lipsum[2]

\end{document}


As can be seen, the "d" in the second last line is already overlength (compared to the paragraph above), still LaTeX adds the "f" instead of wrapping after the "d".

I fully understand, that the second last line cannot be perfectly justified as there are no spaces that can be enlarged (I've read about a package that enlarges the letters in these cases) - my question is just, why LaTeX makes things even worse with adding the "f" instead of making it the first letter in the last line, and what I can do about that without using the sloppy workaround, which makes the rest look far worse than just wrapping before the "f"?

-

I would say the best way is to reduce the places where an url can be broken.

Your given MWE reduced to only break the url after character d runs without problems and the wanted result on my MiKTeX 2.9:

\documentclass[10pt,a5paper]{book} % Regular text font size is 10 pt.

\usepackage{lipsum} % load paragraphs of filler text

\setlength{\oddsidemargin}{20mm}
\setlength{\textwidth}{108.5mm}

\usepackage{url}
\makeatletter
\do\/\do\d%
}
\makeatother

\begin{document}

\lipsum[2]


Well @Ben, I would put the urls into a bib entry, use \RaggedRight (package ragged2e) for the bibliography. Then you can play with the necceccary \dos ... If I remember correctly, there was an question/answer for this. Must look for it ... –  Kurt Aug 4 '13 at 21:23
Yes, I guess you are referring to your post here. The thing is just: If I use your suggestion with \usepackage[newcommands,newparameters]{ragged2e}, then the whole paragraph is ragged right (there is more text before the "Available"), which looks awful. So, why does LaTeX not break after the "d", even if it is explicitly told that this is possible and even though the hbox is already overfull? –  Ben Aug 5 '13 at 9:41
@Ben My point is to move the url in the bibliography. A bibliography should use left justifing. If you have several urls you have to play with the order of the \dos. Lacking an example with more than one url I can only guess, but changing the \do\d\do\f\do\s to \do\s\do\d\do\s or something else could do the trick. It is only a workaround ... To solve problems like this it is in my opinion the best to use not a left-right-justifing ... –  Kurt Aug 5 '13 at 10:08