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

Im looking for a bit of help with wordpress development. I have created a
Looking for a bit of regex help. I'd like to design an expression that
I have a report model looking a bit like this: class Report(models.Model): date =
I'm in a bit of a predicament and I'm looking for some help on
I am currently using the ExternalTemplate extension to have my templates loaded via ajax
Hey, I'm looking for a bit of advice here, I have a simple model
Looking for a bit of help with taking a dat from a DatePicker Widget
I am looking for a bit of help. I realize there are many threads
It is looking like i have a major memory leak in this little bit
I have currently hit a bit of an issue with redirecting users with .htaccess

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.