608 }
609
610 public void writeRequests(MessageHeader head,
611 PosterOutputStream pos) throws IOException {
612 requests = head;
613 requests.print(serverOutput);
614 poster = pos;
615 if (poster != null)
616 poster.writeTo(serverOutput);
617 serverOutput.flush();
618 }
619
620 public void writeRequests(MessageHeader head,
621 PosterOutputStream pos,
622 boolean streaming) throws IOException {
623 this.streaming = streaming;
624 writeRequests(head, pos);
625 }
626
627 /** Parse the first line of the HTTP request. It usually looks
628 something like: "HTTP/1.0 <number> comment\r\n". */
629
630 public boolean parseHTTP(MessageHeader responses, ProgressSource pi, HttpURLConnection httpuc)
631 throws IOException {
632 /* If "HTTP/*" is found in the beginning, return true. Let
633 * HttpURLConnection parse the mime header itself.
634 *
635 * If this isn't valid HTTP, then we don't try to parse a header
636 * out of the beginning of the response into the responses,
637 * and instead just queue up the output stream to it's very beginning.
638 * This seems most reasonable, and is what the NN browser does.
639 */
640
641 try {
642 serverInput = serverSocket.getInputStream();
643 if (capture != null) {
644 serverInput = new HttpCaptureInputStream(serverInput, capture);
645 }
646 serverInput = new BufferedInputStream(serverInput);
647 return (parseHTTPHeader(responses, pi, httpuc));
648 } catch (SocketTimeoutException stex) {
|
608 }
609
610 public void writeRequests(MessageHeader head,
611 PosterOutputStream pos) throws IOException {
612 requests = head;
613 requests.print(serverOutput);
614 poster = pos;
615 if (poster != null)
616 poster.writeTo(serverOutput);
617 serverOutput.flush();
618 }
619
620 public void writeRequests(MessageHeader head,
621 PosterOutputStream pos,
622 boolean streaming) throws IOException {
623 this.streaming = streaming;
624 writeRequests(head, pos);
625 }
626
627 /** Parse the first line of the HTTP request. It usually looks
628 something like: {@literal "HTTP/1.0 <number> comment\r\n"}. */
629
630 public boolean parseHTTP(MessageHeader responses, ProgressSource pi, HttpURLConnection httpuc)
631 throws IOException {
632 /* If "HTTP/*" is found in the beginning, return true. Let
633 * HttpURLConnection parse the mime header itself.
634 *
635 * If this isn't valid HTTP, then we don't try to parse a header
636 * out of the beginning of the response into the responses,
637 * and instead just queue up the output stream to it's very beginning.
638 * This seems most reasonable, and is what the NN browser does.
639 */
640
641 try {
642 serverInput = serverSocket.getInputStream();
643 if (capture != null) {
644 serverInput = new HttpCaptureInputStream(serverInput, capture);
645 }
646 serverInput = new BufferedInputStream(serverInput);
647 return (parseHTTPHeader(responses, pi, httpuc));
648 } catch (SocketTimeoutException stex) {
|