477 const TPtrC8 pVal( attributevalue.Str().DesC() ); |
481 const TPtrC8 pVal( attributevalue.Str().DesC() ); |
478 CLOG( ( ECookie, 0, _L8( "CCookie::CopyFromL - attribute EValue value: %S" ), &pVal ) ); |
482 CLOG( ( ECookie, 0, _L8( "CCookie::CopyFromL - attribute EValue value: %S" ), &pVal ) ); |
479 } |
483 } |
480 else |
484 else |
481 { |
485 { |
482 SetAttribute( EValue, attributevalue, defaulted ); |
486 SetAttribute( EValue, attributevalue, defaulted ); |
|
487 const TPtrC8 pVal( attributevalue.Str().DesC() ); |
|
488 CLOG( ( ECookie, 0, _L8( "CCookie::CopyFromL - attribute EValue Value : %S" ), &pVal ) ); |
483 } |
489 } |
484 } |
490 } |
485 if ( aCopyFrom.Attribute( EComment, attributevalue, defaulted ) != KErrNotFound ) |
491 if ( aCopyFrom.Attribute( EVersion, attributevalue, defaulted ) != KErrNotFound ) |
486 { |
492 { |
487 SetAttribute( EComment, attributevalue, defaulted ); |
493 SetAttribute( EVersion, attributevalue, defaulted ); |
488 } |
494 SetFromNetscape( EFalse ); |
489 |
495 } |
490 if ( aCopyFrom.Attribute( ECommentURI, attributevalue, defaulted ) != KErrNotFound ) |
496 else |
491 { |
497 { |
492 SetAttribute( ECommentURI, attributevalue, defaulted ); |
498 SetFromNetscape( ETrue ); |
493 } |
499 } |
494 |
500 |
495 if ( aCopyFrom.Attribute( EDiscard, attributevalue, defaulted ) != KErrNotFound ) |
501 if ( aCopyFrom.Attribute( EPath, attributevalue, defaulted ) != KErrNotFound ) |
496 { |
502 { |
497 SetAttribute( EDiscard, attributevalue, defaulted ); |
503 if ( attributevalue.Type() != THTTPHdrVal::KStrFVal ) |
498 } |
504 { |
499 |
505 SetAttribute( EPath, attributevalue, defaulted ); |
500 if ( aCopyFrom.Attribute( EDomain, attributevalue, defaulted ) != KErrNotFound ) |
506 } |
501 { |
507 } |
502 SetAttribute( EDomain, attributevalue, defaulted ); |
508 else |
503 } |
509 { |
504 |
510 // defaulting |
505 if ( aCopyFrom.Attribute( EMaxAge, attributevalue, defaulted ) != KErrNotFound ) |
511 RStringF defPath = iStringPool.OpenFStringL( aPath ); |
506 { |
512 THTTPHdrVal defPathVal( defPath ); |
507 SetAttribute( EMaxAge, attributevalue, defaulted ); |
513 SetAttribute( EPath, defPathVal, ETrue );// ignore the result |
508 } |
514 defPath.Close(); |
509 |
515 } |
510 if ( aCopyFrom.Attribute( EPath, attributevalue, defaulted ) != KErrNotFound ) |
516 if ( aCopyFrom.Attribute( EDomain, attributevalue, defaulted ) != KErrNotFound ) |
511 { |
517 { |
512 SetAttribute( EPath, attributevalue, defaulted ); |
518 if ( attributevalue.Type() != THTTPHdrVal::KStrFVal ) |
513 } |
519 { |
514 |
520 SetAttribute( EDomain, attributevalue, defaulted ); |
515 if ( aCopyFrom.Attribute( EPort, attributevalue, defaulted ) != KErrNotFound ) |
521 } |
516 { |
522 } |
517 SetAttribute( EPort, attributevalue, defaulted ); |
523 else |
518 } |
524 { |
519 |
525 // Default handling |
520 if ( aCopyFrom.Attribute( ESecure, attributevalue, defaulted ) != KErrNotFound ) |
526 // in this case the default is the effective request host |
521 { |
527 RStringF defDomain = iStringPool.OpenFStringL( aDomain ); |
522 SetAttribute( ESecure, attributevalue, defaulted ); |
528 THTTPHdrVal defdomVal( defDomain ); |
523 } |
529 SetAttribute( EDomain, defdomVal, ETrue );// ignore the result |
524 |
530 defDomain.Close(); |
525 if ( aCopyFrom.Attribute( EVersion, attributevalue, defaulted ) != KErrNotFound ) |
531 } |
526 { |
532 |
527 SetAttribute( EVersion, attributevalue, defaulted ); |
533 |
528 } |
534 if ( aCopyFrom.Attribute( ESecure, attributevalue, defaulted ) != KErrNotFound ) |
529 |
535 { |
530 if ( aCopyFrom.Attribute( EExpires, attributevalue, defaulted ) != KErrNotFound ) |
536 SetAttribute( ESecure, attributevalue, defaulted ); |
531 { |
537 } |
532 SetAttribute( EExpires, attributevalue, defaulted ); |
538 if (iNetscape) |
533 } |
539 { |
534 |
540 if ( aCopyFrom.Attribute( EExpires, attributevalue, defaulted ) != KErrNotFound ) |
535 TTime nowTime; |
541 { |
536 nowTime.UniversalTime(); |
542 SetAttribute( EExpires, attributevalue, defaulted ); |
537 TDateTime attrTime = nowTime.DateTime(); |
543 } |
538 THTTPHdrVal attributeVal( attrTime ); |
544 else if ( aCopyFrom.Attribute( EComment, attributevalue, defaulted ) != KErrNotFound || |
539 SetAttribute( EDate, attributeVal, defaulted ); |
545 aCopyFrom.Attribute( EMaxAge, attributevalue, defaulted ) != KErrNotFound ) |
|
546 { |
|
547 iNetscape = EFalse; |
|
548 } |
|
549 } |
|
550 if ( aCopyFrom.Attribute( EDate, attributevalue, defaulted ) != KErrNotFound ) |
|
551 { |
|
552 TDateTime attrTime = attributevalue.DateTime(); |
|
553 THTTPHdrVal attributeVal( attrTime ); |
|
554 SetAttribute( CCookie::EDate, attributeVal, defaulted ); |
|
555 } |
|
556 else |
|
557 { |
|
558 TTime nowTime; |
|
559 nowTime.UniversalTime(); |
|
560 TDateTime attrTime = nowTime.DateTime(); |
|
561 THTTPHdrVal attributeVal( attrTime ); |
|
562 SetAttribute( EDate, attributeVal, defaulted ); |
|
563 } |
|
564 if (iNetscape == EFalse) |
|
565 { |
|
566 if ( aCopyFrom.Attribute( EComment, attributevalue, defaulted ) != KErrNotFound ) |
|
567 { |
|
568 SetAttribute( EComment, attributevalue ); |
|
569 } |
|
570 else |
|
571 { |
|
572 |
|
573 } |
|
574 if ( aCopyFrom.Attribute( EMaxAge, attributevalue, defaulted ) != KErrNotFound) |
|
575 { |
|
576 SetAttribute( EMaxAge, attributevalue ); |
|
577 } |
|
578 else |
|
579 { |
|
580 if(iSetCookie2) |
|
581 { |
|
582 defaultDiscard = ETrue; |
|
583 } |
|
584 } |
|
585 if(iSetCookie2) |
|
586 { |
|
587 if ( aCopyFrom.Attribute( ECommentURI, attributevalue, defaulted ) != KErrNotFound ) |
|
588 { |
|
589 SetAttribute( ECommentURI, attributevalue, defaulted ); |
|
590 } |
|
591 else |
|
592 { |
|
593 |
|
594 } |
|
595 if ( aCopyFrom.Attribute( EDiscard, attributevalue, defaulted ) != KErrNotFound ) |
|
596 { |
|
597 SetAttribute( EDiscard, attributevalue, defaulted ); |
|
598 } |
|
599 else |
|
600 { |
|
601 if (defaultDiscard) |
|
602 { |
|
603 RStringF emptyStr = iStringPool.OpenFStringL( KNullDesC8() ); |
|
604 THTTPHdrVal emptyVal( emptyStr ); |
|
605 SetAttribute( EDiscard, emptyVal, ETrue ); |
|
606 emptyStr.Close(); |
|
607 } |
|
608 if (aCopyFrom.Attribute( EPort, attributevalue, defaulted ) != KErrNotFound) |
|
609 { |
|
610 SetAttribute( EPort, attributevalue, ETrue ); // ignore the result of this method |
|
611 } |
|
612 else |
|
613 { |
|
614 RStringF requestPort; |
|
615 if(!aPort.Compare(KNullDesC8())) |
|
616 { |
|
617 requestPort = iStringPool.OpenFStringL( aPort ); |
|
618 } |
|
619 else |
|
620 { |
|
621 requestPort = iStringPool.OpenFStringL( KCookieDefaultRequestPort() ); |
|
622 } |
|
623 THTTPHdrVal portVal( requestPort ); |
|
624 SetAttribute( EPort, portVal, ETrue ); |
|
625 requestPort.Close(); |
|
626 } |
|
627 } |
|
628 |
|
629 } |
|
630 |
|
631 } |
|
632 |
540 |
633 |
541 //SetCookie2( aCopyFrom.FromCookie2() ); |
634 //SetCookie2( aCopyFrom.FromCookie2() ); |
542 // Other properties |
635 // Other properties |
543 iSetCookie2 = aCopyFrom.iSetCookie2; |
636 |
544 iNetscape = aCopyFrom.iNetscape; |
|
545 iSize = aCopyFrom.iSize; |
637 iSize = aCopyFrom.iSize; |
546 iReceivedTime = aCopyFrom.iReceivedTime; |
638 iReceivedTime = aCopyFrom.iReceivedTime; |
547 CLOG( ( ECookie, 0, _L( "<- CCookie::CopyFromL ") ) ); |
639 CLOG( ( ECookie, 0, _L( "<- CCookie::CopyFromL ") ) ); |
548 } |
640 } |
549 |
641 |