This works so far as it really redirects the user to the yahoo login page and if he chooses to login to the page mydomain with his yahoo account, yahoo redirects to the page I provided as the parameter openid.return_to.
Now comes the tricky part, however. In the next step I would like to verify the signature I got from yahoo with a call using openid.mode=check_authentication.
You just need to relay all the response parameters (to your checkid_setup request) except changing openid.mode from "id_res" to "check_authentication" to the Yahoo! OP endpoint. It should return a plain-text response that contains the "is_valid:true" string.
Your second request failed because of "openid.mode=id_res" -- you should change it to "openid.mode=check_authentication" as said above.