Returns a read/write pair for a POST request.
967725
public StreamImpl openReadWriteImpl() throws IOException
  {
    HttpStreamWrapper stream = HttpStream.openReadWrite(this);

    stream.setSSL(true);
    
    return stream;
  }
169281
private String getResponseBody(HttpResponse postResponse) {
        InputStream input = null;
        try {
            input = postResponse.getEntity().getContent();
            Reader reader = new InputStreamReader(input,
                    MwsUtl.DEFAULT_ENCODING);
            StringBuilder b = new StringBuilder();
            char[] c = new char[1024];
            int len;
            while (0 < (len = reader.read(c))) {
                b.append(c, 0, len);
            }
            return b.toString();
        } catch (Exception e) {
            throw MwsUtl.wrap(e);
        } finally {
            MwsUtl.close(input);
        }
    }
1101370
def rest_post(self, url, params=None, headers=None, auth=None, verify=True, cert=None):
        
        res = requests.post(url, params=params, headers=headers, auth=auth, verify=verify,
                            cert=cert)
        return res.text, res.status_code
904203
def ReadRequestsAndResponses(self,
                               session_id,
                               timestamp=None,
                               request_limit=None,
                               response_limit=None):
    """"""
    subject = session_id.Add("state")
    requests = {}

    # Get some requests.
    for predicate, serialized, _ in self.ResolvePrefix(
        subject,
        self.FLOW_REQUEST_PREFIX,
        limit=request_limit,
        timestamp=timestamp):

      request_id = predicate.split(":", 1)[1]
      requests[str(subject.Add(request_id))] = serialized

    # And the responses for them.
    response_data = dict(
        self.MultiResolvePrefix(
            list(iterkeys(requests)),
            self.FLOW_RESPONSE_PREFIX,
            limit=response_limit,
            timestamp=timestamp))

    for urn, request_data in sorted(iteritems(requests)):
      request = rdf_flow_runner.RequestState.FromSerializedString(request_data)
      responses = []
      for _, serialized, timestamp in response_data.get(urn, []):
        msg = rdf_flows.GrrMessage.FromSerializedString(serialized)
        msg.timestamp = timestamp
        responses.append(msg)

      yield (request, sorted(responses, key=lambda msg: msg.response_id))
993357
def fetch_post_data(self):
        '''
        
        '''
        post_data = {}
        ext_dic = {}
        for key in self.request.arguments:
            if key.startswith('def_'):
                ext_dic[key] = self.get_argument(key)
            else:
                post_data[key] = self.get_arguments(key)[0]

        post_data['user_name'] = self.userinfo.user_name

        ext_dic = dict(ext_dic, **self.ext_post_data(postdata=post_data))

        return (post_data, ext_dic)
372210
private void addPostParams(final Request request) {
        if (read != null) {
            request.addPostParam("Read", read.toString());
        }

        if (write != null) {
            request.addPostParam("Write", write.toString());
        }

        if (manage != null) {
            request.addPostParam("Manage", manage.toString());
        }
    }
537557
def make_post_request(self, url, auth, json_payload):
        """"""
        response = requests.post(url, auth=auth, json=json_payload)
        return response.json()
134221
function serialize(pairs) {
					var output = '', first = true;
					pairs.forEach(function (pair) {
						var name = encodeURIComponent(pair.name);
						var value = encodeURIComponent(pair.value);
						if (!first) output += '&';
						output += name + '=' + value;
						first = false;
					});
					return output.replace(/%20/g, '+');
				}
955972
private String getPostData(final ICommandLine cl) throws Exception {
        // String encoded = "";
        StringBuilder encoded = new StringBuilder();
        String data = cl.getOptionValue("post");
        if (data == null) {
            return null;
        }
        String[] values = data.split("&");
        for (String value : values) {
            String[] splitted = value.split("=");
            String key = splitted[0];
            String val = "";
            if (splitted.length > 1) {
                val = splitted[1];
            }
            if (encoded.length() != 0) {
                encoded.append('&');
            }
            encoded.append(key).append('=').append(URLEncoder.encode(val, "UTF-8"));
            // encoded += key + "=" + URLEncoder.encode(val, "UTF-8") + "&";
        }
        // if (encoded.endsWith("&")) {
        // StringUtils.removeEnd(encoded, "&");
        // }
        return encoded.toString();
    }
