Send the data in a separate thread via HTTP POST.
        HTTP introduces some overhead, so to avoid blocking the main thread,
        this issues the request in the background.
338220
def send(self, data):
        
        self.future_session.post(url=self.url, data=data)
1226386
function doPost(options, data, callback) {
  var buffer = '';
  var req = http.request(options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
      buffer += chunk;
    });
    res.on('end', function(err) {
      callback(err, buffer);
    });
  }).on('error', function(e) {
    callback(e);
  });

  if (data && data.length) {
    req.write(data);
  }
  req.end();
}
1120925
private HttpResponse executeRequest(HttpPost request) throws Exception {
        try {
            HttpClient httpClient = connection.getHttpClient();
            HttpContext httpContext = connection.getHttpContext();
            HttpResponse response = httpClient.execute(request, httpContext);
            return response;
        } catch (Exception e) {
            throw MwsUtl.wrap(e);
        }
    }
161989
public void sendData(byte[] data) throws ResponseException {
        if(con.isClosed()) return;

        Socket socket = null;
        try {
            socket = conHandler.createDataSocket();
            dataConnections.add(socket);
            OutputStream out = socket.getOutputStream();

            Utils.write(out, data, data.length, conHandler.isAsciiMode());
            bytesTransferred += data.length;

            out.flush();
            Utils.closeQuietly(out);
            Utils.closeQuietly(socket);
        } catch(SocketException ex) {
            throw new ResponseException(426, "Transfer aborted");
        } catch(IOException ex) {
            throw new ResponseException(425, "An error occurred while transferring the data");
        } finally {
            onUpdate();
            if(socket != null) dataConnections.remove(socket);
        }
    }
1026006
@Override
  public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    if (req.getRequestURI().endsWith("upload")) {
      uploadCallback(req, resp);
    } else {
      resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
    }
  }
37170
public RFuture<String> post(String url, String data) {
    return req(url).setPayload(data).execute().map(GET_PAYLOAD);
  }
279848
def send(self, data):
        
        data = bytes(data) if type(data) is not bytes else data
        self._wa_noiseprotocol.send(data)
998716
def post(self, url, headers=None, body=None, kwargs=None):
        
        return self._request(
            method='post',
            url=url,
            headers=headers,
            body=body,
            kwargs=kwargs
        )
533063
def post(self, url, data=None, json=None, callback=None, retry=0, **kwargs):
        """"""
        return self.request(
            "post",
            url=url,
            data=data,
            json=json,
            callback=callback,
            retry=retry,
            **kwargs
        )
200893
async def send_request(self, method, args=()):
        ''''''
        message, event = self.connection.send_request(Request(method, args))
        return await self._send_concurrent(message, event, 1)
568982
function (stream) {
    var that = this
    stream.once('data', function (d) {
      stream.pause()
      stream.unshift(d)
      /*
       * Because:
       * In HTTP 1.0 and 1.1 Request-Line which begins with a method token (or printable chars like [P]OST [G]ET).
       * Also servers SHOULD ignore any empty line(s) received where a Request-Line is expected [rfc2616-sec4.1] [rfc2616-sec5.1]
       * AND
       * In MQTT the first Packet sent from the Client to the Server MUST be a CONNECT Packet [MQTT-3.1.0-1].
       * Therefore:
       * A valid MQTT request begins with 0x10 and a HTTP request must not
       */
      if (d[ 0 ] === 0x10 || d[ 0 ] === String.fromCharCode(0x10)) {
        mqttListener.call(that, stream)
      } else {
        httpListener.call(that, stream)
      }
      stream.resume()
    })
  }
180532
def do_POST(self):
        '''
        '''
        global _contexts

        soapAction = self.headers.getheader('SOAPAction')
        post = self.path
        if not post:
            raise PostNotSpecified, 'HTTP POST not specified in request'
        if soapAction:
            soapAction = soapAction.strip('\'"')
        post = post.strip('\'"')
        try:
            ct = self.headers['content-type']
            if ct.startswith('multipart/'):
                cid = resolvers.MIMEResolver(ct, self.rfile)
                xml = cid.GetSOAPPart()
                ps = ParsedSoap(xml, resolver=cid.Resolve, readerclass=DomletteReader)
            else:
                length = int(self.headers['content-length'])
                ps = ParsedSoap(self.rfile.read(length), readerclass=DomletteReader)
        except ParseException, e:
            self.send_fault(FaultFromZSIException(e))
        except Exception, e:
            # Faulted while processing; assume it's in the header.
            self.send_fault(FaultFromException(e, 1, sys.exc_info()[2]))
        else:
            # Keep track of calls
            thread_id = thread.get_ident()
            _contexts[thread_id] = SOAPContext(self.server, xml, ps,
                                               self.connection,
                                               self.headers, soapAction)

            try:
                _Dispatch(ps, self.server, self.send_xml, self.send_fault,
                    post=post, action=soapAction)
            except Exception, e:
                self.send_fault(FaultFromException(e, 0, sys.exc_info()[2]))

            # Clean up after the call
            if _contexts.has_key(thread_id):
                del _contexts[thread_id]
