SSL and post confusion

I am writing a program to help show some proof of concept. I write to make 
client able to handle redirect to ssl server where it be required to post a 
username and password.

I am having difficulty integrating two requests and I am not sure what the 
problem is. I believe the SSL and POST is not working here. CAn some one 
please let me know what I am doing wrong. Thanks,

-Ya`na


Basically the proof has 3 step
1. GO to page.
2. Get redirected to page. (redirected to https://login.yahoo.com hence over 
SSL)
3. post to redirected page (me use us.imdb.com/Find.....but this not work)

I do this

int terminate_handler (HTRequest * request, HTResponse * response,
                       void * param, int status)
{
    HTRequest_delete(request);
    HTSSLhttps_terminate();

    HTEventList_stopLoop();  // Prev lines or these lines
    return(0);

}

int main (int argc, char ** argv)
{
    int                 status = 0;
    int                 arg = 0;
    char *              outputfile = NULL;
    char *              getme = NULL;
    HTRequest *         request = NULL;
    HTProfile_newNoCacheClient(APP_NAME, APP_VERSION);

#if 1
    HTSetTraceMessageMask("ota");
#endif

    HTSSL_protMethod_set (HTSSL_V23);

    HTSSL_verifyDepth_set (2);
    HTSSLhttps_init(YES);

    /* Add our own filter to terminate the application */
    HTNet_addAfter(terminate_handler, NULL, NULL, HT_ALL, HT_FILTER_LAST);

    /* Set the timeout for long we are going to wait for a response */
    HTHost_setEventTimeout(10000);

    /* Scan command line for parameters */
    for (arg=1; arg<argc; arg++) {
        if (!strcmp(argv[arg], "-file")) {
            outputfile = (arg+1 < argc && *argv[arg+1] != '-') ?
                argv[++arg] : DEFAULT_OUTPUT_FILE;

        } else {
            getme = argv[arg];
        }
    }

    if (getme && *getme) {
        request = HTRequest_new();

        /* Start the load */
        status = HTLoadToFile(getme, request, outputfile);    //load reply 
into memory

        /* Go into the event loop... */
        HTEventList_loop(request);

        HTPrint("\n BACK IN MAIN \n");
        HTSSLhttps_init(NO);
        request = HTRequest_new();
        char * uri = "http://us.imdb.com/Find";
        char * arg1 = "for=Hulk";
        HTAssocList * formfields = NULL;
        HTAnchor * anchor = NULL;
        anchor = HTAnchor_findAddress(uri);
        HTParseFormInput(formfields, arg1);
        HTPrint("\n\n\n%s", uri);

        HTChunk * result = HTPostFormAnchorToChunk(formfields, anchor, 
request);

        HTPrint("\n\n\n%s", arg1);
        HTPrint("\n\n\n%s", HTChunk_data(result));
        HTChunk_delete(result);
        HTAssocList_delete(formfields);
        HTEventList_loop(request);

        HTProfile_delete();





Below is the trace

[yanderson@localhost SSL]# ./prf_cpt https://login.yahoo.com
Transport... Adding `secure_tcp'
Protocol.... Adding `https'
Net Before.. Add 0x804ea1c with order 49150 tmplate `https://*' context 
(nil)
Net Before.. Add 0x805f0a4 with order 49150 tmplate `https://*' context 
(nil)
Net After... Add 0x804ea80 with order 32767 tmplate `https://*' code -401 
context (nil)
Net After... Add 0x804ea80 with order 32767 tmplate `https://*' code -418 
context (nil)
Net After... Add 0x805f13c with order 32767 tmplate `https://*' code 1 
context (nil)
Net After... Add 0x804e78c with order 32767 tmplate `https://*' code 301 
context (nil)
Net After... Add 0x804e78c with order 32767 tmplate `https://*' code 302 
context (nil)
Net After... Add 0x804e78c with order 32767 tmplate `https://*' code 303 
context (nil)
Net After... Add 0x804e78c with order 32767 tmplate `https://*' code 307 
context (nil)
Net After... Add 0x804e930 with order 32767 tmplate `https://*' code 305 
context (nil)
Net After... Add 0x804a08c with order 65535 tmplate `<null>' code 1 context 
(nil)
Host........ Setting event timeout to 10000 ms
Request..... Created 0x8133330
Find Parent. 0x8133f80 with hash 269 and address `https://login.yahoo.com' 
created
Net Before.. calling 0x804ea1c (request 0x8133330, context (nil))
URL Tree.... did NOT find `w3c-AA'
Net Before.. calling 0x804e4f4 (request 0x8133330, context (nil))
Net Before.. calling 0x804e428 (request 0x8133330, context (nil))
Net Before.. calling 0x805f0a4 (request 0x8133330, context (nil))
URL Tree.... did NOT find `w3c-pep'
Net Object.. 0x8134248 created with hash 0
Net Object.. starting request 0x8133330 (retry=1) with net object 0x8134248
Event....... Created event 0x8134e28 with context 0x8134d60, priority 20, 
and timeout 10000
Event....... Created event 0x8134e40 with context 0x8134d60, priority 20, 
and timeout 10000
Event....... Created event 0x8134e58 with context 0x8134d60, priority 20, 
and timeout 10000
Host info... added `login.yahoo.com' with host 0x8134d60 to list 0x8134c28
Host connect Grabbing lock on Host 0x8134d60 with 0x8134248
Host info... Added Net 0x8134248 (request 0x8133330) to pipe on Host 
0x8134d60, 1 requests made,
1 requests in pipe, 0 pending
HTHost...... No ActivateRequest callback handler registered
Looking up login.yahoo.com
Looking up login.yahoo.com
ParseInet... as port 443 on 216.109.127.60 with 1 homes
Net Manager. Increasing active sockets to 1, 0 persistent sockets
Contacting login.yahoo.com
Host connect Unlocking Host 0x8134d60
StreamStack. Constructing stream stack for text/x-http to */*
Host Event.. FLUSH passed to `https://login.yahoo.com'
Reading...
Response.... Created 0x8154c60
HTAnchor.... Clear all header information
StreamStack. Constructing stream stack for message/rfc822 to */*
Error....... Add   2    Severity: 8     Parameter: `OK' Where: 
`HTTPNextState'
Host........ passing 17 bytes as consumed to 0x8136488
StreamStack. Constructing stream stack for text/html to */*
StreamStack. Source output
Host........ passing 376 bytes as consumed to 0x8136488
Host........ passing 7813 bytes as consumed to 0x8136488
Event....... Couldn't find socket 4. Can't unregister type HTEvent_READ
Event....... Couldn't find socket 4. Can't unregister type HTEvent_WRITE
Net Object.. Delete 0x8134248 and call AFTER filters
Host info... Remove 0x8134248 from pipe
Host Object. closing socket 4
Event....... Couldn't find socket 4. Can't unregister type HTEvent_READ
Event....... Couldn't find socket 4. Can't unregister type HTEvent_WRITE
Net Manager. Decreasing active sockets to 0, 0 persistent sockets
Host info... removed host 0x8134d60 as persistent
Net Object.. Check for pending Net objects
Net Object.. Freeing object 0x8134248
Net After... calling 0x805f13c (request 0x8133330, response 0x8154c60, 
status 200, context (nil))Net After... calling 0x804e60c (request 0x8133330, 
response 0x8154c60, status 200, context (nil))Net After... calling 0x804a08c 
(request 0x8133330, response 0x8154c60, status 200, context 
(nil))Request..... Delete 0x8133330
Request..... Deleting dangling output stream
Response.... Delete 0x8154c60

BACK IN MAIN
Transport... Adding `secure_tcp'
Protocol.... Adding `https'
Net Before.. Add 0x804ea1c with order 49150 tmplate `https://*' context 
(nil)
Net Before.. Add 0x805f0a4 with order 49150 tmplate `https://*' context 
(nil)
Net After... Add 0x804ea80 with order 32767 tmplate `https://*' code -401 
context (nil)
Net After... Add 0x804ea80 with order 32767 tmplate `https://*' code -418 
context (nil)
Net After... Add 0x805f13c with order 32767 tmplate `https://*' code 1 
context (nil)
Net After... Add 0x804e78c with order 32767 tmplate `https://*' code 301 
context (nil)
Net After... Add 0x804e78c with order 32767 tmplate `https://*' code 302 
context (nil)
Net After... Add 0x804e78c with order 32767 tmplate `https://*' code 303 
context (nil)
Net After... Add 0x804e78c with order 32767 tmplate `https://*' code 307 
context (nil)
Net After... Add 0x804e930 with order 32767 tmplate `https://*' code 305 
context (nil)
Request..... Created 0x8153e40
Find Parent. 0x8153778 with hash 474 and address `http://us.imdb.com/Find' 
created



http://us.imdb.com/Find


EventOrder.. Clearing all ordered events
Event Loop.. calling select: maxfds is 0
............ READ :
............ WRITE:
............ OOB  :



=============== the program hangs here..

if anyone can make sense of this it would be great. If you can tell me what 
to do I can make change and better it

_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail

Received on Tuesday, 1 July 2003 02:12:03 UTC