Ho un'applicazione AppEngine che utilizza il blobstore per memorizzare i dati di immagine forniti dall'utente. Quando carico immagini su quell'applicazione da un modulo in Chrome, funziona bene. Quando provo a caricare un'immagine da un'applicazione Android fallisce. Entrambi i metodi funzionano bene se sono in esecuzione contro il server di sviluppo, ma il caricamento Android non funziona contro il servizio live.AppEngine Caricamento BlobStore in errore con una richiesta che funziona nell'ambiente di sviluppo
Questa è la richiesta da Chrome:
POST /_ah/upload/?userToken=11001/AMmfu6ZCyMQQ9YdiXal3SmSXIRTQIuSRXkNc-i3JmU0fqx_kJbUJ2OMLcS2lXhVJSK4qs7regViTKzOPz5ejoZYi0nAD5o8vNltiOViQw6DZO7_byZz3Ut0/ALBNUaYAAAAAS_lusgPMAGmpPrg0BuNsJyymX-57ob4i/ HTTP/1.1
Host: photohuntservice.appspot.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1064 Safari/532.5
Referer: http://photohuntservice.appspot.com/debug_newpuzzle?userToken=11001
Content-Length: 60360
Cache-Control: max-age=0
Origin: http://photohuntservice.appspot.com
Content-Type: multipart/form-data; boundary=----WebKitFormBoundarybl05YLmLbFRf2MzN
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
------WebKitFormBoundarybl05YLmLbFRf2MzN
Content-Disposition: form-data; name="userToken"
11001
------WebKitFormBoundarybl05YLmLbFRf2MzN
Content-Disposition: form-data; name="img"; filename="Photo_020908_001.jpg"
Content-Type: image/jpeg
<image data>
------WebKitFormBoundarybl05YLmLbFRf2MzN
Content-Disposition: form-data; name="longitude"
-122.084095
------WebKitFormBoundarybl05YLmLbFRf2MzN
Content-Disposition: form-data; name="latitude"
37.422006
------WebKitFormBoundarybl05YLmLbFRf2MzN--
Questa è la richiesta da parte il mio cliente (che è scritto in Java su Android, ma non credo che sia rilevante):
POST /_ah/upload/?userToken=11001/AMmfu6Zf9an6AU4lT9UuhIpxOZyOYb1LMwimFpeSh8zr6J1sX9F2ddJW3Qlsw0kwV3oALv-TNPWRQ6g4_Dgwk0UTwF47bbc78Yl44kDeV69MydTuR3N46S4/ALBNUaYAAAAAS_mMr3CYqTg3aVBDjhRxP0DyyRdvotyG/ HTTP/1.1
Content-Type: multipart/form-data;boundary=----WebKitFormBoundaryhdyNAhmOouRDGErG
Cache-Control: max-age=0
Accept: */*
Origin: http://photohuntservice.appspot.com
Connection: keep-alive
Referer: http://photohuntservice.appspot.com/getuploadurl?userToken=11001
Content-Length: 2638
Host: photohuntservice.appspot.com
User-Agent: Apache-HttpClient/UNAVAILABLE (java 1.4)
Expect: 100-Continue
------WebKitFormBoundaryhdyNAhmOouRDGErG
Content-Disposition: form-data; name="userToken"
11001
------WebKitFormBoundaryhdyNAhmOouRDGErG
Content-Disposition: form-data; name="img";filename="PhotoHunt.jpg"
Content-Type: image/jpeg
<image data>
------WebKitFormBoundaryhdyNAhmOouRDGErG
Content-Disposition: form-data; name="latitude"
37.422006
------WebKitFormBoundaryhdyNAhmOouRDGErG
Content-Disposition: form-data; name="longitude"
-122.084095
------WebKitFormBoundaryhdyNAhmOouRDGErG--
In entrambi i casi, il codice Python AppEngine per catturare la domanda è la stessa:
class UploadPuzzle(blobstore_handlers.BlobstoreUploadHandler):
def post(self):
upload_files = self.get_uploads()
il probl em è che quando si esegue il servizio AppEngine di produzione self.get_uploads() restituisce una lista vuota quando viene effettuata la richiesta dalla mia app client. Entrambe le richieste restituiscono ciò che mi aspetto (un elenco con un blob_info in esso) sul server di sviluppo e Chrome restituisce ciò che mi aspetto in entrambi i casi.
Buon lavoro di rilevamento! Puoi presentare un bug per questo, per favore? –
Già fatto: http://code.google.com/p/googleappengine/issues/detail?id=3273 –
Che @ # $%! server di produzione. "Sicuramente quello spazio prima che il nome del file sia superfluo, permettimi di ripulirlo", pensai. Oh, il prezzo che ho pagato per la mia pulizia. – drcode