Android 앱을 사용하여 CherryPy 서버에 base64 인코딩 문자열을 보냅니다. 안드로이드 코드는 다음과 같이 작동받은 길이가 보낸 길이와 다릅니다
URL url = new URL("http://foo.bar/blabla");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("Content-Type", "application/octet-stream");
conn.setDoOutput(true);
conn.setFixedLengthStreamingMode(base64s.length());
OutputStream out = new BufferedOutputStream(conn.getOutputStream());
out.write(base64s.getBytes());
그래서, 당신이 보낸 바이트의 양이 Content-Length
헤더의 바이트의 양을 동일 말할 것입니다.
cl = cherrypy.request.headers['Content-Length']
rawbody = cherrypy.request.body.read()
print "{} bytes, {}".format(len(rawbody), cl)
숫자 cl
및 len(rawbody)
가 다른 그러나, 파이썬, 내가이 실행할 때.
어떻게 될 수 있습니까?
값은 무엇입니까 ??? 그리고 얼마나 많은 바이트가 전송 되었습니까? – greenapps
잊어 버린 점 .close() ;? – greenapps
@greenapps 그게 사실입니다. 네가 대답하면 내가 받아 들일거야. –