Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8271187

[macos]HttpURLConnection cannot do a POST with a long body size

XMLWordPrintable

    • x86_64
    • os_x

      ADDITIONAL SYSTEM INFORMATION :
      It happened in all the java versions I tried (8,9,10,14,16) under Mac OS. Although, the same code works in Linux.
      I think it's a bug on it's core libs, written in C for Mac OS.

      A DESCRIPTION OF THE PROBLEM :
      The HttpURLConnection class caps and mess up the body of a HTTP POST.
      If you send a HTTP POST with a small body, it works, but if you send a HTTP POST with for instance, 10k bytes on its body, it does not work.
      The problem is exactly when BODY content has more than 65839 characters.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a POST using any subclass of java/net/HttpURLConnection.java, which is abstract) with the BODY having more than 65839 characters.
      Run it on Mac OS targeting it to any server accepting HTTP requests.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Receiving the exact content being POST.
      ACTUAL -
      The content is caped, and the beginning of the string does not follow HTTP protocol.

      ---------- BEGIN SOURCE ----------

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Using the new http.client package.

      FREQUENCY : always


            jpai Jaikiran Pai
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: