1/* 2 * Copyright 2009, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Michael Lotz <mmlr@mlotz.ch> 7 * François Revol <revol@free.fr> 8 */ 9 10#include "WebHandler.h" 11 12#include "StreamingRingBuffer.h" 13 14#include <NetEndpoint.h> 15 16#include <stdio.h> 17#include <stdlib.h> 18#include <string.h> 19 20#define TRACE(x...) debug_printf("WebHandler: "x) 21#define TRACE_ERROR(x...) debug_printf("WebHandler: "x) 22 23 24WebHandler::WebHandler(const char *path, BDataIO *data) 25 : 26 fPath(path), 27 fMultipart(false), 28 fType(""), 29 fData(data), 30 fTarget(NULL) 31{ 32} 33 34 35WebHandler::WebHandler(const char *path, StreamingRingBuffer *target) 36 : 37 fPath(path), 38 fMultipart(false), 39 fType(""), 40 fData(NULL), 41 fTarget(target) 42{ 43} 44 45 46WebHandler::~WebHandler() 47{ 48 delete fData; 49} 50 51 52status_t 53WebHandler::HandleRequest(WebWorker *worker, BString &path) 54{ 55// off_t offset = 0LL; 56 57 return B_OK; 58} 59 60 61int 62WebHandler::_CallbackCompare(const BString* key, 63 const WebHandler* info) 64{ 65 int diff = strcmp(*key, info->fPath.String()); 66 TRACE("'%s' <> '%s' %d\n", key->String(), info->fPath.String(), diff); 67 if (diff == 0) 68 return 0; 69 if (diff < 0) 70 return -1; 71 return 1; 72// return strcmp(*key, info->fPath.String()); 73} 74 75 76int 77WebHandler::_CallbackCompare(const WebHandler* a, const WebHandler* b) 78{ 79 int diff = strcmp(a->fPath.String(), b->fPath.String()); 80 return diff; 81// return strcmp(*key, info->fPath.String()); 82} 83 84 85 86