81235
def write_pair(field, value)
      key = (field.tag << 3) | field.wire_type
      stream << ::Protobuf::Field::VarintField.encode(key)
      stream << field.encode(value)
    end
922631
private Memory readChunkOffsets(DataInput input) {
        try {
            int chunkCount = input.readInt();
            Memory offsets = Memory.allocate(chunkCount * 8);

            for (int i = 0; i < chunkCount; i++) {
                try {
                    offsets.setLong(i * 8, input.readLong());
                } catch (EOFException e) {
                    String msg = String.format("Corrupted Index File %s: read %d but expected %d chunks.",
                            indexFilePath, i, chunkCount);
                    throw new CorruptSSTableException(new IOException(msg, e), indexFilePath);
                }
            }

            return offsets;
        } catch (IOException e) {
            throw new FSReadError(e, indexFilePath);
        }
    }
1077785
def _get_post_data(cls, args):
        ''''''
        if args.post_data:
            return args.post_data
        elif args.post_file:
            return args.post_file.read()
1326996
def write(self, data):
        """"""
        while True:
            try:
                return self._sslobj.write(data)
            except SSLError:
                ex = sys.exc_info()[1]
                if ex.args[0] == SSL_ERROR_WANT_READ:
                    if self.timeout == 0.0:
                        raise
                    six.exc_clear()
                    self._io.wait_read(timeout=self.timeout, timeout_exc=_SSLErrorWriteTimeout)
                elif ex.args[0] == SSL_ERROR_WANT_WRITE:
                    if self.timeout == 0.0:
                        raise
                    six.exc_clear()
                    self._io.wait_write(timeout=self.timeout, timeout_exc=_SSLErrorWriteTimeout)
                else:
                    raise
1159410
private void readHttpDataChunkByChunk(HttpPostRequestDecoder decoder) {
        try {
            while (decoder.hasNext()) {
                InterfaceHttpData data = decoder.next();
                if (data != null) {
                    // check if current HttpData is a FileUpload and previously set as partial
                    if (partialContent == data) {
                        partialContent = null;
                    }
                    try {
                        // new value
                        writeHttpData(data);
                    } finally {
                        data.release();
                    }
                }
            }
            // Check partial decoding for a FileUpload
            InterfaceHttpData data = decoder.currentPartialHttpData();
            if (data != null) {
                if (partialContent == null) {
                    partialContent = (HttpData) data;
                }
            }
        } catch (HttpPostRequestDecoder.EndOfDataDecoderException e1) {
            // end
        }
    }
696915
protected Hashtable parsePostData() throws IOException {
        if( getContentLength() > 0){
            if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))  //306998.15
                logger.logp(Level.FINE, CLASS_NAME,"parsePostData", "parsing post data based upon content length");
            return RequestUtils.parsePostData(getContentLength(), getInputStream(), getReaderEncoding(), this.multiReadPropertyEnabled);  // MultiRead
        } 
        if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))  //306998.15
            logger.logp(Level.FINE, CLASS_NAME,"parsePostData", "parsing post data based upon input stream (possibly chunked)");
        return RequestUtils.parsePostData(getInputStream(), getReaderEncoding(),this.multiReadPropertyEnabled);   // MultiRead
    }
108069
def port_pair(self):
        """"""
        if self.transport is NotSpecified:
            return (self.port, "tcp")
        else:
            return (self.port, self.transport)
918745
def reply_bytes(self, request):
        """"""
        flags = struct.pack("<i", self._flags)
        cursor_id = struct.pack("<q", self._cursor_id)
        starting_from = struct.pack("<i", self._starting_from)
        number_returned = struct.pack("<i", len(self._docs))
        reply_id = random.randint(0, 1000000)
        response_to = request.request_id

        data = b''.join([flags, cursor_id, starting_from, number_returned])
        data += b''.join([bson.BSON.encode(doc) for doc in self._docs])

        message = struct.pack("<i", 16 + len(data))
        message += struct.pack("<i", reply_id)
        message += struct.pack("<i", response_to)
        message += struct.pack("<i", OP_REPLY)
        return message + data