예제 #1
0
	void print(const x0::BufferRef& v, const char *msg = 0)
	{
		if (msg && *msg)
			printf("buffer.view(%s): '%s'\n", msg, v.str().c_str());
		else
			printf("buffer.view: '%s'\n", v.str().c_str());

		printf("  size=%ld\n", v.size());
	}
예제 #2
0
파일: io_test.cpp 프로젝트: tempbottle/x0
  void print(const x0::BufferRef& v, const char* msg = 0) {
    char prefix[64];
    if (msg && *msg)
      snprintf(prefix, sizeof(prefix), "\nbuffer.view(%s)", msg);
    else
      snprintf(prefix, sizeof(prefix), "\nbuffer.view");

    if (v)
      printf("\n%s: '%s' (size=%ld)\n", prefix, v.str().c_str(), v.size());
    else
      printf("\n%s: NULL\n", prefix);
  }
예제 #3
0
	// Handler, invoked on request content body chunks,
	// which we want to "echo" back to the client.
	//
	// NOTE, this can be invoked multiple times, depending on the input.
	void onContent(const x0::BufferRef& chunk)
	{
		TRACE("onContent('%s')", chunk.str().c_str());
		request_->write<x0::BufferRefSource>(std::move(chunk));
		request_->writeCallback<EchoHandler, &EchoHandler::contentWritten>(this);
	}