Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fahrplan doesn't work in Germany #263

Open
suden200 opened this issue Dec 20, 2017 · 39 comments
Open

fahrplan doesn't work in Germany #263

suden200 opened this issue Dec 20, 2017 · 39 comments

Comments

@suden200
Copy link

The app fahrplan doesn't work in Germany. No contact to the server of Deutsche Bahn. The app not suggests any cities. It's not possible to enter cities or Lacations in the app.

@leppa
Copy link
Collaborator

leppa commented Dec 20, 2017

What version of Fahrplan do you have? bahn.de was fixed in 2.0.31.

If you use AppList, then check for updates. I've uploaded a new version there this morning.

@leppa leppa added the Backend label Dec 20, 2017
@suden200
Copy link
Author

Hallo, I have version 2.0.27 on my Ubuntu Touch phone. I checked for new versions this time. In the Open Store is no version 2.0.31 avalible.

@leppa
Copy link
Collaborator

leppa commented Dec 20, 2017

Ah, I see.
@mzanetti and @krnekhelesh were maintaining Ubuntu Touch version, if I'm not mistaken. Guys, can you upload a new release there?

@leppa
Copy link
Collaborator

leppa commented Dec 20, 2017

Duplicate of #262, but keep open until Ubuntu Touch version is released.

@dayrover
Copy link

I contacted Michael Zanetti and he is no longer working on Fahrplan for Ubuntu Touch.
Since I use Fahrplan myself I will take over this work.
I'm currently testing 2.0.31 on Ubuntu Touch an although getting timetable from bahn.de now works again it is still not possible to search for a station.

I assume this is a general problem with the patch for #232 as I am getting a 'Parse error: Request timed out'. Anyone have any positive experience with other platforms and 'bahn.de' station search?

@smurfy
Copy link
Owner

smurfy commented Dec 21, 2017

main change is use https. maybe this causes the problem?. not sure why this is related to #232

@dayrover
Copy link

The https: timetable queries seem to work, just the station queries are not working. Looking at the the code the is an XML 'hafa' request.
Do you have an an example of a working query?

@smurfy
Copy link
Owner

smurfy commented Dec 21, 2017

Req:

<?xml version="1.0" encoding="UTF-8" ?><ReqC accessId="" ver="1.1" prod="String" lang="EN"><MLcReq><MLc n="Zurich" t="ST" /></MLcReq></ReqC>

Resp:

<?xml version="1.0" encoding="ISO-8859-1"?><ResC xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="No path to XML scheme defined" ver="1.1" prod="String" lang="EN"><MLcRes flag="FINAL"><MLc t="ST" n="ZÜRICH" i="A=1@O=ZÜRICH@X=8540534@Y=47378968@U=80@L=008596008@B=1@p=1511926111@" class="383" x="8540534" y="47378968" /></MLcRes></ResC>

Both in parser_hafasxml.cpp

void ParserHafasXml::findStationsByName(const QString &stationName)
StationsList ParserHafasXml::internalParseStationsByName(const QString &data) const

@dayrover
Copy link

dayrover commented Dec 21, 2017

Thanks!

A wget direct on the phone work. For example:
wget --post-data='<?xml version="1.0" encoding="UTF-8" ?><ReqC accessId="" ver="1.1" prod="String" lang="EN"><MLcReq><MLc n="Lilienweg" t="ST" /></MLcReq></ReqC>' --header='Content-Type: text/xml' https://reiseauskunft.bahn.de/bin/query.exe

Looks like i will have to add some debuggers to the 'mobilebahnde' parse to see why is failing on my Ubuntu build

@balcy
Copy link

balcy commented Dec 22, 2017

I can confirm this problem, I've built the version 2.0.31 as well, and for some reason the request does not work on the phone (BQ Aquaris 4.5) with Qt 5.4.1, even if curl (in libertine) on the same phone works.
I've built an example Qt-commandline-app that just does the post with QNetworkAccessManager. The "finish" signal was not seen at all.
The strange thing: in a chroot with the same Ubuntu / Qt version on a raspberry Pi it worked. For other https sites I have not seen this problem

@balcy
Copy link

balcy commented Dec 22, 2017

If you try to do the POST in an QML app, there is the same problem:
`

     Button {
     onClicked: {
     var http = new XMLHttpRequest();
     var url = "https://reiseauskunft.bahn.de/bin/query.exe";
     //var url = "https://wikipedia.org";
     var data = '<?xml version="1.0" encoding="UTF-8" ?><ReqC accessId="" ver="1.1" prod="String" lang="EN"><MLcReq><MLc n="Zurich" t="ST" /></MLcReq></ReqC>';
     http.open("POST", url, true);

     http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

     http.onreadystatechange = function() { // Call a function when the state changes.
    
                 fieldresponse.text = http.readyState + " : " + http.responseText;
                      
                 if (http.readyState == http.DONE) {
                     if (http.status == 200) {
                         fieldresponse.text = http.responseText;
                     } else {
                         fieldresponse.text = http.status;
                     }
                 }
             }
     http.send(data);

     }
    text: "test post";
}

   TextField {

     width: parent.width
     height: 500
     id: fieldresponse
  }
 ...

`
this will not work for bahn.de on the phone, but has no problem with e.g. wikipedia
[edit] interestingly, the response is in fact there, but readyState keeps "3" LOADING and never reaches "4" DONE

