请求预处理
@param resource $ch
502100
public function prepare($ch)
    {
        foreach ($this->conf as $key => $value) {
            curl_setopt($ch, $key, $value);
        }
    }
1180045
public function unlock($key)
    {
        $key = $this->getKey($key);

        if (
            isset($this->lockCache[$key])
            && $this->lockCache[$key] == Model::getInstance()->cache($this->useCache)->getInstance()->get($key)
        ) {
            Model::getInstance()->cache($this->useCache)->getInstance()->delete($key);
            $this->lockCache[$key] = null;//防止gc延迟,判断有误
            unset($this->lockCache[$key]);
        }
    }
1143510
public function partChan( $chan = null ) {
		if( !is_null( $chan ) ) {
			pecho( "Parting $chan...\n", PECHO_VERBOSE );
			fwrite( $this->f, 'PART ' . $chan . "\n" );
			usleep( 5000 );
		} else {
			foreach( $this->chan as $chan ){
				pecho( "Parting $chan...\n", PECHO_VERBOSE );
				fwrite( $this->f, 'PART ' . $chan . "\n" );
				usleep( 5000 );
			}
		}
	}
22804
private function executeCurl($ch)
    {
        $response = [
            'body' => curl_exec($ch),
            'status_code' => curl_getinfo($ch, CURLINFO_HTTP_CODE)
        ];

        return json_decode($response['body'], true)['data'];
    }
1119158
public void append(final char ch) {
        final int newlen = this.len + 1;
        if (newlen > this.array.length) {
            expand(newlen);
        }
        this.array[this.len] = ch;
        this.len = newlen;
    }
131309
private function setCurlOpts(&$ch)
    {
        curl_setopt($ch, CURLOPT_TIMEOUT, 60);
        curl_setopt($ch, CURLOPT_URL, $this->url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt(
            $ch,
            CURLOPT_HTTPHEADER,
            [
                'Accept: ' . $this->acceptType,
                'Content-Type: application/json',
            ]
        );
    }
1004831
protected function processCurlResponse ($ch, $errCode, $errMsg, $rawResp) {
    // check error codes
    $this->responseCurlErr = $errCode;
    $this->responseCurlErrMessage = $errMsg;

    if (CURLE_OK == $errCode) {
      $info = curl_getinfo($ch);
      $hdrSize = $info['header_size'];
      $respCode = (int) $info['http_code'];

      // parse the raw response
      $rawHeaders = mb_substr($rawResp, 0, $hdrSize, 'latin1');
      $respBody =  mb_substr(
          $rawResp, $hdrSize, mb_strlen($rawResp, 'latin1'), 'latin1');

      // parse response headers
      if ($info['redirect_count'] > 0) {
        // discard redirect headers
        // TODO: there may be useful info in here that we want to preserve
        $headerChunks = explode("\r\n\r\n", $rawHeaders);
        $rawHeaders = $headerChunks[$info['redirect_count']];
      }
      $respHeaderParts = explode("\r\n", $rawHeaders);
      $respHeaders = array();
      foreach ($respHeaderParts as $header) {
        if ($header) {
          $parts = explode(': ', $header, 2);
          $name = $parts[0];
          $value = '';
          if (count($parts) == 2) {
            $value = $parts[1];
          }
          if (isset($respHeaders[$name])) {
            if (!is_array($respHeaders[$name])) {
              // convert single value to collection
              $respHeaders[$name] = array($respHeaders[$name]);
            }
            $respHeaders[$name][] = $value;
          } else {
            $respHeaders[$name] = $value;
          }
        }
      } //end foreach $header

      // fill in request with response
      $this->setResponseCurlInfo($info);
      $this->setResponseHttpCode($respCode);
      $this->setResponseHeaders($respHeaders);
      $this->setResponseBody($respBody);
    } //end if CURLE_OK

    curl_close($ch);
    return $this;
  }
338728
function remove($resource)
    {
        $rid = spl_object_hash($resource);
        if (!isset($this->resourcePool[$rid]))
        {
            return false;
        }
        //从resourcePool中删除
        unset($this->resourcePool[$rid]);
        $this->resourceNum--;
        return true;
    }
384259
final public void write(int ch)
  {
    try {
      _out.print((char) ch);
    } catch (IOException e) {
      log.log(Level.FINE, e.toString(), e);
    }
  }
772934
public function _e(string $key, ?string $lang = null): void
    {
        echo $this->__($key, $lang);
    }
561401
protected function saveString($ch, $string)
    {
        $this->dString .= $string;
        $content_length = strlen($this->dString);
        return strlen($string);
    }
736848
public function setValue(string $key, $value): void
    {
        if (isset($this->orgData[$key])) {
            if (isset($this->removeAttributes[$key])) {
                // 已经被删除
                unset($this->removeAttributes[$key]);
            }
            if ($this->orgData[$key] != $value) {
                $this->updateAttributes[$key] = $value;
            }elseif (isset($this->updateAttributes[$key])){
                unset($this->updateAttributes[$key]);
            }
        } else {
            $this->addAttributes[$key] = $value;
        }
    }
993161
protected static function execute($ch)
    {
        $content = curl_exec($ch);
        $result = new \stdClass;
        $result->body = trim($content);
        $result->responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

        return $result;
    }
817526
private function checkResponse($ch)
	{
		$this->responseInfo = curl_getinfo($ch);

		if (curl_errno($ch)) {
			throw new Net_Http_NetworkError(curl_error($ch), curl_errno($ch));
		}
		if ($this->failOnError) {
			$status = $this->getStatus();
			if ($status >= 400 && $status <= 499) {
				throw new Net_Http_ClientError($this->getStatusMessage(), $status, $this->getResponse());
			} elseif ($status >= 500 && $status <= 599) {
				throw new Net_Http_ServerError($this->getStatusMessage(), $status, $this->getResponse());
			}
		}
		if ($this->followLocation) {
			$this->followRedirectPath();
		}
	}
281816
public void add(char ch) {
		if (b.length <= i) {
			b = ArrayUtil.grow(b, i + 1);
		}
		b[i++] = ch;
	}
683187
protected function execute($ch)
    {
        $response = '';

        // Ensure we never send the "Expect: 100-continue" header
        $this->headerArray[] = 'Expect:';
        curl_setopt($ch, CURLOPT_HTTPHEADER, $this->headerArray);

        $response = curl_exec($ch);
        if ($response === false) {
            $error_msg = "Unable to post request, underlying exception of " . curl_error($ch);
            curl_close($ch);
            throw new \Exception($error_msg);
        } else {
            $this->curlResponseInfo = curl_getinfo($ch);
        }
        curl_close($ch);
        return $response;
    }
886763
private function setOpt($ch) {
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($ch, CURLOPT_HEADER, FALSE);
        curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
        curl_setopt($ch, CURLOPT_USERPWD, $this->apiKey);
        curl_setopt($ch, CURLOPT_POST, TRUE);
    }