1252186
def send_requests(self, *args):
        
        threads = [ClientThread(self, req) for req in args]
        for t in threads:
            t.start()
        for t in threads:
            t.join()
        exceptions = [t.exception for t in threads if t.exception]
        if len(exceptions):
            raise exceptions[0]
        return [t.response for t in threads]
700936
synchronized boolean sendPayload(final PayloadData payload) {
		if (payload == null) {
			throw new IllegalArgumentException("Payload is null");
		}

		// we don't allow concurrent payload sending
		if (isSendingPayload()) {
			return false;
		}

		// we mark the sender as "busy" so no other payloads would be sent until we're done
		sendingFlag = true;

		try {
			sendPayloadRequest(payload);
		} catch (Exception e) {
			ApptentiveLog.e(e, "Exception while sending payload: %s", payload);
			logException(e);

			// for NullPointerException, the message object would be null, we should handle it separately
			// TODO: add a helper class for handling that
			String message = e.getMessage();
			if (message == null) {
				message = StringUtils.format("%s is thrown", e.getClass().getSimpleName());
			}

			// if an exception was thrown - mark payload as failed
			handleFinishSendingPayload(payload, false, message, -1, null); // TODO: a better approach
		}

		return true;
	}
415066
public static Post post(String url, byte[] content, int connectTimeout, int readTimeout) {

        try {
            return new Post(url, content, connectTimeout, readTimeout);
        } catch (Exception e) {
            throw new HttpException("Failed URL: " + url, e);
        }
    }
1075090
protected HttpResponse sendImpl() throws IOException {
    HttpURLConnection con = (HttpURLConnection) uri.toURL().openConnection();
    con.setConnectTimeout(connectTimeout);
    con.setReadTimeout(readTimeout);
    con.setRequestMethod(method);
    for (Map.Entry<String, String> h : reqHeaders.entrySet()) {
      con.setRequestProperty(h.getKey(), h.getValue());
    }
    configureHTTPS(con);

    boolean canRetry = true;
    try {
      con.setDoInput(true);

      // HttpURLConnection will change method to POST if there is a body associated
      // with a GET request. Only try to write entity if it is not empty.
      entry.withRequestContentLength(entity.length).mark("start");
      if (entity.length > 0) {
        con.setDoOutput(true);
        try (OutputStream out = con.getOutputStream()) {
          out.write(entity);
        }
      }

      int status = con.getResponseCode();
      canRetry = (status >= 500 || status == 429);
      entry.mark("complete").withStatusCode(status);

      // A null key is used to return the status line, remove it before sending to
      // the log entry or creating the response object
      Map<String, List<String>> headers = new LinkedHashMap<>(con.getHeaderFields());
      headers.remove(null);
      for (Map.Entry<String, List<String>> h : headers.entrySet()) {
        for (String v : h.getValue()) {
          entry.withResponseHeader(h.getKey(), v);
        }
      }

      try (InputStream in = (status >= 400) ? con.getErrorStream() : con.getInputStream()) {
        byte[] data = readAll(in);
        entry.withResponseContentLength(data.length);
        return new HttpResponse(status, headers, data);
      }
    } catch (IOException e) {
      entry.mark("complete").withException(e);
      throw e;
    } finally {
      entry.withCanRetry(canRetry);
      HttpLogEntry.logClientRequest(entry);
    }
  }
556744
@Override
	public final InputStream doRequest(InputStream httpBody) throws CommunicationException {
		InputStream reply = null;

		try {

			getSocket();

			prepareCommunication();

			createPostRequest(getPath());

			writeHostLine();

			writeContentTypeHeaders();

			httpBody = logAndCloneInputStream(httpBody, "request");

			if (usesGzip()) {
				httpBody = compressInputStream(httpBody);
				writeGzipHeaders();
			}

			if (usesBasicAuth()) {
				writeAuthHeader();
			}

			writeContentLengthHeader(httpBody.available());

			finishHeaders();

			reply = doActualRequest(httpBody);

			reply = logAndCloneInputStream(reply, "response");

			if (replyIsGzipped()) {
				reply = new GZIPInputStream(reply);
			}

			return reply;

		} catch (IOException e) {
			throw new CommunicationException(e.getMessage());
		}
	}