简体   繁体   English

如何最小化HTTP请求中的大量数据?

[英]How to minimize large amounts of data in an HTTP request?

I have an application made in Java for Android platforms, and I need to send quite a lot of data, the data I am sending is the previous weeks SMS messages received and sent. 我有一个用Java开发的适用于Android平台的应用程序,我需要发送大量数据,我发送的数据是前几周接收和发送的SMS消息。 That includes the following data: 其中包括以下数据:

  • Sent by Phone number 通过电话号码发送
  • Sent by Name 按名称发送
  • Sent to Phone number 发送到电话号码
  • Sent to Name 发送给姓名
  • Time sent 寄出时间
  • Message 信息

And you can imagine this data can be really big for some people so I need a way to minimize/encrypt it on one side, and then using an HTTP request I can send it over to my server, and decrypt this data with PHP. 您可以想象这些数据对于某些人来说确实非常大,所以我需要一种在一侧将其最小化/加密的方法,然后使用HTTP请求将其发送到我的服务器,并使用PHP解密该数据。 What is the best method to do this? 最好的方法是什么? What size limit does HTTP POST have? HTTP POST有什么大小限制?

I think you should zip+encrypt(say, using aes) the data on Android side before sending the data to your server and decrypt+unzip it on the server side. 我认为您应该先在Android端对数据进行zip + encrypt(例如使用aes),然后再将数据发送到服务器并在服务器端进行解密+解压缩。

Post size depends on the config on the server side -> What is the size limit of a post request? 发布大小取决于服务器端的配置-> 发布请求的大小限制是多少? .

ps why would anyone want to send all their sms messages to your server? ps为什么有人要发送所有短信到您的服务器? :) :)

You'll want to send the data using an HTTP POST. 您将要使用HTTP POST发送数据。 The limit on the HTTP POST size depends on the server receiving the data. HTTP POST大小的限制取决于接收数据的服务器。 For example a PHP server has the post_max_size property that (I think) by default is 16M. 例如,PHP服务器具有post_max_size属性(我认为)默认为16M。 In terms of encryption start by making sure the request is being sent over HTTPS. 在加密方面,首先要确保请求是通过HTTPS发送的。

Do you have Gzip option turn on in your Apache HTTPD server? 您的Apache HTTPD服务器中是否启用Gzip选项

This way the web server will compress and serve slightly packed files to and bro your browser. 这样,Web服务器将压缩并向浏览器提供一些打包文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM