Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 570141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:22:10+00:00 2026-05-13T13:22:10+00:00

Looking for a bit of help, I have currently written a HTTP server. It

  • 0

Looking for a bit of help, I have currently written a HTTP server. It currently handles GET requests fine. However, whilst using POST the buffered reader seems to hang. When the request is stopped the rest of the input stream is read via the buffered reader. I have found a few things on google. I have tried changing the CRLF and the protocol version from 1.1 to 1.0 (browsers automatically make requests as 1.1) Any ideas or help would be appreciated. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:22:11+00:00Added an answer on May 13, 2026 at 1:22 pm

    This is not safe! But shows how to get the POST data during an Input Stream after the initial HTTP Headers.

    This also only works for POST data coming in as “example=true&bad=false” etc.

    private HashMap hashMap = new HashMap();
    private StringBuffer buff = new StringBuffer();
    private int c = 0;
    private String[] post;    public PostInputStream(InputStream in) {
    
        try {
            //Initalizes avaliable buff
            if (in.available() != 0) {
                this.buff.appendCodePoint((this.c = in.read()));
                while (0 != in.available()) {
                    //Console.output(buff.toString());
                    buff.appendCodePoint((this.c = in.read()));
                }
    
                this.post = buff.toString().split("&");
    
                for (int i = 0; i < this.post.length; i++) {
                    String[] n = this.post[i].split("=");
                    if (n.length == 2) {
                        hashMap.put(URLDecoder.decode(n[0], "UTF-8"), URLDecoder.decode(n[1], "UTF-8"));
                    } else {
                        Console.error("Malformed Post Request.");
                    }
                }
            } else {
                Console.error("No POST Data");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a bit of a weird one and hopefully someone can help out. The
I have a bit of code below that creates a button on a html
I have a feeling my problem is a bit strange, but here goes... I
I'm currently debugging a huge MySql call which joins a large amount of tables
I'm looking for a way to dynamically load a master page in order to
Looking for advice as to the correct method of solving this design issue I
I'm predominately a Java guy, which is why I need some assistance on what
Here's my situation. I've just started a new job and I've inherited an application
I've got a little objective-c utility program that renders a convex hull. (This is
I've got a mass of values in a JSON file containing the names of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.