@smurfy
Copy link
Owner

smurfy commented Dec 22, 2017

hm you can play with http headers like Connection: Close or downgrade to http 1.0 to tests.
Its quite strange the problem, since https on other sites work.

Edit:
Maybe https://mobile.bahn.de/bin/mobil/query.exe/eox works as url insteadof the reiseauskunft one. Didn't you mention the timetable works?

@balcy
Copy link

balcy commented Dec 24, 2017

"Connection: Close" and the other URL show the same effect, the downgrade 1.0 I have not tried / found yet.
@dayrover mentioned the timetable works, I've not tested this yet.
Today there was a community update of UBPorts, they've announced that all Ubuntu phones will be moved from Ubuntu 15.04 to 16.04, this could maybe solve the problem.

@suden200
Copy link
Author

My information is that the BQ's not will be move to 16.04 because of the "old" hardware.

But only for information: The app "fahrplan" works without problems till 4 weeks ago. Then from one day to the next day the connecting to bahn.de was failed. Something must be changed at this time.

Sorry, my technical English is not very good, so I can't understand all statements in this treads...

@balcy
Copy link

balcy commented Dec 24, 2017

yeah that's brand new info of yesterday, they cannot move to a new kernel on BQ, and systemd requires a new kernel, but they will use upstart instead, and offer 16.04 for all phones (I was positively surprised, too). The thing is, with http it always worked without problems (like with oebb.at which still works)
Maybe the problem with https was already present on the phone, but until Dec. it was not needed.
But there must be a server side problem with bahn.de as well I guess.
happy Chrismas : ]

@smurfy
Copy link
Owner

smurfy commented Dec 24, 2017

maybe its SNI or another ssl related problem. On sailfish and on windows desktop test app it works just fine. (tested on windows with Qt 5.4.1)

@balcy
Copy link

balcy commented Dec 25, 2017

I suspect backend issue with bahn.de here. the following is the output of wget on debian testing: https://pastebin.com/3ZcGBtX2
After the response is sent, it says Read error at byte 380 (The TLS connection was non-properly terminated.).Retrying.

@dayrover
Copy link

dayrover commented Jan 3, 2018

Let me summaries what https requests orks and what do not since http can no longer be used:

Station search (HAFA XML)
https://rabdc.bahn.de/bin/query.exe/dn WORKS
https://reiseauskunft.bahn.de/bin/query.exe FAILS Read error (The TLS connection was non-properly terminated.)

Station Timetable (HAFA XML)
https://rabdc.bahn.de/bin/mobil/bhftafel.exe/en WORKS
https://mobile.bahn.de/bin/mobil/bhftafel.exe/en FAILS

Timetable (HAFA Binary)
https://reiseauskunft.bahn.de/bin/query.exe/eox

@dayrover
Copy link

dayrover commented Jan 3, 2018

I've built a version 2.0.32 which I will push to the OpenStore today so people can use / test it.

This uses 'https://rabdc.bahn.de/bin/mobil' for XML and 'https://reiseauskunft.bahn.de' for the Binary requests. With this combination all Fahrplan quiries for on my Ubports OTA 3 Phone.
@balcy Where do the 'rabdc.bahn.de' URLs come from? Do you know what offical purpose they serve?

@dayrover
Copy link

dayrover commented Jan 3, 2018

Because Michael Zanetti is no longer supporting Version 2.0.32 is packaged with name
"de.michael-stevens.fahrplan2" so it won't be offered as an upgrade. You will have to search for it in the OpenStore. Also the Settings from the previous version will not be used so you will have to redo your favourite or manually copy them over. To do this copy 'fahrplan2.conf' from '.config/com.ubuntu.developer.mzanetti.fahrplan2' to '.config/de.michael-stevens.fahrplan2'.

Once everything works I shall make a pull request with the patches.

@dayrover
Copy link

dayrover commented Jan 3, 2018

OK i've published it as version 2.0.33. I couldn't reuse version 2.0.32 and versions like '2.0.32_openstore' seem to require a review!

@smurfy
Copy link
Owner

smurfy commented Jan 3, 2018

can you provide a PR plz?

and thank you for all the research getting it to work on ubuntu phone

@dayrover
Copy link

dayrover commented Jan 3, 2018

On question for anyone familiare with the new Ubports 'clickable' build tool. When building from the 'fahrplan2.pro' file 'CONFIG += ubuntu' needs to be specified. Anyone know if this can be specified on the clickable command line or in the json configuration?

@suden200
Copy link
Author

suden200 commented Jan 3, 2018

Hey, thank you for this new version of fahrplan2!! I've installed it just this morning from the OpenStore and it works great!!
Thanks to all peoples they helped to find a solution! You make a very good job!!
Greetings

@balcy
Copy link

balcy commented Jan 3, 2018

