ticky / dreamuploader

🌀 A modern, open source VMU file upload server for the Sega Dreamcast (WIP)
MIT License
7 stars 0 forks source link

PlanetWeb 3.0 uploads don't work, but Dream Passport Premier does #6

Open ghost opened 1 year ago

ghost commented 1 year ago

Hello!

I registered to say this project is great!

However, I am not able to get uploads working on PlanetWeb 3.0 (maybe it works on older versions, but I only have broadband as a connection method). As per the title, Dream Passport Premier (which is DreamPassport3.2) works just fine. I noticed that hardcoding a filename worked like this:

# planetweb 3.0 not appending filename as second key:value pair

    if request.args.get(b'filename') is None:
        filename = 'default'

#    if len(request.args.get(b'filename')[0]) < 4:
#        return 'You must type a file name, and it needs to be at least four characters!'

#    try:
#        filename = request.args.get(b'filename')[0].decode()
#    except UnicodeDecodeError:
#        return 'Unsupported characters in filename. Please make sure you are using the US keyboard if you have the option.'

    vmi_filename = filename + '.VMI'
    vms_filename = filename + '.VMS'

But that is suboptimal. But, at least doing this allowed me to verify that vmi/vms data are being created/handled correctly on the backend.

I'm attaching a packet capture between my console and the server, which shows the differences between PlanetWeb 3.0 and DreamPassport Premier (interestingly PlanetWeb 3.0 uses 512 byte packets while DPP uses 1460 byte packets, but this does not actually impact anything).

DPP_PWEB30_PCAP.pcapng.zip

I also noticed that the line:

@app.route('/upload', methods=['POST'])
def post(request):
    print(request.args)

Prints out the filename key:value pair and the vmfile data key:value pair on DPP, but only whatever the first form entry is in index.html when using PlanetWeb 3.0.

Adding

    print(request.content.getvalue())

afterwards DOES show that PlanetWeb is sending all the form data and the server is receiving it, but for some reason the PlanetWeb processing code is only able to grab the "vmfile" (as it is the first field in the form). Perhaps related is the fact that PlanetWeb uses --__PW_FORM_DATA_BOUNDARY__ as opposed to ------numbers like DPP and other browsers.

ghost commented 12 months ago

Just want to add, Broadband Passport (DreamPassport2.1) also works fine, and behaves much like DreamPassport Premier.