mirror of https://github.com/zlatinb/muwire
provision for future versions sending profiles with search results
parent
cb695ff751
commit
a3f40da51c
|
@ -339,6 +339,9 @@ class ConnectionAcceptor {
|
||||||
boolean feed = false
|
boolean feed = false
|
||||||
if (headers.containsKey('Feed'))
|
if (headers.containsKey('Feed'))
|
||||||
feed = Boolean.parseBoolean(headers['Feed'])
|
feed = Boolean.parseBoolean(headers['Feed'])
|
||||||
|
boolean profile = false
|
||||||
|
if (headers.containsKey("Profile"))
|
||||||
|
profile = Boolean.parseBoolean(headers['Profile'])
|
||||||
|
|
||||||
byte [] personaBytes = Base64.decode(headers['Sender'])
|
byte [] personaBytes = Base64.decode(headers['Sender'])
|
||||||
Persona sender = new Persona(new ByteArrayInputStream(personaBytes))
|
Persona sender = new Persona(new ByteArrayInputStream(personaBytes))
|
||||||
|
@ -349,6 +352,13 @@ class ConnectionAcceptor {
|
||||||
if (nResults > Constants.MAX_RESULTS)
|
if (nResults > Constants.MAX_RESULTS)
|
||||||
throw new IOException("too many results $nResults")
|
throw new IOException("too many results $nResults")
|
||||||
|
|
||||||
|
if (profile) {
|
||||||
|
int profileLength = dis.readInt()
|
||||||
|
if (profileLength > Constants.MAX_PROFILE_LENGTH)
|
||||||
|
throw new IOException("profile too large $profileLength")
|
||||||
|
dis.skipBytes(profileLength) // skip profile data for now
|
||||||
|
}
|
||||||
|
|
||||||
dis = new DataInputStream(new GZIPInputStream(dis))
|
dis = new DataInputStream(new GZIPInputStream(dis))
|
||||||
UIResultEvent[] results = new UIResultEvent[Math.min(RESULT_BATCH_SIZE, nResults)]
|
UIResultEvent[] results = new UIResultEvent[Math.min(RESULT_BATCH_SIZE, nResults)]
|
||||||
int j = 0
|
int j = 0
|
||||||
|
|
|
@ -23,6 +23,7 @@ public class Constants {
|
||||||
public static final long MAX_HEADER_TIME = 60 * 1000;
|
public static final long MAX_HEADER_TIME = 60 * 1000;
|
||||||
|
|
||||||
public static final int MAX_RESULTS = 0x1 << 20;
|
public static final int MAX_RESULTS = 0x1 << 20;
|
||||||
|
public static final int MAX_PROFILE_LENGTH = 0x1 << 18;
|
||||||
|
|
||||||
public static final int MAX_COMMENT_LENGTH = 0x1 << 15;
|
public static final int MAX_COMMENT_LENGTH = 0x1 << 15;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue