[Fedora-directory-commits] esc/src/lib/NssHttpClient HttpClientNss.h, 1.1.1.1, 1.2 Iterator.h, 1.1.1.1, 1.2 NssHttpClient.cpp, 1.1.1.1, 1.2 engine.cpp, 1.1.1.1, 1.2 http.cpp, 1.1.1.1, 1.2 http.h, 1.1.1.1, 1.2 httpClientNss.cpp, 1.1.1.1, 1.2 manifest.mn, 1.1.1.1, 1.2 request.cpp, 1.1.1.1, 1.2 response.cpp, 1.1.1.1, 1.2

Jack Magne (jmagne) fedora-directory-commits at redhat.com
Wed Sep 27 17:49:24 UTC 2006


Author: jmagne

Update of /cvs/dirsec/esc/src/lib/NssHttpClient
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv27475

Modified Files:
	HttpClientNss.h Iterator.h NssHttpClient.cpp engine.cpp 
	http.cpp http.h httpClientNss.cpp manifest.mn request.cpp 
	response.cpp 
Log Message:
Latest updates.


Index: HttpClientNss.h
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/NssHttpClient/HttpClientNss.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- HttpClientNss.h	12 Jun 2006 23:39:52 -0000	1.1.1.1
+++ HttpClientNss.h	27 Sep 2006 17:49:21 -0000	1.2
@@ -33,8 +33,6 @@
     PSHttpRequest *        _request;
     PSHttpResponse*        _response;
 
-
-    PSHttpResponse *httpSend(char *host_port, char *uri, char *method, char *body);
     PSHttpResponse *httpSendChunked(char *host_port, char *uri, char *method, char *body,PSChunkedResponseCallback cb,void *uw,PRBool doSSL = PR_FALSE,int messageTimeout =30);
 
     PRBool sendChunkedEntityData(int body_len,unsigned char * body);


Index: Iterator.h
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/NssHttpClient/Iterator.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- Iterator.h	12 Jun 2006 23:39:53 -0000	1.1.1.1
+++ Iterator.h	27 Sep 2006 17:49:21 -0000	1.2
@@ -39,6 +39,9 @@
      * @return The next element, if any, or NULL
      */
     virtual void *Next() = 0;
+
+    virtual ~Iterator(){}; 
+
 };
 
 #endif // _ITERATOR_H_


Index: NssHttpClient.cpp
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/NssHttpClient/NssHttpClient.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- NssHttpClient.cpp	12 Jun 2006 23:39:52 -0000	1.1.1.1
+++ NssHttpClient.cpp	27 Sep 2006 17:49:21 -0000	1.2
@@ -69,9 +69,8 @@
     {
         PRBool result = InitSecurity(NULL, NULL, NULL, NULL,1 );
 
-        if(result = PR_FALSE)
+        if(result == PR_FALSE)
         {
-            
             return 0;
         }
 


Index: engine.cpp
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/NssHttpClient/engine.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- engine.cpp	12 Jun 2006 23:39:53 -0000	1.1.1.1
+++ engine.cpp	27 Sep 2006 17:49:21 -0000	1.2
@@ -27,7 +27,6 @@
 #include "certt.h"
 #include "sslerr.h"
 #include "secerr.h"
-#include "secutil.h"
 
 #include "engine.h"
 #include "http.h"
@@ -42,18 +41,6 @@
 
 PRIntervalTime Engine::globaltimeout = PR_TicksPerSecond()*30;
 
-static char * ownPasswd( PK11SlotInfo *slot, PRBool retry, void *arg) {
-    if (!retry) {
-       if( password != NULL ) {
-            return PL_strdup(password);
-       } else {
-            return PL_strdup( "httptest" );
-       }
-    } else {
-        return NULL;
-    }
-}
-
 /**
  * Function: SECStatus myBadCertHandler()
  * <BR>
@@ -248,9 +235,6 @@
         }
     }
 
-    PRErrorCode error =  PR_GetError();
-
-
     /* If this is a server, we're finished. */
     if (isServer || secStatus != SECSuccess) {
         return secStatus;


Index: http.cpp
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/NssHttpClient/http.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- http.cpp	12 Jun 2006 23:39:53 -0000	1.1.1.1
+++ http.cpp	27 Sep 2006 17:49:21 -0000	1.2
@@ -144,6 +144,8 @@
             return "HTTP/1.1";
         case HTTPBOGUS:
             return "BOGO-PROTO";
+        default:
+            break;
     }
 
     return NULL;


Index: http.h
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/NssHttpClient/http.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- http.h	12 Jun 2006 23:39:53 -0000	1.1.1.1
+++ http.h	27 Sep 2006 17:49:21 -0000	1.2
@@ -43,7 +43,6 @@
 typedef bool ( *PSChunkedResponseCallback)(unsigned char *entity_data,unsigned entity_data_len,void *uw, int status);
 
 class PSHttpResponse;
-extern PSHttpResponse *httpSend(char *host_port, char *uri, char *method, char *body);
 
 PSHttpResponse *httpSendChunked(char *host_port, char *uri, char *method, char *body,PSChunkedResponseCallback cb,void *uw);
 


Index: httpClientNss.cpp
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/NssHttpClient/httpClientNss.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- httpClientNss.cpp	12 Jun 2006 23:39:53 -0000	1.1.1.1
+++ httpClientNss.cpp	27 Sep 2006 17:49:21 -0000	1.2
@@ -53,45 +53,6 @@
 }
 
 /*
- * httpSend: sends to an HTTP server
- * Standard Http, may not work in this version.
- */
-PSHttpResponse *HttpClientNss::httpSend(char *host_port, char *uri, char *method, char *body)
-{
-    const char* nickname = NULL;
-
-    int timeout = 30;
-
-    PSHttpServer server(host_port, PR_AF_INET);
-    server.setSSL(PR_TRUE);
-    // use "HTTP10" if no chunking
-    PSHttpRequest request( &server, uri, HTTP11, 0 );
-   
-
-    _request = &request;
-    request.setSSL(PR_FALSE);
-   
-    request.setMethod(method);
-    if (body != NULL)
-        request.setBody( (int)strlen(body), body);
-
-    // use with "POST" only
-    request.addHeader( "Content-Type", "text/xml" );
-    request.addHeader( "Connection", "keep-alive" );
-    HttpEngine engine;
-    PSHttpResponse *resp =  engine.makeRequest( request, server, 30 /*_timeout*/ , PR_FALSE /* expect chunked*/);
-
-    _response = resp;
-
-    if(resp->getStatus() != 200)
-    {
-        return NULL;
-
-    }
-    return resp;
-}
-
-/*
 Send a http message with a persistant transfer chunked encoded message type
 
 */
@@ -147,17 +108,14 @@
 }
 void HttpClientNss::CloseConnection()
 {
-
     if(_engine)
     {
         _engine->CloseConnection();
-
     }
 
 }
 PRBool HttpClientNss::sendChunkedEntityData(int body_len,unsigned char *body)
 {
-
     int timeout = PR_TicksPerSecond()*60;
 
     char chunked_message[4096];
@@ -171,7 +129,6 @@
         return PR_FALSE;
     }
 
-
     HttpEngine *engine= getEngine();
 
     if(!engine)


Index: manifest.mn
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/NssHttpClient/manifest.mn,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- manifest.mn	12 Jun 2006 23:39:52 -0000	1.1.1.1
+++ manifest.mn	27 Sep 2006 17:49:21 -0000	1.2
@@ -17,11 +17,16 @@
 
 CORE_DEPTH	= ../../..
 
+SYS_INC		= /usr/include
 MODULE		= httpchunked
 LIBRARY_NAME	= $(MODULE)
 SHARED_NAME	= $(MODULE)
 REQUIRES	= nss nspr 
+ifndef MOZ_OFFSET
+MOZ_OFFSET	= mozilla-1.7.13
+endif
 MAPFILE		= $(OBJDIR)/httpchunked.def
+DEFINES		= -I$(SYS_INC)/nspr4 -I$(SYS_INC)/nss3 -I$(SYS_INC)/$(MOZ_OFFSET)/nspr -I$(SYS_INC)/$(MOZ_OFFSET)/nss
 
 CPPSRCS		= \
 		Cache.cpp \


Index: request.cpp
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/NssHttpClient/request.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- request.cpp	12 Jun 2006 23:39:53 -0000	1.1.1.1
+++ request.cpp	27 Sep 2006 17:49:21 -0000	1.2
@@ -17,13 +17,15 @@
  * All rights reserved.
  * END COPYRIGHT BLOCK **/
 
+#define FORCE_PR_LOG 1
+
 #include <string.h>
 #include <stdio.h>
 #include "request.h"
 #include "engine.h"
 #include <prlog.h>
 
-PRLogModuleInfo *httpLog = PR_NewLogModule("coolkey");
+PRLogModuleInfo *httpLog = PR_NewLogModule("coolKeyHttpReq");
 
 /**
  * Constructor


Index: response.cpp
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/NssHttpClient/response.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- response.cpp	12 Jun 2006 23:39:52 -0000	1.1.1.1
+++ response.cpp	27 Sep 2006 17:49:21 -0000	1.2
@@ -16,6 +16,8 @@
  * All rights reserved.
  * END COPYRIGHT BLOCK **/
 
+#define FORCE_PR_LOG 1
+
 /**
  * HTTP response handler
  */
@@ -35,10 +37,8 @@
 #endif
 #include "Util.h"
 
-PRLogModuleInfo *httpRespLog = PR_NewLogModule("coolkey");
+PRLogModuleInfo *httpRespLog = PR_NewLogModule("coolKeyHttpRes");
 
-void printBuf(int , char* );
-void dump_data(unsigned char *aData, int aLen);
 
 /**
  * Constructor. This class is used by  the HttpResponse class for reading and
@@ -174,16 +174,12 @@
 
     if(!_streamMode )
     {
-    _content = (char *) PR_Malloc(_curSize+1);
-    if (_content == NULL) {
-        return PR_FALSE;
+        _content = (char *) PR_Malloc(_curSize+1);
+        if (_content == NULL) 
+             return PR_FALSE;
     
-    memcpy((char*) _content, (const char *)_buf, _curSize+1);
-    _contentSize = _curSize +1;
-
-    }
-  
-    //dump_data(( unsigned char *) _content,_contentSize); 
+        memcpy((char*) _content, (const char *)_buf, _curSize+1);
+        _contentSize = _curSize +1;
 
     }
 
@@ -229,9 +225,6 @@
     return 0;
 }
 
-void printBuf(int len, char* buf) {
-}
-
 /**
  * gets the next char from the buffer. If all the data in the buffer is read,
  * read a chunk to the buffer
@@ -240,11 +233,7 @@
 char RecvBuf::_getChar() {
     if (_curPos >= _curSize) {
         if (!_getBytes(_allocSize)) {
-            /* bugscape #55624: Solaris RA exited 
-               with a signal ABRT if we raised exception
-               without handling it */
             return -1; 
-            /* throw RecvBuf::EndOfFile(); */
         }
     }
     
@@ -281,7 +270,7 @@
                 if (ch != '\r' || ch2 != '\n')
                 {
                      PR_LOG(httpRespLog, PR_LOG_DEBUG,
-                          ("did not find chunk trailer at end of chunk 1.  \n"));
+                          ("did not find chunk trailer at end of chunk .  \n"));
                 }
             }
        
@@ -316,7 +305,7 @@
                 if (ch1 != '\r' || ch2 != '\n')
                 {
                     PR_LOG(httpRespLog, PR_LOG_DEBUG,
-                          ("did not find chunk trailer at the end of chunk 2. ch1 %c ch2 %c  \n",ch1,ch2));
+                          ("did not find chunk trailer at the end of chunk . ch1 %c ch2 %c  \n",ch1,ch2));
                 };
 
                 _currentChunkSize = _currentChunkBytesRead = 0;
@@ -681,8 +670,6 @@
 
     char chunk[4096];
 
-    int len = sizeof(chunk);
-
     int i = 0;
 
     PSChunkedResponseCallback cb = _request->getChunkedCallback();
@@ -743,7 +730,6 @@
                 PR_LOG(httpRespLog, PR_LOG_DEBUG,
                        ("PSHttpResponse::_handleChunkedConversation"
                         "  chunk complete normal condition. chunk: %s\n",(char *) chunk));
-                //dump_data((unsigned char *)chunk,i);
                 (*cb)((unsigned char *) chunk,i,uw,HTTP_CHUNK_COMPLETE);
             }
             
@@ -779,7 +765,7 @@
 
         if(cb != NULL)
         {// We need to process the chunked encoded conversation
-            PRBool res = _handleChunkedConversation(buf);
+             _handleChunkedConversation(buf);
 
         }
     } else {
@@ -1062,27 +1048,3 @@
         }
     }
 }
-
-
-void dump_data(unsigned char *aData, int aLen) {
-
-  if(!aData || !aLen)
-      return;
-
-
-  for(int i = 0; i < aLen ; i++)
-  {
-
-
-
-      PR_LOG(httpRespLog, PR_LOG_DEBUG,
-                    ("dumpdata at %d: %c \n", i, aData[i] 
-                     ));
-      
-
-  }
-
-
-
-
-}




More information about the Fedora-directory-commits mailing list