actually found this by chance, so I don't know the official purpose of the url. Actually I was preparing a release myself that uses curl for the bahn.de urls. This was also tested successflly by some members of the Ubports (German) telegram group: https://github.com/balcy/fahrplan

@balcy
Copy link

balcy commented Jan 4, 2018

What I'm not sure of is, if the new URLs work for other (Ubuntu) versions as well, that's why I used curl instead.
One thing I would do: Instead of including the maintainer in the app ID, i think it is better to use e.g. "fahrplan2.openstore", that would make future maintainer changes easier for the users: Open Store admins can transfer the ownership, and the app ID stays the same.

@dayrover
Copy link

dayrover commented Jan 4, 2018

Balcy, your curl fix looks a lot better then using the radbc.bahn.de URLs!

I think the non personalised app ID is a good idea. I gave tried out pushing my 2.0.33 version with the ID 'openstore.fahrplan2' and open store accepted it.
I would suggest I drop my PR which uses the radbc.bahn.de URLs and you make a PR with your libcurl workaround. We would need to bump to version 2.0.34 to publish it to the openstore

@smurfy
Copy link
Owner

smurfy commented Jan 4, 2018

i'm fine with it. can you try using 2.0.33-1 or even better 2.0.32-1 as version?

@dayrover
Copy link

dayrover commented Jan 4, 2018

I've merge balcy/fahrplan master and managed to build this with 'clickable'.
For this you need to update 'clickables' docker container with.

  • docker run -i clickable/ubuntu-sdk:15.04-armhf bash
    -- In the container: apt install libcurl4-gnutls-dev:armhf
  • docker commit clickable/ubuntu-sdk:15.04-armhf

'balcy' 'ubuntuBuildWithContainer.sh' requires a ../../click_build, so I have removed the shellscript. The QT build fails because the 'manifest.json' does not exists. This must have been created by the Ubuntu SDK using the 'deployment.pri' file. To make the build portable I'll commit a temporay 'manifest.json' which still has me a maintainer. I guess the templating should be addes to the 'fahrplan2.pro', but I haven't used Qt for years!
I'll push this to the OpenStore so people can start using it and make a PR.

@dayrover
Copy link

dayrover commented Jan 4, 2018

I've pushed Version '2.0.32-2' to the OpenStore using the 'openstore.fahrplan2' app ID. I had already 'burned version '2.0.32-1'. The OpenStore does not allow you to update the click file even if you never published that version!

Chris we should decide who should continue to maintain on OpenStore. I not too fussed. OpenStore has picked you up as the author. Not sure where it got the info since I still had me in the 'mainfest.json'. Too many metafiles!

@balcy
Copy link

balcy commented Jan 4, 2018

sorry was in train the most part of the day . ) Glad my solution was helpful, and that you took care of the merging... I'm fine with being maintainer as well.
For the manifest.json : I've made it so that it is created from manifest.json.in during qmake, but did not take clickable into account, which expects manifest.json to be present, I try correcting that soon.

@balcy
Copy link

balcy commented Jan 5, 2018

@dayrover I've thought about it : You have been the first who has contacted M. Zanetti and offered to be a maintainer, and also have put work into it, so if you don't mind let's stick with your already uploaded package.
It will properly display you as maintainer if you replace 'Chris Clime' with your name on the fahrplan2.pro file (right under the app id). This will generate a manifest.json with your name.

@balcy
Copy link

balcy commented Jan 5, 2018

for the clickable topic (provide qmake params) B. Douglass has said it would be a good feature to have clickable.json support that, but right now he recommends to use a custom template for that.

@balcy
Copy link

balcy commented Jan 5, 2018

I think the manifest.json was a hen/egg problem: It is created by qmake, but only if CONFIG+=ubuntu is set by clickable.
I cannot test right now on docker, but send an update about it tomorrow.

@balcy
Copy link

balcy commented Jan 6, 2018

ok got it running with docker, I have made a clickable.json file
{ "dir": "click_build", "arch": "armhf", "chroot": false, "template": "custom", "build": "bash -c 'cd .. ; qt5-qmake-arm-linux-gnueabihf CONFIG+=ubuntu clickBuildFolder=click_build; make clean ; make install'", "dependencies": [ "libcurl4-gnutls-dev" ] }
, and adapted the deployment.pri and fahrplan2.pro file.

the adaptions are in master of http://github.com/balcy/fahrplan

@dayrover
Copy link

I Balcy. Thanks for the build fixes.
As you suggested I will continue as the maintainer. I don't think we need a new release with the merged build changes as the v2.0.32-2 build in the OpenStore works fine. It has already been download 139 times!

@smurfy
Copy link
Owner

smurfy commented Jan 13, 2018

Thank you guys for your efforts, i will close this issue now.
Also i think the curl workaround is also necessary on symbian. since i do not have a symbian device i'm currently looking for a way to test.

@balcy
Copy link

balcy commented Mar 17, 2018

no symbian device here : (
@dayrover: is it ok if I send you an updated click package that includes Transport for London support?

@ruedigerkupper
Copy link

All seems to work fine (Ubuntu Touch). Is there a reason this issue is still open?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants