From 2f456eaa6c72853298241a13f3894363eacd6d20 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Voc=C5=AF?= Date: Thu, 8 Mar 2007 19:37:18 +0000 Subject: [PATCH] * more work --- org.glite.lb.logger/src-nt/HTTPTransport.cpp | 13 +++---------- org.glite.lb.logger/src-nt/main.cpp | 2 +- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/org.glite.lb.logger/src-nt/HTTPTransport.cpp b/org.glite.lb.logger/src-nt/HTTPTransport.cpp index a60162f..343943a 100644 --- a/org.glite.lb.logger/src-nt/HTTPTransport.cpp +++ b/org.glite.lb.logger/src-nt/HTTPTransport.cpp @@ -57,7 +57,9 @@ HTTPTransport::onReady() p = cr + 2; } else { // headers continue. parse the current one + *cr = 0; parseHeader(s, cr - s); + *cr = '\r'; } if(crlf_seen && (s == cr)) { // found CRLFCRLF @@ -170,23 +172,14 @@ int HTTPTransport::parseHeader(const char *s, unsigned int len) { char *p; - char tmp[256]; std::cout << "header: "; std::cout.write(s, len); std::cout << std::endl; std::cout.flush(); if(!strncasecmp(s, "Content-Length", 14)) { - int l; - p = (char*)memccpy((void*)s, (void*)s, ':', len); - if(p) { - l = (p - s < sizeof(tmp) - 1) ? p - s : sizeof(tmp) - 1; - memcpy(tmp, p, l); - tmp[l] = 0; - std::cout << "length " << tmp << std::endl; - content_length = atoi(tmp); - } + content_length = p ? atoi(p) : 0 ; } return(0); } diff --git a/org.glite.lb.logger/src-nt/main.cpp b/org.glite.lb.logger/src-nt/main.cpp index fce6c0e..63dfb92 100644 --- a/org.glite.lb.logger/src-nt/main.cpp +++ b/org.glite.lb.logger/src-nt/main.cpp @@ -5,7 +5,7 @@ #include "HTTPTransport.H" const int num_threads = 2; -const char *sock_path = "il_sock"; +const char *sock_path = "/tmp/il_sock"; int main(int argc, char *argv[]) { -- 1.8.2.3