Differences in Implementing uip TCP/IP Application Handler (Protosocket)

I'm studying the uip stack, but confused by the different ways of implementing an application level socket handler.

For example, the uip SerialIP code , which is the one I'm interested in modifying for a webserver, polls for uart data and then does a callback to the telnet application handler:

int handle_connection(uip_tcp_appstate_t *s, connection_data *d)
{
  PSOCK_BEGIN(&s->p);
  // Send some text over the connection.
  PSOCK_SEND_STR(&s->p, "Hello. What is your name?\n");
  PSOCK_READTO(&s->p, '\n');
  strncpy(d->name, d->input_buffer, sizeof(d->name));

  // Send some more data over the connection.
  PSOCK_SEND_STR(&s->p, "Hello ");
  PSOCK_SEND_STR(&s->p, d->name);

  // Disconnect.
  PSOCK_CLOSE(&s->p);

  // All protosockets must end with this macro.  It closes the switch().
  PSOCK_END(&s->p);
}


void uip_callback (uip_tcp_appstate_t *s)
{
  if (uip_connected()) {

    connection_data *d = (connection_data *)malloc(sizeof(connection_data));

    // Save it as SerialIP user data so we can get to it later.
    s->user = d;
    PSOCK_INIT(&s->p, d->input_buffer, sizeof(d->input_buffer));

  }

  // Call/resume our protosocket handler.
  handle_connection(s, (connection_data *)s->user);

The Ethercard webserver architecture, on the other hand, also is based on uip, but implements a web server without all the callbacks and "protostacks":

void loop() {
  // listen for incoming clients
  EthernetClient client = server.available();
  if (client) {
    Serial.println("new client");
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");

Given the ethercard webserver, how can I massage it to work with the protostack architecture?