Read and parse an incoming LDP request.
226 Hashtable<String, String> retval =
new Hashtable<String, String>();
229 boolean text =
false;
230 StringBuffer buffer =
new StringBuffer();
231 StringBuffer trace =
new StringBuffer();
235 String ln = rx.readLine();
237 throw new IOException(
"The peer disconnected prematurely");
240 buffer.append(ln).append(
"\n");
241 if (ln.length() == 0) {
247 trace.append(ln).append(
"\n");
251 String hdr[] = ln.split(
":");
252 if (hdr.length < 2 || hdr[0].trim().length() == 0) {
253 String msg =
"LDP request format error (" + cnt +
": " + ln +
")";
254 throw new ProtocolException(msg);
257 String field = hdr[1];
258 for (
int i = 2; i < hdr.length; i++)
259 field +=
":" + hdr[i];
261 retval.put(hdr[0].trim(), field.trim());
263 while (!buffer.toString().endsWith(
"}\n\n"));
265 retval.put(
"trace", trace.toString().trim());
266 retval.put(
"request", buffer.toString().trim());