Full Code of douban/douban-objc-client for AI

master 139f22e6406f cached
490 files
13.7 MB
515.4k tokens
102 symbols
1 requests
Download .txt
Showing preview only (2,013K chars total). Download the full file or copy to clipboard to get everything.
Repository: douban/douban-objc-client
Branch: master
Commit: 139f22e6406f
Files: 490
Total size: 13.7 MB

Directory structure:
gitextract_h1qthytv/

├── .gitignore
├── DoubanAPIEngine/
│   ├── DoubanAPIEngine/
│   │   ├── DoubanAPIEngine-Prefix.pch
│   │   ├── OtherSources/
│   │   │   ├── ASIHTTPRequest/
│   │   │   │   ├── ASIAuthenticationDialog.h
│   │   │   │   ├── ASIAuthenticationDialog.m
│   │   │   │   ├── ASICacheDelegate.h
│   │   │   │   ├── ASIDataCompressor.h
│   │   │   │   ├── ASIDataCompressor.m
│   │   │   │   ├── ASIDataDecompressor.h
│   │   │   │   ├── ASIDataDecompressor.m
│   │   │   │   ├── ASIDownloadCache.h
│   │   │   │   ├── ASIDownloadCache.m
│   │   │   │   ├── ASIFormDataRequest.h
│   │   │   │   ├── ASIFormDataRequest.m
│   │   │   │   ├── ASIHTTPRequest.h
│   │   │   │   ├── ASIHTTPRequest.m
│   │   │   │   ├── ASIHTTPRequestConfig.h
│   │   │   │   ├── ASIHTTPRequestDelegate.h
│   │   │   │   ├── ASIInputStream.h
│   │   │   │   ├── ASIInputStream.m
│   │   │   │   ├── ASINetworkQueue.h
│   │   │   │   ├── ASINetworkQueue.m
│   │   │   │   ├── ASIProgressDelegate.h
│   │   │   │   ├── ASIWebPageRequest/
│   │   │   │   │   ├── ASIWebPageRequest.h
│   │   │   │   │   └── ASIWebPageRequest.m
│   │   │   │   ├── CloudFiles/
│   │   │   │   │   ├── ASICloudFilesCDNRequest.h
│   │   │   │   │   ├── ASICloudFilesCDNRequest.m
│   │   │   │   │   ├── ASICloudFilesContainer.h
│   │   │   │   │   ├── ASICloudFilesContainer.m
│   │   │   │   │   ├── ASICloudFilesContainerRequest.h
│   │   │   │   │   ├── ASICloudFilesContainerRequest.m
│   │   │   │   │   ├── ASICloudFilesContainerXMLParserDelegate.h
│   │   │   │   │   ├── ASICloudFilesContainerXMLParserDelegate.m
│   │   │   │   │   ├── ASICloudFilesObject.h
│   │   │   │   │   ├── ASICloudFilesObject.m
│   │   │   │   │   ├── ASICloudFilesObjectRequest.h
│   │   │   │   │   ├── ASICloudFilesObjectRequest.m
│   │   │   │   │   ├── ASICloudFilesRequest.h
│   │   │   │   │   └── ASICloudFilesRequest.m
│   │   │   │   └── S3/
│   │   │   │       ├── ASINSXMLParserCompat.h
│   │   │   │       ├── ASIS3Bucket.h
│   │   │   │       ├── ASIS3Bucket.m
│   │   │   │       ├── ASIS3BucketObject.h
│   │   │   │       ├── ASIS3BucketObject.m
│   │   │   │       ├── ASIS3BucketRequest.h
│   │   │   │       ├── ASIS3BucketRequest.m
│   │   │   │       ├── ASIS3ObjectRequest.h
│   │   │   │       ├── ASIS3ObjectRequest.m
│   │   │   │       ├── ASIS3Request.h
│   │   │   │       ├── ASIS3Request.m
│   │   │   │       ├── ASIS3ServiceRequest.h
│   │   │   │       └── ASIS3ServiceRequest.m
│   │   │   ├── Base64/
│   │   │   │   ├── NSData+Base64.h
│   │   │   │   └── NSData+Base64.m
│   │   │   ├── JSON/
│   │   │   │   ├── JSON.h
│   │   │   │   ├── NSObject+SBJson.h
│   │   │   │   ├── NSObject+SBJson.m
│   │   │   │   ├── SBJson.h
│   │   │   │   ├── SBJsonParser.h
│   │   │   │   ├── SBJsonParser.m
│   │   │   │   ├── SBJsonStreamParser.h
│   │   │   │   ├── SBJsonStreamParser.m
│   │   │   │   ├── SBJsonStreamParserAccumulator.h
│   │   │   │   ├── SBJsonStreamParserAccumulator.m
│   │   │   │   ├── SBJsonStreamParserAdapter.h
│   │   │   │   ├── SBJsonStreamParserAdapter.m
│   │   │   │   ├── SBJsonStreamParserState.h
│   │   │   │   ├── SBJsonStreamParserState.m
│   │   │   │   ├── SBJsonStreamWriter.h
│   │   │   │   ├── SBJsonStreamWriter.m
│   │   │   │   ├── SBJsonStreamWriterAccumulator.h
│   │   │   │   ├── SBJsonStreamWriterAccumulator.m
│   │   │   │   ├── SBJsonStreamWriterState.h
│   │   │   │   ├── SBJsonStreamWriterState.m
│   │   │   │   ├── SBJsonTokeniser.h
│   │   │   │   ├── SBJsonTokeniser.m
│   │   │   │   ├── SBJsonUTF8Stream.h
│   │   │   │   ├── SBJsonUTF8Stream.m
│   │   │   │   ├── SBJsonWriter.h
│   │   │   │   └── SBJsonWriter.m
│   │   │   └── Reachability/
│   │   │       ├── Reachability.h
│   │   │       └── Reachability.m
│   │   └── Sources/
│   │       ├── DOUAPIConfig.h
│   │       ├── DOUAPIConfig.m
│   │       ├── DOUAPIEngine.h
│   │       ├── Model/
│   │       │   ├── GData/
│   │       │   │   ├── BaseClasses/
│   │       │   │   │   ├── GDataEntryBase.h
│   │       │   │   │   ├── GDataEntryBase.m
│   │       │   │   │   ├── GDataFeedBase.h
│   │       │   │   │   ├── GDataFeedBase.m
│   │       │   │   │   ├── GDataObject.h
│   │       │   │   │   └── GDataObject.m
│   │       │   │   ├── Elements/
│   │       │   │   │   ├── GDataAtomPubControl.h
│   │       │   │   │   ├── GDataAtomPubControl.m
│   │       │   │   │   ├── GDataBaseElements.h
│   │       │   │   │   ├── GDataBaseElements.m
│   │       │   │   │   ├── GDataBatchID.h
│   │       │   │   │   ├── GDataBatchID.m
│   │       │   │   │   ├── GDataBatchInterrupted.h
│   │       │   │   │   ├── GDataBatchInterrupted.m
│   │       │   │   │   ├── GDataBatchOperation.h
│   │       │   │   │   ├── GDataBatchOperation.m
│   │       │   │   │   ├── GDataBatchStatus.h
│   │       │   │   │   ├── GDataBatchStatus.m
│   │       │   │   │   ├── GDataCategory.h
│   │       │   │   │   ├── GDataCategory.m
│   │       │   │   │   ├── GDataComment.h
│   │       │   │   │   ├── GDataComment.m
│   │       │   │   │   ├── GDataCustomProperty.h
│   │       │   │   │   ├── GDataCustomProperty.m
│   │       │   │   │   ├── GDataDateTime.h
│   │       │   │   │   ├── GDataDateTime.m
│   │       │   │   │   ├── GDataDeleted.h
│   │       │   │   │   ├── GDataDeleted.m
│   │       │   │   │   ├── GDataElements.h
│   │       │   │   │   ├── GDataEmail.h
│   │       │   │   │   ├── GDataEmail.m
│   │       │   │   │   ├── GDataEntryContent.h
│   │       │   │   │   ├── GDataEntryContent.m
│   │       │   │   │   ├── GDataEntryLink.h
│   │       │   │   │   ├── GDataEntryLink.m
│   │       │   │   │   ├── GDataExtendedProperty.h
│   │       │   │   │   ├── GDataExtendedProperty.m
│   │       │   │   │   ├── GDataFeedLink.h
│   │       │   │   │   ├── GDataFeedLink.m
│   │       │   │   │   ├── GDataGenerator.h
│   │       │   │   │   ├── GDataGenerator.m
│   │       │   │   │   ├── GDataGeoPt.h
│   │       │   │   │   ├── GDataGeoPt.m
│   │       │   │   │   ├── GDataIM.h
│   │       │   │   │   ├── GDataIM.m
│   │       │   │   │   ├── GDataLink.h
│   │       │   │   │   ├── GDataLink.m
│   │       │   │   │   ├── GDataMoney.h
│   │       │   │   │   ├── GDataMoney.m
│   │       │   │   │   ├── GDataName.h
│   │       │   │   │   ├── GDataName.m
│   │       │   │   │   ├── GDataOrganization.h
│   │       │   │   │   ├── GDataOrganization.m
│   │       │   │   │   ├── GDataOrganizationName.h
│   │       │   │   │   ├── GDataOrganizationName.m
│   │       │   │   │   ├── GDataPerson.h
│   │       │   │   │   ├── GDataPerson.m
│   │       │   │   │   ├── GDataPhoneNumber.h
│   │       │   │   │   ├── GDataPhoneNumber.m
│   │       │   │   │   ├── GDataPostalAddress.h
│   │       │   │   │   ├── GDataPostalAddress.m
│   │       │   │   │   ├── GDataRating.h
│   │       │   │   │   ├── GDataRating.m
│   │       │   │   │   ├── GDataStructuredPostalAddress.h
│   │       │   │   │   ├── GDataStructuredPostalAddress.m
│   │       │   │   │   ├── GDataTextConstruct.h
│   │       │   │   │   ├── GDataTextConstruct.m
│   │       │   │   │   ├── GDataValueConstruct.h
│   │       │   │   │   ├── GDataValueConstruct.m
│   │       │   │   │   ├── GDataWhen.h
│   │       │   │   │   ├── GDataWhen.m
│   │       │   │   │   ├── GDataWhere.h
│   │       │   │   │   ├── GDataWhere.m
│   │       │   │   │   ├── GDataWho.h
│   │       │   │   │   └── GDataWho.m
│   │       │   │   ├── GDataDefines.h
│   │       │   │   ├── GDataUtilities.h
│   │       │   │   ├── GDataUtilities.m
│   │       │   │   ├── HTTPFetcher/
│   │       │   │   │   ├── GTMGatherInputStream.h
│   │       │   │   │   ├── GTMGatherInputStream.m
│   │       │   │   │   ├── GTMMIMEDocument.h
│   │       │   │   │   └── GTMMIMEDocument.m
│   │       │   │   └── XMLSupport/
│   │       │   │       ├── GDataXMLNode.h
│   │       │   │       └── GDataXMLNode.m
│   │       │   └── GDataDoubanWrapper/
│   │       │       ├── Clients/
│   │       │       │   ├── Comment/
│   │       │       │   │   ├── DoubanEntryComment.h
│   │       │       │   │   ├── DoubanEntryComment.m
│   │       │       │   │   ├── DoubanFeedComment.h
│   │       │       │   │   └── DoubanFeedComment.m
│   │       │       │   ├── Event/
│   │       │       │   │   ├── DoubanEntryCity.h
│   │       │       │   │   ├── DoubanEntryCity.m
│   │       │       │   │   ├── DoubanEntryEvent.h
│   │       │       │   │   ├── DoubanEntryEvent.m
│   │       │       │   │   ├── DoubanEntryEventCategory.h
│   │       │       │   │   ├── DoubanEntryEventCategory.m
│   │       │       │   │   ├── DoubanFeedCity.h
│   │       │       │   │   ├── DoubanFeedCity.m
│   │       │       │   │   ├── DoubanFeedEvent.h
│   │       │       │   │   ├── DoubanFeedEvent.m
│   │       │       │   │   ├── DoubanFeedEventCategory.h
│   │       │       │   │   └── DoubanFeedEventCategory.m
│   │       │       │   ├── GDataAtomAuthor+Extension.h
│   │       │       │   ├── GDataAtomAuthor+Extension.m
│   │       │       │   ├── GDataEntryBase+Extension.h
│   │       │       │   ├── GDataEntryBase+Extension.m
│   │       │       │   ├── Miniblog/
│   │       │       │   │   ├── DoubanEntryMiniblog.h
│   │       │       │   │   ├── DoubanEntryMiniblog.m
│   │       │       │   │   ├── DoubanFeedMiniblog.h
│   │       │       │   │   └── DoubanFeedMiniblog.m
│   │       │       │   ├── People/
│   │       │       │   │   ├── DoubanEntryPeople.h
│   │       │       │   │   ├── DoubanEntryPeople.m
│   │       │       │   │   ├── DoubanFeedPeople.h
│   │       │       │   │   └── DoubanFeedPeople.m
│   │       │       │   ├── Photo/
│   │       │       │   │   ├── DoubanEntryAlbum.h
│   │       │       │   │   ├── DoubanEntryAlbum.m
│   │       │       │   │   ├── DoubanEntryPhoto.h
│   │       │       │   │   ├── DoubanEntryPhoto.m
│   │       │       │   │   ├── DoubanFeedAlbum.h
│   │       │       │   │   ├── DoubanFeedAlbum.m
│   │       │       │   │   ├── DoubanFeedPhoto.h
│   │       │       │   │   └── DoubanFeedPhoto.m
│   │       │       │   ├── Recommendation/
│   │       │       │   │   ├── DoubanEntryRecommendation.h
│   │       │       │   │   ├── DoubanEntryRecommendation.m
│   │       │       │   │   ├── DoubanFeedRecommendation.h
│   │       │       │   │   └── DoubanFeedRecommendation.m
│   │       │       │   ├── Review/
│   │       │       │   │   ├── DoubanEntryReview.h
│   │       │       │   │   ├── DoubanEntryReview.m
│   │       │       │   │   ├── DoubanFeedReview.h
│   │       │       │   │   └── DoubanFeedReview.m
│   │       │       │   └── Subject/
│   │       │       │       ├── DoubanEntrySubject.h
│   │       │       │       ├── DoubanEntrySubject.m
│   │       │       │       ├── DoubanFeedSubject.h
│   │       │       │       └── DoubanFeedSubject.m
│   │       │       ├── DoubanDefines.h
│   │       │       ├── DoubanDefines.m
│   │       │       └── Elements/
│   │       │           ├── DoubanAttribute.h
│   │       │           ├── DoubanAttribute.m
│   │       │           ├── DoubanLocation.h
│   │       │           ├── DoubanLocation.m
│   │       │           ├── DoubanSignature.h
│   │       │           ├── DoubanSignature.m
│   │       │           ├── DoubanTag.h
│   │       │           ├── DoubanTag.m
│   │       │           ├── DoubanUID.h
│   │       │           ├── DoubanUID.m
│   │       │           ├── GeorssPoint.h
│   │       │           └── GeorssPoint.m
│   │       ├── Model2/
│   │       │   ├── Book/
│   │       │   │   ├── DOUAnnotation.h
│   │       │   │   ├── DOUAnnotation.m
│   │       │   │   ├── DOUAnnotationArray.h
│   │       │   │   ├── DOUAnnotationArray.m
│   │       │   │   ├── DOUBook.h
│   │       │   │   ├── DOUBook.m
│   │       │   │   ├── DOUBookArray.h
│   │       │   │   └── DOUBookArray.m
│   │       │   ├── Collection/
│   │       │   │   ├── DOUCollection.h
│   │       │   │   ├── DOUCollection.m
│   │       │   │   ├── DOUCollectionArray.h
│   │       │   │   └── DOUCollectionArray.m
│   │       │   ├── Community/
│   │       │   │   ├── DOUComment.h
│   │       │   │   ├── DOUComment.m
│   │       │   │   ├── DOUCommentArray.h
│   │       │   │   ├── DOUCommentArray.m
│   │       │   │   ├── DOUNote.h
│   │       │   │   ├── DOUNote.m
│   │       │   │   ├── DOUNoteArray.h
│   │       │   │   ├── DOUNoteArray.m
│   │       │   │   ├── DOUNotification.h
│   │       │   │   ├── DOUNotification.m
│   │       │   │   ├── DOUNotificationArray.h
│   │       │   │   ├── DOUNotificationArray.m
│   │       │   │   ├── DOUOnline.h
│   │       │   │   ├── DOUOnline.m
│   │       │   │   ├── DOUOnlineArray.h
│   │       │   │   ├── DOUOnlineArray.m
│   │       │   │   ├── DOUUser.h
│   │       │   │   └── DOUUser.m
│   │       │   ├── DOUObject+Utils.h
│   │       │   ├── DOUObject+Utils.m
│   │       │   ├── DOUObject.h
│   │       │   ├── DOUObject.m
│   │       │   ├── DOUObjectArray.h
│   │       │   ├── DOUObjectArray.m
│   │       │   ├── Event/
│   │       │   │   ├── DOUEvent.h
│   │       │   │   ├── DOUEvent.m
│   │       │   │   ├── DOUEventArray.h
│   │       │   │   ├── DOUEventArray.m
│   │       │   │   ├── DOULoc.h
│   │       │   │   ├── DOULoc.m
│   │       │   │   ├── DOULocArray.h
│   │       │   │   └── DOULocArray.m
│   │       │   ├── Movie/
│   │       │   │   ├── DOUMovie.h
│   │       │   │   ├── DOUMovie.m
│   │       │   │   ├── DOUMovieArray.h
│   │       │   │   └── DOUMovieArray.m
│   │       │   ├── Music/
│   │       │   │   ├── DOUMusic.h
│   │       │   │   ├── DOUMusic.m
│   │       │   │   ├── DOUMusicArray.h
│   │       │   │   └── DOUMusicArray.m
│   │       │   ├── Photo/
│   │       │   │   ├── DOUAlbum.h
│   │       │   │   ├── DOUAlbum.m
│   │       │   │   ├── DOUAlbumArray.h
│   │       │   │   ├── DOUAlbumArray.m
│   │       │   │   ├── DOUPhoto.h
│   │       │   │   ├── DOUPhoto.m
│   │       │   │   ├── DOUPhotoArray.h
│   │       │   │   └── DOUPhotoArray.m
│   │       │   └── Tag/
│   │       │       ├── DOUTag.h
│   │       │       ├── DOUTag.m
│   │       │       ├── DOUTagArray.h
│   │       │       ├── DOUTagArray.m
│   │       │       ├── DOUUserTag.h
│   │       │       ├── DOUUserTag.m
│   │       │       ├── DOUUserTagArray.h
│   │       │       └── DOUUserTagArray.m
│   │       ├── Network/
│   │       │   ├── DOUHttpRequest.h
│   │       │   ├── DOUHttpRequest.m
│   │       │   ├── DOUQuery.h
│   │       │   ├── DOUQuery.m
│   │       │   ├── DOUService.h
│   │       │   └── DOUService.m
│   │       └── OAuth2/
│   │           ├── DOUOAuth2.h
│   │           ├── DOUOAuthService.h
│   │           ├── DOUOAuthService.m
│   │           ├── DOUOAuthStore.h
│   │           └── DOUOAuthStore.m
│   ├── DoubanAPIEngine.xcodeproj/
│   │   └── project.pbxproj
│   └── DoubanAPIEngineTests/
│       ├── DOUOAuthServiceTests.m
│       ├── DoubanAPIEngineTests-Info.plist
│       ├── DoubanAPIEngineTests.m
│       ├── Model/
│       │   ├── DoubanCityTests.m
│       │   ├── DoubanCommentTests.m
│       │   ├── DoubanEventCategoryTests.m
│       │   ├── DoubanEventTests.m
│       │   ├── DoubanMiniblogTests.m
│       │   ├── DoubanPeopleTests.m
│       │   ├── DoubanPhotoTests.m
│       │   └── DoubanSubjectTests.m
│       ├── Model2/
│       │   ├── DOUBookTests.m
│       │   ├── DOUCommentTests.m
│       │   ├── DOUMovieTests.m
│       │   ├── DOUMusicTests.m
│       │   ├── DOUNoteTests.m
│       │   ├── DOUOnlineTests.m
│       │   └── DOUPhotoTests.m
│       ├── Resources/
│       │   ├── Model/
│       │   │   ├── DoubanEntryCity.xml
│       │   │   ├── DoubanEntryEvent.xml
│       │   │   ├── DoubanEntryMiniblog.xml
│       │   │   ├── DoubanEntryPeople.xml
│       │   │   ├── DoubanEntryPhoto.xml
│       │   │   ├── DoubanEntryRecommendation.xml
│       │   │   ├── DoubanEntrySubject.xml
│       │   │   ├── DoubanFeedCity.xml
│       │   │   ├── DoubanFeedComment.xml
│       │   │   ├── DoubanFeedEvent.xml
│       │   │   ├── DoubanFeedEventCategory.xml
│       │   │   ├── DoubanFeedMiniblog.xml
│       │   │   ├── DoubanFeedPeople.xml
│       │   │   ├── DoubanFeedPhoto.xml
│       │   │   ├── DoubanFeedRecommendation.xml
│       │   │   └── DoubanFeedSubject.xml
│       │   └── Model2/
│       │       ├── Album.json
│       │       ├── BookArray.json
│       │       ├── CommentArray.json
│       │       ├── Event.json
│       │       ├── MovieArray.json
│       │       ├── MusicArray.json
│       │       ├── Note.json
│       │       ├── Online.json
│       │       ├── OnlineArray.json
│       │       ├── Photo.json
│       │       └── PhotoArray.json
│       ├── Testing/
│       │   ├── DOUTestResponseLoader.h
│       │   └── DOUTestResponseLoader.m
│       └── en.lproj/
│           └── InfoPlist.strings
├── DoubanAPIEngineDemo/
│   ├── DoubanAPIEngineDemo/
│   │   ├── AppDelegate.h
│   │   ├── AppDelegate.m
│   │   ├── DoubanAPIEngineDemo-Info.plist
│   │   ├── DoubanAPIEngineDemo-Prefix.pch
│   │   ├── DoubanQueryEvent.h
│   │   ├── DoubanQueryEvent.m
│   │   ├── GetEventController.h
│   │   ├── GetEventController.m
│   │   ├── NavController.h
│   │   ├── NavController.m
│   │   ├── NavController.xib
│   │   ├── PhotosController.h
│   │   ├── PhotosController.m
│   │   ├── StatusController.h
│   │   ├── StatusController.m
│   │   ├── WebViewController.h
│   │   ├── WebViewController.m
│   │   ├── en.lproj/
│   │   │   ├── GetEventController.xib
│   │   │   └── InfoPlist.strings
│   │   └── main.m
│   └── DoubanAPIEngineDemo.xcodeproj/
│       └── project.pbxproj
├── README.markdown
└── libDoubanApiEngine.framework/
    └── Versions/
        └── A/
            ├── Headers/
            │   ├── ASICacheDelegate.h
            │   ├── ASIHTTPRequest.h
            │   ├── ASIHTTPRequestConfig.h
            │   ├── ASIHTTPRequestDelegate.h
            │   ├── ASIProgressDelegate.h
            │   ├── DOUAPIConfig.h
            │   ├── DOUAPIEngine.h
            │   ├── DOUAlbum.h
            │   ├── DOUAlbumArray.h
            │   ├── DOUBook.h
            │   ├── DOUBookArray.h
            │   ├── DOUComment.h
            │   ├── DOUCommentArray.h
            │   ├── DOUEvent.h
            │   ├── DOUEventArray.h
            │   ├── DOUHttpRequest.h
            │   ├── DOULoc.h
            │   ├── DOULocArray.h
            │   ├── DOUMovie.h
            │   ├── DOUMovieArray.h
            │   ├── DOUMusic.h
            │   ├── DOUMusicArray.h
            │   ├── DOUNote.h
            │   ├── DOUNoteArray.h
            │   ├── DOUOAuth2.h
            │   ├── DOUOAuthService.h
            │   ├── DOUOAuthStore.h
            │   ├── DOUObject+Utils.h
            │   ├── DOUObject.h
            │   ├── DOUObjectArray.h
            │   ├── DOUOnline.h
            │   ├── DOUOnlineArray.h
            │   ├── DOUPhoto.h
            │   ├── DOUPhotoArray.h
            │   ├── DOUQuery.h
            │   ├── DOUService.h
            │   ├── DOUUser.h
            │   ├── DoubanAttribute.h
            │   ├── DoubanDefines.h
            │   ├── DoubanEntryAlbum.h
            │   ├── DoubanEntryCity.h
            │   ├── DoubanEntryComment.h
            │   ├── DoubanEntryEvent.h
            │   ├── DoubanEntryEventCategory.h
            │   ├── DoubanEntryMiniblog.h
            │   ├── DoubanEntryPeople.h
            │   ├── DoubanEntryPhoto.h
            │   ├── DoubanEntryRecommendation.h
            │   ├── DoubanEntryReview.h
            │   ├── DoubanEntrySubject.h
            │   ├── DoubanFeedAlbum.h
            │   ├── DoubanFeedCity.h
            │   ├── DoubanFeedComment.h
            │   ├── DoubanFeedEvent.h
            │   ├── DoubanFeedEventCategory.h
            │   ├── DoubanFeedMiniblog.h
            │   ├── DoubanFeedPeople.h
            │   ├── DoubanFeedPhoto.h
            │   ├── DoubanFeedRecommendation.h
            │   ├── DoubanFeedReview.h
            │   ├── DoubanFeedSubject.h
            │   ├── DoubanLocation.h
            │   ├── DoubanSignature.h
            │   ├── DoubanTag.h
            │   ├── DoubanUID.h
            │   ├── GDataAtomPubControl.h
            │   ├── GDataBaseElements.h
            │   ├── GDataBatchID.h
            │   ├── GDataBatchInterrupted.h
            │   ├── GDataBatchOperation.h
            │   ├── GDataBatchStatus.h
            │   ├── GDataCategory.h
            │   ├── GDataComment.h
            │   ├── GDataCustomProperty.h
            │   ├── GDataDateTime.h
            │   ├── GDataDefines.h
            │   ├── GDataDeleted.h
            │   ├── GDataElements.h
            │   ├── GDataEmail.h
            │   ├── GDataEntryBase.h
            │   ├── GDataEntryContent.h
            │   ├── GDataEntryLink.h
            │   ├── GDataExtendedProperty.h
            │   ├── GDataFeedBase.h
            │   ├── GDataFeedLink.h
            │   ├── GDataGenerator.h
            │   ├── GDataGeoPt.h
            │   ├── GDataIM.h
            │   ├── GDataLink.h
            │   ├── GDataMoney.h
            │   ├── GDataName.h
            │   ├── GDataObject.h
            │   ├── GDataOrganization.h
            │   ├── GDataOrganizationName.h
            │   ├── GDataPerson.h
            │   ├── GDataPhoneNumber.h
            │   ├── GDataPostalAddress.h
            │   ├── GDataRating.h
            │   ├── GDataStructuredPostalAddress.h
            │   ├── GDataTextConstruct.h
            │   ├── GDataUtilities.h
            │   ├── GDataValueConstruct.h
            │   ├── GDataWhen.h
            │   ├── GDataWhere.h
            │   ├── GDataWho.h
            │   ├── GDataXMLNode.h
            │   ├── GTMGatherInputStream.h
            │   ├── GTMMIMEDocument.h
            │   └── GeorssPoint.h
            └── libDoubanApiEngine

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================

#global
*.orig

#ios
.DS_Store
build/
*~
project.xcworkspace/
xcuserdata/


================================================
FILE: DoubanAPIEngine/DoubanAPIEngine/DoubanAPIEngine-Prefix.pch
================================================
//
// Prefix header for all source files of the 'DoubanAPIEngine' target in the 'DoubanAPIEngine' project
//

#ifdef __OBJC__
  #import <Foundation/Foundation.h>
#endif


================================================
FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIAuthenticationDialog.h
================================================
//
//  ASIAuthenticationDialog.h
//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
//
//  Created by Ben Copsey on 21/08/2009.
//  Copyright 2009 All-Seeing Interactive. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class ASIHTTPRequest;

typedef enum _ASIAuthenticationType {
	ASIStandardAuthenticationType = 0,
    ASIProxyAuthenticationType = 1
} ASIAuthenticationType;

@interface ASIAutorotatingViewController : UIViewController
@end

@interface ASIAuthenticationDialog : ASIAutorotatingViewController <UIActionSheetDelegate, UITableViewDelegate, UITableViewDataSource> {
	ASIHTTPRequest *request;
	ASIAuthenticationType type;
	UITableView *tableView;
	UIViewController *presentingController;
	BOOL didEnableRotationNotifications;
}
+ (void)presentAuthenticationDialogForRequest:(ASIHTTPRequest *)request;
+ (void)dismiss;

@property (retain) ASIHTTPRequest *request;
@property (assign) ASIAuthenticationType type;
@property (assign) BOOL didEnableRotationNotifications;
@property (retain, nonatomic) UIViewController *presentingController;
@end


================================================
FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIAuthenticationDialog.m
================================================
//
//  ASIAuthenticationDialog.m
//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
//
//  Created by Ben Copsey on 21/08/2009.
//  Copyright 2009 All-Seeing Interactive. All rights reserved.
//

#import "ASIAuthenticationDialog.h"
#import "ASIHTTPRequest.h"
#import <QuartzCore/QuartzCore.h>

static ASIAuthenticationDialog *sharedDialog = nil;
BOOL isDismissing = NO;
static NSMutableArray *requestsNeedingAuthentication = nil;

static const NSUInteger kUsernameRow = 0;
static const NSUInteger kUsernameSection = 0;
static const NSUInteger kPasswordRow = 1;
static const NSUInteger kPasswordSection = 0;
static const NSUInteger kDomainRow = 0;
static const NSUInteger kDomainSection = 1;


@implementation ASIAutorotatingViewController

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
	return YES;
}

@end


@interface ASIAuthenticationDialog ()
- (void)showTitle;
- (void)show;
- (NSArray *)requestsRequiringTheseCredentials;
- (void)presentNextDialog;
- (void)keyboardWillShow:(NSNotification *)notification;
- (void)orientationChanged:(NSNotification *)notification;
- (void)cancelAuthenticationFromDialog:(id)sender;
- (void)loginWithCredentialsFromDialog:(id)sender;
@property (retain) UITableView *tableView;
@end

@implementation ASIAuthenticationDialog

#pragma mark init / dealloc

+ (void)initialize
{
	if (self == [ASIAuthenticationDialog class]) {
		requestsNeedingAuthentication = [[NSMutableArray array] retain];
	}
}

+ (void)presentAuthenticationDialogForRequest:(ASIHTTPRequest *)theRequest
{
	// No need for a lock here, this will always be called on the main thread
	if (!sharedDialog) {
		sharedDialog = [[self alloc] init];
		[sharedDialog setRequest:theRequest];
		if ([theRequest authenticationNeeded] == ASIProxyAuthenticationNeeded) {
			[sharedDialog setType:ASIProxyAuthenticationType];
		} else {
			[sharedDialog setType:ASIStandardAuthenticationType];
		}
		[sharedDialog show];
	} else {
		[requestsNeedingAuthentication addObject:theRequest];
	}
}

- (id)init
{
	if ((self = [self initWithNibName:nil bundle:nil])) {
		[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
		if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
#endif
			if (![UIDevice currentDevice].generatesDeviceOrientationNotifications) {
				[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
				[self setDidEnableRotationNotifications:YES];
			}
			[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil];
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
		}
#endif
	}
	return self;
}

- (void)dealloc
{
	if ([self didEnableRotationNotifications]) {
		[[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];
	}
	[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];

	[request release];
	[tableView release];
	[presentingController.view removeFromSuperview];
	[presentingController release];
	[super dealloc];
}

#pragma mark keyboard notifications

- (void)keyboardWillShow:(NSNotification *)notification
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
	if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
#endif
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_3_2
		NSValue *keyboardBoundsValue = [[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey];
#else
		NSValue *keyboardBoundsValue = [[notification userInfo] objectForKey:UIKeyboardBoundsUserInfoKey];
#endif
		CGRect keyboardBounds;
		[keyboardBoundsValue getValue:&keyboardBounds];
		UIEdgeInsets e = UIEdgeInsetsMake(0, 0, keyboardBounds.size.height, 0);
		[[self tableView] setScrollIndicatorInsets:e];
		[[self tableView] setContentInset:e];
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
	}
#endif
}

// Manually handles orientation changes on iPhone
- (void)orientationChanged:(NSNotification *)notification
{
	[self showTitle];
	
	UIInterfaceOrientation o = (UIInterfaceOrientation)[[UIApplication sharedApplication] statusBarOrientation];
	CGFloat angle = 0;
	switch (o) {
		case UIDeviceOrientationLandscapeLeft: angle = 90; break;
		case UIDeviceOrientationLandscapeRight: angle = -90; break;
		case UIDeviceOrientationPortraitUpsideDown: angle = 180; break;
		default: break;
	}

	CGRect f = [[UIScreen mainScreen] applicationFrame];

	// Swap the frame height and width if necessary
 	if (UIDeviceOrientationIsLandscape(o)) {
		CGFloat t;
		t = f.size.width;
		f.size.width = f.size.height;
		f.size.height = t;
	}

	CGAffineTransform previousTransform = self.view.layer.affineTransform;
	CGAffineTransform newTransform = CGAffineTransformMakeRotation((CGFloat)(angle * M_PI / 180.0));

	// Reset the transform so we can set the size
	self.view.layer.affineTransform = CGAffineTransformIdentity;
	self.view.frame = (CGRect){ { 0, 0 }, f.size};

	// Revert to the previous transform for correct animation
	self.view.layer.affineTransform = previousTransform;

	[UIView beginAnimations:nil context:NULL];
	[UIView setAnimationDuration:0.3];

	// Set the new transform
	self.view.layer.affineTransform = newTransform;

	// Fix the view origin
	self.view.frame = (CGRect){ { f.origin.x, f.origin.y },self.view.frame.size};
    [UIView commitAnimations];
}
		 
#pragma mark utilities

- (UIViewController *)presentingController
{
	if (!presentingController) {
		presentingController = [[ASIAutorotatingViewController alloc] initWithNibName:nil bundle:nil];

		// Attach to the window, but don't interfere.
		UIWindow *window = [[[UIApplication sharedApplication] windows] objectAtIndex:0];
		[window addSubview:[presentingController view]];
		[[presentingController view] setFrame:CGRectZero];
		[[presentingController view] setUserInteractionEnabled:NO];
	}

	return presentingController;
}

- (UITextField *)textFieldInRow:(NSUInteger)row section:(NSUInteger)section
{
	return [[[[[self tableView] cellForRowAtIndexPath:
			   [NSIndexPath indexPathForRow:row inSection:section]]
			  contentView] subviews] objectAtIndex:0];
}

- (UITextField *)usernameField
{
	return [self textFieldInRow:kUsernameRow section:kUsernameSection];
}

- (UITextField *)passwordField
{
	return [self textFieldInRow:kPasswordRow section:kPasswordSection];
}

- (UITextField *)domainField
{
	return [self textFieldInRow:kDomainRow section:kDomainSection];
}

#pragma mark show / dismiss

+ (void)dismiss
{
	[[sharedDialog parentViewController] dismissModalViewControllerAnimated:YES];
}

- (void)viewDidDisappear:(BOOL)animated
{
	[self retain];
	[sharedDialog release];
	sharedDialog = nil;
	[self performSelector:@selector(presentNextDialog) withObject:nil afterDelay:0];
	[self release];
}

- (void)dismiss
{
	if (self == sharedDialog) {
		[[self class] dismiss];
	} else {
		[[self parentViewController] dismissModalViewControllerAnimated:YES];
	}
}

- (void)showTitle
{
	UINavigationBar *navigationBar = [[[self view] subviews] objectAtIndex:0];
	UINavigationItem *navItem = [[navigationBar items] objectAtIndex:0];
	if (UIInterfaceOrientationIsPortrait([[UIDevice currentDevice] orientation])) {
		// Setup the title
		if ([self type] == ASIProxyAuthenticationType) {
			[navItem setPrompt:@"Login to this secure proxy server."];
		} else {
			[navItem setPrompt:@"Login to this secure server."];
		}
	} else {
		[navItem setPrompt:nil];
	}
	[navigationBar sizeToFit];
	CGRect f = [[self view] bounds];
	f.origin.y = [navigationBar frame].size.height;
	f.size.height -= f.origin.y;
	[[self tableView] setFrame:f];
}

- (void)show
{
	// Remove all subviews
	UIView *v;
	while ((v = [[[self view] subviews] lastObject])) {
		[v removeFromSuperview];
	}

	// Setup toolbar
	UINavigationBar *bar = [[[UINavigationBar alloc] init] autorelease];
	[bar setAutoresizingMask:UIViewAutoresizingFlexibleWidth];

	UINavigationItem *navItem = [[[UINavigationItem alloc] init] autorelease];
	bar.items = [NSArray arrayWithObject:navItem];

	[[self view] addSubview:bar];

	[self showTitle];

	// Setup toolbar buttons
	if ([self type] == ASIProxyAuthenticationType) {
		[navItem setTitle:[[self request] proxyHost]];
	} else {
		[navItem setTitle:[[[self request] url] host]];
	}

	[navItem setLeftBarButtonItem:[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelAuthenticationFromDialog:)] autorelease]];
	[navItem setRightBarButtonItem:[[[UIBarButtonItem alloc] initWithTitle:@"Login" style:UIBarButtonItemStyleDone target:self action:@selector(loginWithCredentialsFromDialog:)] autorelease]];

	// We show the login form in a table view, similar to Safari's authentication dialog
	[bar sizeToFit];
	CGRect f = [[self view] bounds];
	f.origin.y = [bar frame].size.height;
	f.size.height -= f.origin.y;

	[self setTableView:[[[UITableView alloc] initWithFrame:f style:UITableViewStyleGrouped] autorelease]];
	[[self tableView] setDelegate:self];
	[[self tableView] setDataSource:self];
	[[self tableView] setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
	[[self view] addSubview:[self tableView]];

	// Force reload the table content, and focus the first field to show the keyboard
	[[self tableView] reloadData];
	[[[[[self tableView] cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]].contentView subviews] objectAtIndex:0] becomeFirstResponder];

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
	if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
		[self setModalPresentationStyle:UIModalPresentationFormSheet];
	}
#endif

	[[self presentingController] presentModalViewController:self animated:YES];
}

#pragma mark button callbacks

- (void)cancelAuthenticationFromDialog:(id)sender
{
	for (ASIHTTPRequest *theRequest in [self requestsRequiringTheseCredentials]) {
		[theRequest cancelAuthentication];
		[requestsNeedingAuthentication removeObject:theRequest];
	}
	[self dismiss];
}

- (NSArray *)requestsRequiringTheseCredentials
{
	NSMutableArray *requestsRequiringTheseCredentials = [NSMutableArray array];
	NSURL *requestURL = [[self request] url];
	for (ASIHTTPRequest *otherRequest in requestsNeedingAuthentication) {
		NSURL *theURL = [otherRequest url];
		if (([otherRequest authenticationNeeded] == [[self request] authenticationNeeded]) && [[theURL host] isEqualToString:[requestURL host]] && ([theURL port] == [requestURL port] || ([requestURL port] && [[theURL port] isEqualToNumber:[requestURL port]])) && [[theURL scheme] isEqualToString:[requestURL scheme]] && ((![otherRequest authenticationRealm] && ![[self request] authenticationRealm]) || ([otherRequest authenticationRealm] && [[self request] authenticationRealm] && [[[self request] authenticationRealm] isEqualToString:[otherRequest authenticationRealm]]))) {
			[requestsRequiringTheseCredentials addObject:otherRequest];
		}
	}
	[requestsRequiringTheseCredentials addObject:[self request]];
	return requestsRequiringTheseCredentials;
}

- (void)presentNextDialog
{
	if ([requestsNeedingAuthentication count]) {
		ASIHTTPRequest *nextRequest = [requestsNeedingAuthentication objectAtIndex:0];
		[requestsNeedingAuthentication removeObjectAtIndex:0];
		[[self class] presentAuthenticationDialogForRequest:nextRequest];
	}
}


- (void)loginWithCredentialsFromDialog:(id)sender
{
	for (ASIHTTPRequest *theRequest in [self requestsRequiringTheseCredentials]) {

		NSString *username = [[self usernameField] text];
		NSString *password = [[self passwordField] text];

		if (username == nil) { username = @""; }
		if (password == nil) { password = @""; }

		if ([self type] == ASIProxyAuthenticationType) {
			[theRequest setProxyUsername:username];
			[theRequest setProxyPassword:password];
		} else {
			[theRequest setUsername:username];
			[theRequest setPassword:password];
		}

		// Handle NTLM domains
		NSString *scheme = ([self type] == ASIStandardAuthenticationType) ? [[self request] authenticationScheme] : [[self request] proxyAuthenticationScheme];
		if ([scheme isEqualToString:(NSString *)kCFHTTPAuthenticationSchemeNTLM]) {
			NSString *domain = [[self domainField] text];
			if ([self type] == ASIProxyAuthenticationType) {
				[theRequest setProxyDomain:domain];
			} else {
				[theRequest setDomain:domain];
			}
		}

		[theRequest retryUsingSuppliedCredentials];
		[requestsNeedingAuthentication removeObject:theRequest];
	}
	[self dismiss];
}

#pragma mark table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)aTableView
{
	NSString *scheme = ([self type] == ASIStandardAuthenticationType) ? [[self request] authenticationScheme] : [[self request] proxyAuthenticationScheme];
	if ([scheme isEqualToString:(NSString *)kCFHTTPAuthenticationSchemeNTLM]) {
		return 2;
	}
	return 1;
}

- (CGFloat)tableView:(UITableView *)aTableView heightForFooterInSection:(NSInteger)section
{
	if (section == [self numberOfSectionsInTableView:aTableView]-1) {
		return 30;
	}
	return 0;
}

- (CGFloat)tableView:(UITableView *)aTableView heightForHeaderInSection:(NSInteger)section
{
	if (section == 0) {
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
		if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
			return 54;
		}
#endif
		return 30;
	}
	return 0;
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
	if (section == 0) {
		return [[self request] authenticationRealm];
	}
	return nil;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_3_0
	UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];
#else
	UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(0,0,0,0) reuseIdentifier:nil] autorelease];
#endif

	[cell setSelectionStyle:UITableViewCellSelectionStyleNone];

	CGRect f = CGRectInset([cell bounds], 10, 10);
	UITextField *textField = [[[UITextField alloc] initWithFrame:f] autorelease];
	[textField setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
	[textField setAutocapitalizationType:UITextAutocapitalizationTypeNone];
	[textField setAutocorrectionType:UITextAutocorrectionTypeNo];

	NSUInteger s = [indexPath section];
	NSUInteger r = [indexPath row];

	if (s == kUsernameSection && r == kUsernameRow) {
		[textField setPlaceholder:@"User"];
	} else if (s == kPasswordSection && r == kPasswordRow) {
		[textField setPlaceholder:@"Password"];
		[textField setSecureTextEntry:YES];
	} else if (s == kDomainSection && r == kDomainRow) {
		[textField setPlaceholder:@"Domain"];
	}
	[cell.contentView addSubview:textField];

	return cell;
}

- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section
{
	if (section == 0) {
		return 2;
	} else {
		return 1;
	}
}

- (NSString *)tableView:(UITableView *)aTableView titleForFooterInSection:(NSInteger)section
{
	if (section == [self numberOfSectionsInTableView:aTableView]-1) {
		// If we're using Basic authentication and the connection is not using SSL, we'll show the plain text message
		if ([[[self request] authenticationScheme] isEqualToString:(NSString *)kCFHTTPAuthenticationSchemeBasic] && ![[[[self request] url] scheme] isEqualToString:@"https"]) {
			return @"Password will be sent in the clear.";
		// We are using Digest, NTLM, or any scheme over SSL
		} else {
			return @"Password will be sent securely.";
		}
	}
	return nil;
}

#pragma mark -

@synthesize request;
@synthesize type;
@synthesize tableView;
@synthesize didEnableRotationNotifications;
@synthesize presentingController;
@end


================================================
FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASICacheDelegate.h
================================================
//
//  ASICacheDelegate.h
//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
//
//  Created by Ben Copsey on 01/05/2010.
//  Copyright 2010 All-Seeing Interactive. All rights reserved.
//

#import <Foundation/Foundation.h>
@class ASIHTTPRequest;

// Cache policies control the behaviour of a cache and how requests use the cache
// When setting a cache policy, you can use a combination of these values as a bitmask
// For example: [request setCachePolicy:ASIAskServerIfModifiedCachePolicy|ASIFallbackToCacheIfLoadFailsCachePolicy|ASIDoNotWriteToCacheCachePolicy];
// Note that some of the behaviours below are mutally exclusive - you cannot combine ASIAskServerIfModifiedWhenStaleCachePolicy and ASIAskServerIfModifiedCachePolicy, for example.
typedef enum _ASICachePolicy {

	// The default cache policy. When you set a request to use this, it will use the cache's defaultCachePolicy
	// ASIDownloadCache's default cache policy is 'ASIAskServerIfModifiedWhenStaleCachePolicy'
	ASIUseDefaultCachePolicy = 0,

	// Tell the request not to read from the cache
	ASIDoNotReadFromCacheCachePolicy = 1,

	// The the request not to write to the cache
	ASIDoNotWriteToCacheCachePolicy = 2,

	// Ask the server if there is an updated version of this resource (using a conditional GET) ONLY when the cached data is stale
	ASIAskServerIfModifiedWhenStaleCachePolicy = 4,

	// Always ask the server if there is an updated version of this resource (using a conditional GET)
	ASIAskServerIfModifiedCachePolicy = 8,

	// If cached data exists, use it even if it is stale. This means requests will not talk to the server unless the resource they are requesting is not in the cache
	ASIOnlyLoadIfNotCachedCachePolicy = 16,

	// If cached data exists, use it even if it is stale. If cached data does not exist, stop (will not set an error on the request)
	ASIDontLoadCachePolicy = 32,

	// Specifies that cached data may be used if the request fails. If cached data is used, the request will succeed without error. Usually used in combination with other options above.
	ASIFallbackToCacheIfLoadFailsCachePolicy = 64
} ASICachePolicy;

// Cache storage policies control whether cached data persists between application launches (ASICachePermanentlyCacheStoragePolicy) or not (ASICacheForSessionDurationCacheStoragePolicy)
// Calling [ASIHTTPRequest clearSession] will remove any data stored using ASICacheForSessionDurationCacheStoragePolicy
typedef enum _ASICacheStoragePolicy {
	ASICacheForSessionDurationCacheStoragePolicy = 0,
	ASICachePermanentlyCacheStoragePolicy = 1
} ASICacheStoragePolicy;


@protocol ASICacheDelegate <NSObject>

@required

// Should return the cache policy that will be used when requests have their cache policy set to ASIUseDefaultCachePolicy
- (ASICachePolicy)defaultCachePolicy;

// Returns the date a cached response should expire on. Pass a non-zero max age to specify a custom date.
- (NSDate *)expiryDateForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge;

// Updates cached response headers with a new expiry date. Pass a non-zero max age to specify a custom date.
- (void)updateExpiryForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge;

// Looks at the request's cache policy and any cached headers to determine if the cache data is still valid
- (BOOL)canUseCachedDataForRequest:(ASIHTTPRequest *)request;

// Removes cached data for a particular request
- (void)removeCachedDataForRequest:(ASIHTTPRequest *)request;

// Should return YES if the cache considers its cached response current for the request
// Should return NO is the data is not cached, or (for example) if the cached headers state the request should have expired
- (BOOL)isCachedDataCurrentForRequest:(ASIHTTPRequest *)request;

// Should store the response for the passed request in the cache
// When a non-zero maxAge is passed, it should be used as the expiry time for the cached response
- (void)storeResponseForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge;

// Removes cached data for a particular url
- (void)removeCachedDataForURL:(NSURL *)url;

// Should return an NSDictionary of cached headers for the passed URL, if it is stored in the cache
- (NSDictionary *)cachedResponseHeadersForURL:(NSURL *)url;

// Should return the cached body of a response for the passed URL, if it is stored in the cache
- (NSData *)cachedResponseDataForURL:(NSURL *)url;

// Returns a path to the cached response data, if it exists
- (NSString *)pathToCachedResponseDataForURL:(NSURL *)url;

// Returns a path to the cached response headers, if they url
- (NSString *)pathToCachedResponseHeadersForURL:(NSURL *)url;

// Returns the location to use to store cached response headers for a particular request
- (NSString *)pathToStoreCachedResponseHeadersForRequest:(ASIHTTPRequest *)request;

// Returns the location to use to store a cached response body for a particular request
- (NSString *)pathToStoreCachedResponseDataForRequest:(ASIHTTPRequest *)request;

// Clear cached data stored for the passed storage policy
- (void)clearCachedResponsesForStoragePolicy:(ASICacheStoragePolicy)cachePolicy;

@end


================================================
FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIDataCompressor.h
================================================
//
//  ASIDataCompressor.h
//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
//
//  Created by Ben Copsey on 17/08/2010.
//  Copyright 2010 All-Seeing Interactive. All rights reserved.
//

// This is a helper class used by ASIHTTPRequest to handle deflating (compressing) data in memory and on disk
// You may also find it helpful if you need to deflate data and files yourself - see the class methods below
// Most of the zlib stuff is based on the sample code by Mark Adler available at http://zlib.net

#import <Foundation/Foundation.h>
#import <zlib.h>

@interface ASIDataCompressor : NSObject {
	BOOL streamReady;
	z_stream zStream;
}

// Convenience constructor will call setupStream for you
+ (id)compressor;

// Compress the passed chunk of data
// Passing YES for shouldFinish will finalize the deflated data - you must pass YES when you are on the last chunk of data
- (NSData *)compressBytes:(Bytef *)bytes length:(NSUInteger)length error:(NSError **)err shouldFinish:(BOOL)shouldFinish;

// Convenience method - pass it some data, and you'll get deflated data back
+ (NSData *)compressData:(NSData*)uncompressedData error:(NSError **)err;

// Convenience method - pass it a file containing the data to compress in sourcePath, and it will write deflated data to destinationPath
+ (BOOL)compressDataFromFile:(NSString *)sourcePath toFile:(NSString *)destinationPath error:(NSError **)err;

// Sets up zlib to handle the inflating. You only need to call this yourself if you aren't using the convenience constructor 'compressor'
- (NSError *)setupStream;

// Tells zlib to clean up. You need to call this if you need to cancel deflating part way through
// If deflating finishes or fails, this method will be called automatically
- (NSError *)closeStream;

@property (assign, readonly) BOOL streamReady;
@end


================================================
FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIDataCompressor.m
================================================
//
//  ASIDataCompressor.m
//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
//
//  Created by Ben Copsey on 17/08/2010.
//  Copyright 2010 All-Seeing Interactive. All rights reserved.
//

#import "ASIDataCompressor.h"
#import "ASIHTTPRequest.h"

#define DATA_CHUNK_SIZE 262144 // Deal with gzipped data in 256KB chunks
#define COMPRESSION_AMOUNT Z_DEFAULT_COMPRESSION

@interface ASIDataCompressor ()
+ (NSError *)deflateErrorWithCode:(int)code;
@end

@implementation ASIDataCompressor

+ (id)compressor
{
	ASIDataCompressor *compressor = [[[self alloc] init] autorelease];
	[compressor setupStream];
	return compressor;
}

- (void)dealloc
{
	if (streamReady) {
		[self closeStream];
	}
	[super dealloc];
}

- (NSError *)setupStream
{
	if (streamReady) {
		return nil;
	}
	// Setup the inflate stream
	zStream.zalloc = Z_NULL;
	zStream.zfree = Z_NULL;
	zStream.opaque = Z_NULL;
	zStream.avail_in = 0;
	zStream.next_in = 0;
	int status = deflateInit2(&zStream, COMPRESSION_AMOUNT, Z_DEFLATED, (15+16), 8, Z_DEFAULT_STRATEGY);
	if (status != Z_OK) {
		return [[self class] deflateErrorWithCode:status];
	}
	streamReady = YES;
	return nil;
}

- (NSError *)closeStream
{
	if (!streamReady) {
		return nil;
	}
	// Close the deflate stream
	streamReady = NO;
	int status = deflateEnd(&zStream);
	if (status != Z_OK) {
		return [[self class] deflateErrorWithCode:status];
	}
	return nil;
}

- (NSData *)compressBytes:(Bytef *)bytes length:(NSUInteger)length error:(NSError **)err shouldFinish:(BOOL)shouldFinish
{
	if (length == 0) return nil;
	
	NSUInteger halfLength = length/2;
	
	// We'll take a guess that the compressed data will fit in half the size of the original (ie the max to compress at once is half DATA_CHUNK_SIZE), if not, we'll increase it below
	NSMutableData *outputData = [NSMutableData dataWithLength:length/2]; 
	
	int status;
	
	zStream.next_in = bytes;
	zStream.avail_in = (unsigned int)length;
	zStream.avail_out = 0;

	NSInteger bytesProcessedAlready = zStream.total_out;
	while (zStream.avail_out == 0) {
		
		if (zStream.total_out-bytesProcessedAlready >= [outputData length]) {
			[outputData increaseLengthBy:halfLength];
		}
		
		zStream.next_out = (Bytef*)[outputData mutableBytes] + zStream.total_out-bytesProcessedAlready;
		zStream.avail_out = (unsigned int)([outputData length] - (zStream.total_out-bytesProcessedAlready));
		status = deflate(&zStream, shouldFinish ? Z_FINISH : Z_NO_FLUSH);
		
		if (status == Z_STREAM_END) {
			break;
		} else if (status != Z_OK) {
			if (err) {
				*err = [[self class] deflateErrorWithCode:status];
			}
			return NO;
		}
	}

	// Set real length
	[outputData setLength: zStream.total_out-bytesProcessedAlready];
	return outputData;
}


+ (NSData *)compressData:(NSData*)uncompressedData error:(NSError **)err
{
	NSError *theError = nil;
	NSData *outputData = [[ASIDataCompressor compressor] compressBytes:(Bytef *)[uncompressedData bytes] length:[uncompressedData length] error:&theError shouldFinish:YES];
	if (theError) {
		if (err) {
			*err = theError;
		}
		return nil;
	}
	return outputData;
}



+ (BOOL)compressDataFromFile:(NSString *)sourcePath toFile:(NSString *)destinationPath error:(NSError **)err
{
	NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];

	// Create an empty file at the destination path
	if (![fileManager createFileAtPath:destinationPath contents:[NSData data] attributes:nil]) {
		if (err) {
			*err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of %@ failed because we were to create a file at %@",sourcePath,destinationPath],NSLocalizedDescriptionKey,nil]];
		}
		return NO;
	}
	
	// Ensure the source file exists
	if (![fileManager fileExistsAtPath:sourcePath]) {
		if (err) {
			*err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of %@ failed the file does not exist",sourcePath],NSLocalizedDescriptionKey,nil]];
		}
		return NO;
	}
	
	UInt8 inputData[DATA_CHUNK_SIZE];
	NSData *outputData;
	NSInteger readLength;
	NSError *theError = nil;
	
	ASIDataCompressor *compressor = [ASIDataCompressor compressor];
	
	NSInputStream *inputStream = [NSInputStream inputStreamWithFileAtPath:sourcePath];
	[inputStream open];
	NSOutputStream *outputStream = [NSOutputStream outputStreamToFileAtPath:destinationPath append:NO];
	[outputStream open];
	
    while ([compressor streamReady]) {
		
		// Read some data from the file
		readLength = [inputStream read:inputData maxLength:DATA_CHUNK_SIZE];

		// Make sure nothing went wrong
		if ([inputStream streamStatus] == NSStreamEventErrorOccurred) {
			if (err) {
				*err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of %@ failed because we were unable to read from the source data file",sourcePath],NSLocalizedDescriptionKey,[inputStream streamError],NSUnderlyingErrorKey,nil]];
			}
			[compressor closeStream];
			return NO;
		}
		// Have we reached the end of the input data?
		if (!readLength) {
			break;
		}
		
		// Attempt to deflate the chunk of data
		outputData = [compressor compressBytes:inputData length:readLength error:&theError shouldFinish:readLength < DATA_CHUNK_SIZE ];
		if (theError) {
			if (err) {
				*err = theError;
			}
			[compressor closeStream];
			return NO;
		}
		
		// Write the deflated data out to the destination file
		[outputStream write:(const uint8_t *)[outputData bytes] maxLength:[outputData length]];
		
		// Make sure nothing went wrong
		if ([inputStream streamStatus] == NSStreamEventErrorOccurred) {
			if (err) {
				*err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of %@ failed because we were unable to write to the destination data file at %@",sourcePath,destinationPath],NSLocalizedDescriptionKey,[outputStream streamError],NSUnderlyingErrorKey,nil]];
            }
			[compressor closeStream];
			return NO;
		}
		
    }
	[inputStream close];
	[outputStream close];

	NSError *error = [compressor closeStream];
	if (error) {
		if (err) {
			*err = error;
		}
		return NO;
	}

	return YES;
}

+ (NSError *)deflateErrorWithCode:(int)code
{
	return [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of data failed with code %hi",code],NSLocalizedDescriptionKey,nil]];
}

@synthesize streamReady;
@end


================================================
FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIDataDecompressor.h
================================================
//
//  ASIDataDecompressor.h
//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
//
//  Created by Ben Copsey on 17/08/2010.
//  Copyright 2010 All-Seeing Interactive. All rights reserved.
//

// This is a helper class used by ASIHTTPRequest to handle inflating (decompressing) data in memory and on disk
// You may also find it helpful if you need to inflate data and files yourself - see the class methods below
// Most of the zlib stuff is based on the sample code by Mark Adler available at http://zlib.net

#import <Foundation/Foundation.h>
#import <zlib.h>

@interface ASIDataDecompressor : NSObject {
	BOOL streamReady;
	z_stream zStream;
}

// Convenience constructor will call setupStream for you
+ (id)decompressor;

// Uncompress the passed chunk of data
- (NSData *)uncompressBytes:(Bytef *)bytes length:(NSUInteger)length error:(NSError **)err;

// Convenience method - pass it some deflated data, and you'll get inflated data back
+ (NSData *)uncompressData:(NSData*)compressedData error:(NSError **)err;

// Convenience method - pass it a file containing deflated data in sourcePath, and it will write inflated data to destinationPath
+ (BOOL)uncompressDataFromFile:(NSString *)sourcePath toFile:(NSString *)destinationPath error:(NSError **)err;

// Sets up zlib to handle the inflating. You only need to call this yourself if you aren't using the convenience constructor 'decompressor'
- (NSError *)setupStream;

// Tells zlib to clean up. You need to call this if you need to cancel inflating part way through
// If inflating finishes or fails, this method will be called automatically
- (NSError *)closeStream;

@property (assign, readonly) BOOL streamReady;
@end


================================================
FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIDataDecompressor.m
================================================
//
//  ASIDataDecompressor.m
//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
//
//  Created by Ben Copsey on 17/08/2010.
//  Copyright 2010 All-Seeing Interactive. All rights reserved.
//

#import "ASIDataDecompressor.h"
#import "ASIHTTPRequest.h"

#define DATA_CHUNK_SIZE 262144 // Deal with gzipped data in 256KB chunks

@interface ASIDataDecompressor ()
+ (NSError *)inflateErrorWithCode:(int)code;
@end;

@implementation ASIDataDecompressor

+ (id)decompressor
{
	ASIDataDecompressor *decompressor = [[[self alloc] init] autorelease];
	[decompressor setupStream];
	return decompressor;
}

- (void)dealloc
{
	if (streamReady) {
		[self closeStream];
	}
	[super dealloc];
}

- (NSError *)setupStream
{
	if (streamReady) {
		return nil;
	}
	// Setup the inflate stream
	zStream.zalloc = Z_NULL;
	zStream.zfree = Z_NULL;
	zStream.opaque = Z_NULL;
	zStream.avail_in = 0;
	zStream.next_in = 0;
	int status = inflateInit2(&zStream, (15+32));
	if (status != Z_OK) {
		return [[self class] inflateErrorWithCode:status];
	}
	streamReady = YES;
	return nil;
}

- (NSError *)closeStream
{
	if (!streamReady) {
		return nil;
	}
	// Close the inflate stream
	streamReady = NO;
	int status = inflateEnd(&zStream);
	if (status != Z_OK) {
		return [[self class] inflateErrorWithCode:status];
	}
	return nil;
}

- (NSData *)uncompressBytes:(Bytef *)bytes length:(NSUInteger)length error:(NSError **)err
{
	if (length == 0) return nil;
	
	NSUInteger halfLength = length/2;
	NSMutableData *outputData = [NSMutableData dataWithLength:length+halfLength];

	int status;
	
	zStream.next_in = bytes;
	zStream.avail_in = (unsigned int)length;
	zStream.avail_out = 0;
	
	NSInteger bytesProcessedAlready = zStream.total_out;
	while (zStream.avail_in != 0) {
		
		if (zStream.total_out-bytesProcessedAlready >= [outputData length]) {
			[outputData increaseLengthBy:halfLength];
		}
		
		zStream.next_out = (Bytef*)[outputData mutableBytes] + zStream.total_out-bytesProcessedAlready;
		zStream.avail_out = (unsigned int)([outputData length] - (zStream.total_out-bytesProcessedAlready));
		
		status = inflate(&zStream, Z_NO_FLUSH);
		
		if (status == Z_STREAM_END) {
			break;
		} else if (status != Z_OK) {
			if (err) {
				*err = [[self class] inflateErrorWithCode:status];
			}
			return nil;
		}
	}
	
	// Set real length
	[outputData setLength: zStream.total_out-bytesProcessedAlready];
	return outputData;
}


+ (NSData *)uncompressData:(NSData*)compressedData error:(NSError **)err
{
	NSError *theError = nil;
	NSData *outputData = [[ASIDataDecompressor decompressor] uncompressBytes:(Bytef *)[compressedData bytes] length:[compressedData length] error:&theError];
	if (theError) {
		if (err) {
			*err = theError;
		}
		return nil;
	}
	return outputData;
}

+ (BOOL)uncompressDataFromFile:(NSString *)sourcePath toFile:(NSString *)destinationPath error:(NSError **)err
{
	NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];

	// Create an empty file at the destination path
	if (![fileManager createFileAtPath:destinationPath contents:[NSData data] attributes:nil]) {
		if (err) {
			*err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Decompression of %@ failed because we were to create a file at %@",sourcePath,destinationPath],NSLocalizedDescriptionKey,nil]];
		}
		return NO;
	}
	
	// Ensure the source file exists
	if (![fileManager fileExistsAtPath:sourcePath]) {
		if (err) {
			*err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Decompression of %@ failed the file does not exist",sourcePath],NSLocalizedDescriptionKey,nil]];
		}
		return NO;
	}
	
	UInt8 inputData[DATA_CHUNK_SIZE];
	NSData *outputData;
	NSInteger readLength;
	NSError *theError = nil;
	

	ASIDataDecompressor *decompressor = [ASIDataDecompressor decompressor];

	NSInputStream *inputStream = [NSInputStream inputStreamWithFileAtPath:sourcePath];
	[inputStream open];
	NSOutputStream *outputStream = [NSOutputStream outputStreamToFileAtPath:destinationPath append:NO];
	[outputStream open];
	
    while ([decompressor streamReady]) {
		
		// Read some data from the file
		readLength = [inputStream read:inputData maxLength:DATA_CHUNK_SIZE]; 
		
		// Make sure nothing went wrong
		if ([inputStream streamStatus] == NSStreamEventErrorOccurred) {
			if (err) {
				*err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Decompression of %@ failed because we were unable to read from the source data file",sourcePath],NSLocalizedDescriptionKey,[inputStream streamError],NSUnderlyingErrorKey,nil]];
			}
            [decompressor closeStream];
			return NO;
		}
		// Have we reached the end of the input data?
		if (!readLength) {
			break;
		}

		// Attempt to inflate the chunk of data
		outputData = [decompressor uncompressBytes:inputData length:readLength error:&theError];
		if (theError) {
			if (err) {
				*err = theError;
			}
			[decompressor closeStream];
			return NO;
		}
		
		// Write the inflated data out to the destination file
		[outputStream write:(Bytef*)[outputData bytes] maxLength:[outputData length]];
		
		// Make sure nothing went wrong
		if ([inputStream streamStatus] == NSStreamEventErrorOccurred) {
			if (err) {
				*err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Decompression of %@ failed because we were unable to write to the destination data file at %@",sourcePath,destinationPath],NSLocalizedDescriptionKey,[outputStream streamError],NSUnderlyingErrorKey,nil]];
            }
			[decompressor closeStream];
			return NO;
		}
		
    }
	
	[inputStream close];
	[outputStream close];

	NSError *error = [decompressor closeStream];
	if (error) {
		if (err) {
			*err = error;
		}
		return NO;
	}

	return YES;
}


+ (NSError *)inflateErrorWithCode:(int)code
{
	return [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Decompression of data failed with code %hi",code],NSLocalizedDescriptionKey,nil]];
}

@synthesize streamReady;
@end


================================================
FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIDownloadCache.h
================================================
//
//  ASIDownloadCache.h
//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
//
//  Created by Ben Copsey on 01/05/2010.
//  Copyright 2010 All-Seeing Interactive. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ASICacheDelegate.h"

@interface ASIDownloadCache : NSObject <ASICacheDelegate> {
	
	// The default cache policy for this cache
	// Requests that store data in the cache will use this cache policy if their cache policy is set to ASIUseDefaultCachePolicy
	// Defaults to ASIAskServerIfModifiedWhenStaleCachePolicy
	ASICachePolicy defaultCachePolicy;
	
	// The directory in which cached data will be stored
	// Defaults to a directory called 'ASIHTTPRequestCache' in the temporary directory
	NSString *storagePath;
	
	// Mediates access to the cache
	NSRecursiveLock *accessLock;
	
	// When YES, the cache will look for cache-control / pragma: no-cache headers, and won't reuse store responses if it finds them
	BOOL shouldRespectCacheControlHeaders;
}

// Returns a static instance of an ASIDownloadCache
// In most circumstances, it will make sense to use this as a global cache, rather than creating your own cache
// To make ASIHTTPRequests use it automatically, use [ASIHTTPRequest setDefaultCache:[ASIDownloadCache sharedCache]];
+ (id)sharedCache;

// A helper function that determines if the server has requested data should not be cached by looking at the request's response headers
+ (BOOL)serverAllowsResponseCachingForRequest:(ASIHTTPRequest *)request;

// A list of file extensions that we know won't be readable by a webview when accessed locally
// If we're asking for a path to cache a particular url and it has one of these extensions, we change it to '.html'
+ (NSArray *)fileExtensionsToHandleAsHTML;

@property (assign, nonatomic) ASICachePolicy defaultCachePolicy;
@property (retain, nonatomic) NSString *storagePath;
@property (retain) NSRecursiveLock *accessLock;
@property (assign) BOOL shouldRespectCacheControlHeaders;
@end


================================================
FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIDownloadCache.m
================================================
//
//  ASIDownloadCache.m
//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
//
//  Created by Ben Copsey on 01/05/2010.
//  Copyright 2010 All-Seeing Interactive. All rights reserved.
//

#import "ASIDownloadCache.h"
#import "ASIHTTPRequest.h"
#import <CommonCrypto/CommonHMAC.h>

static ASIDownloadCache *sharedCache = nil;

static NSString *sessionCacheFolder = @"SessionStore";
static NSString *permanentCacheFolder = @"PermanentStore";
static NSArray *fileExtensionsToHandleAsHTML = nil;

@interface ASIDownloadCache ()
+ (NSString *)keyForURL:(NSURL *)url;
- (NSString *)pathToFile:(NSString *)file;
@end

@implementation ASIDownloadCache

+ (void)initialize
{
	if (self == [ASIDownloadCache class]) {
		// Obviously this is not an exhaustive list, but hopefully these are the most commonly used and this will 'just work' for the widest range of people
		// I imagine many web developers probably use url rewriting anyway
		fileExtensionsToHandleAsHTML = [[NSArray alloc] initWithObjects:@"asp",@"aspx",@"jsp",@"php",@"rb",@"py",@"pl",@"cgi", nil];
	}
}

- (id)init
{
	self = [super init];
	[self setShouldRespectCacheControlHeaders:YES];
	[self setDefaultCachePolicy:ASIUseDefaultCachePolicy];
	[self setAccessLock:[[[NSRecursiveLock alloc] init] autorelease]];
	return self;
}

+ (id)sharedCache
{
	if (!sharedCache) {
		@synchronized(self) {
			if (!sharedCache) {
				sharedCache = [[self alloc] init];
				[sharedCache setStoragePath:[[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@"ASIHTTPRequestCache"]];
			}
		}
	}
	return sharedCache;
}

- (void)dealloc
{
	[storagePath release];
	[accessLock release];
	[super dealloc];
}

- (NSString *)storagePath
{
	[[self accessLock] lock];
	NSString *p = [[storagePath retain] autorelease];
	[[self accessLock] unlock];
	return p;
}


- (void)setStoragePath:(NSString *)path
{
	[[self accessLock] lock];
	[self clearCachedResponsesForStoragePolicy:ASICacheForSessionDurationCacheStoragePolicy];
	[storagePath release];
	storagePath = [path retain];

	NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];

	BOOL isDirectory = NO;
	NSArray *directories = [NSArray arrayWithObjects:path,[path stringByAppendingPathComponent:sessionCacheFolder],[path stringByAppendingPathComponent:permanentCacheFolder],nil];
	for (NSString *directory in directories) {
		BOOL exists = [fileManager fileExistsAtPath:directory isDirectory:&isDirectory];
		if (exists && !isDirectory) {
			[[self accessLock] unlock];
			[NSException raise:@"FileExistsAtCachePath" format:@"Cannot create a directory for the cache at '%@', because a file already exists",directory];
		} else if (!exists) {
			[fileManager createDirectoryAtPath:directory withIntermediateDirectories:NO attributes:nil error:nil];
			if (![fileManager fileExistsAtPath:directory]) {
				[[self accessLock] unlock];
				[NSException raise:@"FailedToCreateCacheDirectory" format:@"Failed to create a directory for the cache at '%@'",directory];
			}
		}
	}
	[self clearCachedResponsesForStoragePolicy:ASICacheForSessionDurationCacheStoragePolicy];
	[[self accessLock] unlock];
}

- (void)updateExpiryForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge
{
	NSString *headerPath = [self pathToStoreCachedResponseHeadersForRequest:request];
	NSMutableDictionary *cachedHeaders = [NSMutableDictionary dictionaryWithContentsOfFile:headerPath];
	if (!cachedHeaders) {
		return;
	}
	NSDate *expires = [self expiryDateForRequest:request maxAge:maxAge];
	if (!expires) {
		return;
	}
	[cachedHeaders setObject:[NSNumber numberWithDouble:[expires timeIntervalSince1970]] forKey:@"X-ASIHTTPRequest-Expires"];
	[cachedHeaders writeToFile:headerPath atomically:NO];
}

- (NSDate *)expiryDateForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge
{
  return [ASIHTTPRequest expiryDateForRequest:request maxAge:maxAge];
}

- (void)storeResponseForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge
{
	[[self accessLock] lock];

	if ([request error] || ![request responseHeaders] || ([request cachePolicy] & ASIDoNotWriteToCacheCachePolicy)) {
		[[self accessLock] unlock];
		return;
	}

	// We only cache 200/OK or redirect reponses (redirect responses are cached so the cache works better with no internet connection)
	int responseCode = [request responseStatusCode];
	if (responseCode != 200 && responseCode != 301 && responseCode != 302 && responseCode != 303 && responseCode != 307) {
		[[self accessLock] unlock];
		return;
	}

	if ([self shouldRespectCacheControlHeaders] && ![[self class] serverAllowsResponseCachingForRequest:request]) {
		[[self accessLock] unlock];
		return;
	}

	NSString *headerPath = [self pathToStoreCachedResponseHeadersForRequest:request];
	NSString *dataPath = [self pathToStoreCachedResponseDataForRequest:request];

	NSMutableDictionary *responseHeaders = [NSMutableDictionary dictionaryWithDictionary:[request responseHeaders]];
	if ([request isResponseCompressed]) {
		[responseHeaders removeObjectForKey:@"Content-Encoding"];
	}

	// Create a special 'X-ASIHTTPRequest-Expires' header
	// This is what we use for deciding if cached data is current, rather than parsing the expires / max-age headers individually each time
	// We store this as a timestamp to make reading it easier as NSDateFormatter is quite expensive

	NSDate *expires = [self expiryDateForRequest:request maxAge:maxAge];
	if (expires) {
		[responseHeaders setObject:[NSNumber numberWithDouble:[expires timeIntervalSince1970]] forKey:@"X-ASIHTTPRequest-Expires"];
	}

	// Store the response code in a custom header so we can reuse it later

	// We'll change 304/Not Modified to 200/OK because this is likely to be us updating the cached headers with a conditional GET
	int statusCode = [request responseStatusCode];
	if (statusCode == 304) {
		statusCode = 200;
	}
	[responseHeaders setObject:[NSNumber numberWithInt:statusCode] forKey:@"X-ASIHTTPRequest-Response-Status-Code"];

	[responseHeaders writeToFile:headerPath atomically:NO];

	if ([request responseData]) {
		[[request responseData] writeToFile:dataPath atomically:NO];
	} else if ([request downloadDestinationPath] && ![[request downloadDestinationPath] isEqualToString:dataPath]) {        
		NSError *error = nil;
        NSFileManager* manager = [[NSFileManager alloc] init];
        if ([manager fileExistsAtPath:dataPath]) {
            [manager removeItemAtPath:dataPath error:&error];
        }
        [manager copyItemAtPath:[request downloadDestinationPath] toPath:dataPath error:&error];
        [manager release];
	}
	[[self accessLock] unlock];
}

- (NSDictionary *)cachedResponseHeadersForURL:(NSURL *)url
{
	NSString *path = [self pathToCachedResponseHeadersForURL:url];
	if (path) {
		return [NSDictionary dictionaryWithContentsOfFile:path];
	}
	return nil;
}

- (NSData *)cachedResponseDataForURL:(NSURL *)url
{
	NSString *path = [self pathToCachedResponseDataForURL:url];
	if (path) {
		return [NSData dataWithContentsOfFile:path];
	}
	return nil;
}

- (NSString *)pathToCachedResponseDataForURL:(NSURL *)url
{
	// Grab the file extension, if there is one. We do this so we can save the cached response with the same file extension - this is important if you want to display locally cached data in a web view 
	NSString *extension = [[url path] pathExtension];

	// If the url doesn't have an extension, we'll add one so a webview can read it when locally cached
	// If the url has the extension of a common web scripting language, we'll change the extension on the cached path to html for the same reason
	if (![extension length] || [[[self class] fileExtensionsToHandleAsHTML] containsObject:[extension lowercaseString]]) {
		extension = @"html";
	}
	return [self pathToFile:[[[self class] keyForURL:url] stringByAppendingPathExtension:extension]];
}

+ (NSArray *)fileExtensionsToHandleAsHTML
{
	return fileExtensionsToHandleAsHTML;
}


- (NSString *)pathToCachedResponseHeadersForURL:(NSURL *)url
{
	return [self pathToFile:[[[self class] keyForURL:url] stringByAppendingPathExtension:@"cachedheaders"]];
}

- (NSString *)pathToFile:(NSString *)file
{
	[[self accessLock] lock];
	if (![self storagePath]) {
		[[self accessLock] unlock];
		return nil;
	}

	NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];

	// Look in the session store
	NSString *dataPath = [[[self storagePath] stringByAppendingPathComponent:sessionCacheFolder] stringByAppendingPathComponent:file];
	if ([fileManager fileExistsAtPath:dataPath]) {
		[[self accessLock] unlock];
		return dataPath;
	}
	// Look in the permanent store
	dataPath = [[[self storagePath] stringByAppendingPathComponent:permanentCacheFolder] stringByAppendingPathComponent:file];
	if ([fileManager fileExistsAtPath:dataPath]) {
		[[self accessLock] unlock];
		return dataPath;
	}
	[[self accessLock] unlock];
	return nil;
}


- (NSString *)pathToStoreCachedResponseDataForRequest:(ASIHTTPRequest *)request
{
	[[self accessLock] lock];
	if (![self storagePath]) {
		[[self accessLock] unlock];
		return nil;
	}

	NSString *path = [[self storagePath] stringByAppendingPathComponent:([request cacheStoragePolicy] == ASICacheForSessionDurationCacheStoragePolicy ? sessionCacheFolder : permanentCacheFolder)];

	// Grab the file extension, if there is one. We do this so we can save the cached response with the same file extension - this is important if you want to display locally cached data in a web view 
	NSString *extension = [[[request url] path] pathExtension];

	// If the url doesn't have an extension, we'll add one so a webview can read it when locally cached
	// If the url has the extension of a common web scripting language, we'll change the extension on the cached path to html for the same reason
	if (![extension length] || [[[self class] fileExtensionsToHandleAsHTML] containsObject:[extension lowercaseString]]) {
		extension = @"html";
	}
	path =  [path stringByAppendingPathComponent:[[[self class] keyForURL:[request url]] stringByAppendingPathExtension:extension]];
	[[self accessLock] unlock];
	return path;
}

- (NSString *)pathToStoreCachedResponseHeadersForRequest:(ASIHTTPRequest *)request
{
	[[self accessLock] lock];
	if (![self storagePath]) {
		[[self accessLock] unlock];
		return nil;
	}
	NSString *path = [[self storagePath] stringByAppendingPathComponent:([request cacheStoragePolicy] == ASICacheForSessionDurationCacheStoragePolicy ? sessionCacheFolder : permanentCacheFolder)];
	path =  [path stringByAppendingPathComponent:[[[self class] keyForURL:[request url]] stringByAppendingPathExtension:@"cachedheaders"]];
	[[self accessLock] unlock];
	return path;
}

- (void)removeCachedDataForURL:(NSURL *)url
{
	[[self accessLock] lock];
	if (![self storagePath]) {
		[[self accessLock] unlock];
		return;
	}
	NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];

	NSString *path = [self pathToCachedResponseHeadersForURL:url];
	if (path) {
		[fileManager removeItemAtPath:path error:NULL];
	}

	path = [self pathToCachedResponseDataForURL:url];
	if (path) {
		[fileManager removeItemAtPath:path error:NULL];
	}
	[[self accessLock] unlock];
}

- (void)removeCachedDataForRequest:(ASIHTTPRequest *)request
{
	[self removeCachedDataForURL:[request url]];
}

- (BOOL)isCachedDataCurrentForRequest:(ASIHTTPRequest *)request
{
	[[self accessLock] lock];
	if (![self storagePath]) {
		[[self accessLock] unlock];
		return NO;
	}
	NSDictionary *cachedHeaders = [self cachedResponseHeadersForURL:[request url]];
	if (!cachedHeaders) {
		[[self accessLock] unlock];
		return NO;
	}
	NSString *dataPath = [self pathToCachedResponseDataForURL:[request url]];
	if (!dataPath) {
		[[self accessLock] unlock];
		return NO;
	}

	// New content is not different
	if ([request responseStatusCode] == 304) {
		[[self accessLock] unlock];
		return YES;
	}

	// If we already have response headers for this request, check to see if the new content is different
	// We check [request complete] so that we don't end up comparing response headers from a redirection with these
	if ([request responseHeaders] && [request complete]) {

		// If the Etag or Last-Modified date are different from the one we have, we'll have to fetch this resource again
		NSArray *headersToCompare = [NSArray arrayWithObjects:@"Etag",@"Last-Modified",nil];
		for (NSString *header in headersToCompare) {
			if (![[[request responseHeaders] objectForKey:header] isEqualToString:[cachedHeaders objectForKey:header]]) {
				[[self accessLock] unlock];
				return NO;
			}
		}
	}

	if ([self shouldRespectCacheControlHeaders]) {

		// Look for X-ASIHTTPRequest-Expires header to see if the content is out of date
		NSNumber *expires = [cachedHeaders objectForKey:@"X-ASIHTTPRequest-Expires"];
		if (expires) {
			if ([[NSDate dateWithTimeIntervalSince1970:[expires doubleValue]] timeIntervalSinceNow] >= 0) {
				[[self accessLock] unlock];
				return YES;
			}
		}

		// No explicit expiration time sent by the server
		[[self accessLock] unlock];
		return NO;
	}
	

	[[self accessLock] unlock];
	return YES;
}

- (ASICachePolicy)defaultCachePolicy
{
	[[self accessLock] lock];
	ASICachePolicy cp = defaultCachePolicy;
	[[self accessLock] unlock];
	return cp;
}


- (void)setDefaultCachePolicy:(ASICachePolicy)cachePolicy
{
	[[self accessLock] lock];
	if (!cachePolicy) {
		defaultCachePolicy = ASIAskServerIfModifiedWhenStaleCachePolicy;
	}  else {
		defaultCachePolicy = cachePolicy;	
	}
	[[self accessLock] unlock];
}

- (void)clearCachedResponsesForStoragePolicy:(ASICacheStoragePolicy)storagePolicy
{
	[[self accessLock] lock];
	if (![self storagePath]) {
		[[self accessLock] unlock];
		return;
	}
	NSString *path = [[self storagePath] stringByAppendingPathComponent:(storagePolicy == ASICacheForSessionDurationCacheStoragePolicy ? sessionCacheFolder : permanentCacheFolder)];

	NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];

	BOOL isDirectory = NO;
	BOOL exists = [fileManager fileExistsAtPath:path isDirectory:&isDirectory];
	if (!exists || !isDirectory) {
		[[self accessLock] unlock];
		return;
	}
	NSError *error = nil;
	NSArray *cacheFiles = [fileManager contentsOfDirectoryAtPath:path error:&error];
	if (error) {
		[[self accessLock] unlock];
		[NSException raise:@"FailedToTraverseCacheDirectory" format:@"Listing cache directory failed at path '%@'",path];	
	}
	for (NSString *file in cacheFiles) {
		[fileManager removeItemAtPath:[path stringByAppendingPathComponent:file] error:&error];
		if (error) {
			[[self accessLock] unlock];
			[NSException raise:@"FailedToRemoveCacheFile" format:@"Failed to remove cached data at path '%@'",path];
		}
	}
	[[self accessLock] unlock];
}

+ (BOOL)serverAllowsResponseCachingForRequest:(ASIHTTPRequest *)request
{
	NSString *cacheControl = [[[request responseHeaders] objectForKey:@"Cache-Control"] lowercaseString];
	if (cacheControl) {
		if ([cacheControl isEqualToString:@"no-cache"] || [cacheControl isEqualToString:@"no-store"]) {
			return NO;
		}
	}
	NSString *pragma = [[[request responseHeaders] objectForKey:@"Pragma"] lowercaseString];
	if (pragma) {
		if ([pragma isEqualToString:@"no-cache"]) {
			return NO;
		}
	}
	return YES;
}

+ (NSString *)keyForURL:(NSURL *)url
{
	NSString *urlString = [url absoluteString];
	if ([urlString length] == 0) {
		return nil;
	}

	// Strip trailing slashes so http://allseeing-i.com/ASIHTTPRequest/ is cached the same as http://allseeing-i.com/ASIHTTPRequest
	if ([[urlString substringFromIndex:[urlString length]-1] isEqualToString:@"/"]) {
		urlString = [urlString substringToIndex:[urlString length]-1];
	}

	// Borrowed from: http://stackoverflow.com/questions/652300/using-md5-hash-on-a-string-in-cocoa
	const char *cStr = [urlString UTF8String];
	unsigned char result[16];
	CC_MD5(cStr, (CC_LONG)strlen(cStr), result);
	return [NSString stringWithFormat:@"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",result[0], result[1], result[2], result[3], result[4], result[5], result[6], result[7],result[8], result[9], result[10], result[11],result[12], result[13], result[14], result[15]]; 	
}

- (BOOL)canUseCachedDataForRequest:(ASIHTTPRequest *)request
{
	// Ensure the request is allowed to read from the cache
	if ([request cachePolicy] & ASIDoNotReadFromCacheCachePolicy) {
		return NO;

	// If we don't want to load the request whatever happens, always pretend we have cached data even if we don't
	} else if ([request cachePolicy] & ASIDontLoadCachePolicy) {
		return YES;
	}

	NSDictionary *headers = [self cachedResponseHeadersForURL:[request url]];
	if (!headers) {
		return NO;
	}
	NSString *dataPath = [self pathToCachedResponseDataForURL:[request url]];
	if (!dataPath) {
		return NO;
	}

	// If we get here, we have cached data

	// If we have cached data, we can use it
	if ([request cachePolicy] & ASIOnlyLoadIfNotCachedCachePolicy) {
		return YES;

	// If we want to fallback to the cache after an error
	} else if ([request complete] && [request cachePolicy] & ASIFallbackToCacheIfLoadFailsCachePolicy) {
		return YES;

	// If we have cached data that is current, we can use it
	} else if ([request cachePolicy] & ASIAskServerIfModifiedWhenStaleCachePolicy) {
		if ([self isCachedDataCurrentForRequest:request]) {
			return YES;
		}

	// If we've got headers from a conditional GET and the cached data is still current, we can use it
	} else if ([request cachePolicy] & ASIAskServerIfModifiedCachePolicy) {
		if (![request responseHeaders]) {
			return NO;
		} else if ([self isCachedDataCurrentForRequest:request]) {
			return YES;
		}
	}
	return NO;
}

@synthesize storagePath;
@synthesize defaultCachePolicy;
@synthesize accessLock;
@synthesize shouldRespectCacheControlHeaders;
@end


================================================
FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIFormDataRequest.h
================================================
//
//  ASIFormDataRequest.h
//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
//
//  Created by Ben Copsey on 07/11/2008.
//  Copyright 2008-2009 All-Seeing Interactive. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ASIHTTPRequest.h"
#import "ASIHTTPRequestConfig.h"

typedef enum _ASIPostFormat {
    ASIMultipartFormDataPostFormat = 0,
    ASIURLEncodedPostFormat = 1
	
} ASIPostFormat;

@interface ASIFormDataRequest : ASIHTTPRequest <NSCopying> {

	// Parameters that will be POSTed to the url
	NSMutableArray *postData;
	
	// Files that will be POSTed to the url
	NSMutableArray *fileData;
	
	ASIPostFormat postFormat;
	
	NSStringEncoding stringEncoding;
	
#if DEBUG_FORM_DATA_REQUEST
	// Will store a string version of the request body that will be printed to the console when ASIHTTPREQUEST_DEBUG is set in GCC_PREPROCESSOR_DEFINITIONS
	NSString *debugBodyString;
#endif
	
}

#pragma mark utilities 
- (NSString*)encodeURL:(NSString *)string; 
 
#pragma mark setup request

// Add a POST variable to the request
- (void)addPostValue:(id <NSObject>)value forKey:(NSString *)key;

// Set a POST variable for this request, clearing any others with the same key
- (void)setPostValue:(id <NSObject>)value forKey:(NSString *)key;

// Add the contents of a local file to the request
- (void)addFile:(NSString *)filePath forKey:(NSString *)key;

// Same as above, but you can specify the content-type and file name
- (void)addFile:(NSString *)filePath withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key;

// Add the contents of a local file to the request, clearing any others with the same key
- (void)setFile:(NSString *)filePath forKey:(NSString *)key;

// Same as above, but you can specify the content-type and file name
- (void)setFile:(NSString *)filePath withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key;

// Add the contents of an NSData object to the request
- (void)addData:(NSData *)data forKey:(NSString *)key;

// Same as above, but you can specify the content-type and file name
- (void)addData:(id)data withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key;

// Add the contents of an NSData object to the request, clearing any others with the same key
- (void)setData:(NSData *)data forKey:(NSString *)key;

// Same as above, but you can specify the content-type and file name
- (void)setData:(id)data withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key;


@property (assign) ASIPostFormat postFormat;
@property (assign) NSStringEncoding stringEncoding;
@end


================================================
FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIFormDataRequest.m
================================================
//
//  ASIFormDataRequest.m
//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
//
//  Created by Ben Copsey on 07/11/2008.
//  Copyright 2008-2009 All-Seeing Interactive. All rights reserved.
//

#import "ASIFormDataRequest.h"


// Private stuff
@interface ASIFormDataRequest ()
- (void)buildMultipartFormDataPostBody;
- (void)buildURLEncodedPostBody;
- (void)appendPostString:(NSString *)string;

@property (retain) NSMutableArray *postData;
@property (retain) NSMutableArray *fileData;

#if DEBUG_FORM_DATA_REQUEST
- (void)addToDebugBody:(NSString *)string;
@property (retain, nonatomic) NSString *debugBodyString;
#endif

@end

@implementation ASIFormDataRequest

#pragma mark utilities
- (NSString*)encodeURL:(NSString *)string
{
	NSString *newString = [NSMakeCollectable(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, CFSTR(":/?#[]@!$ &'()*+,;=\"<>%{}|\\^~`"), CFStringConvertNSStringEncodingToEncoding([self stringEncoding]))) autorelease];
	if (newString) {
		return newString;
	}
	return @"";
}

#pragma mark init / dealloc

+ (id)requestWithURL:(NSURL *)newURL
{
	return [[[self alloc] initWithURL:newURL] autorelease];
}

- (id)initWithURL:(NSURL *)newURL
{
	self = [super initWithURL:newURL];
	[self setPostFormat:ASIURLEncodedPostFormat];
	[self setStringEncoding:NSUTF8StringEncoding];
        [self setRequestMethod:@"POST"];
	return self;
}

- (void)dealloc
{
#if DEBUG_FORM_DATA_REQUEST
	[debugBodyString release]; 
#endif
	
	[postData release];
	[fileData release];
	[super dealloc];
}

#pragma mark setup request

- (void)addPostValue:(id <NSObject>)value forKey:(NSString *)key
{
	if (!key) {
		return;
	}
	if (![self postData]) {
		[self setPostData:[NSMutableArray array]];
	}
	NSMutableDictionary *keyValuePair = [NSMutableDictionary dictionaryWithCapacity:2];
	[keyValuePair setValue:key forKey:@"key"];
	[keyValuePair setValue:[value description] forKey:@"value"];
	[[self postData] addObject:keyValuePair];
}

- (void)setPostValue:(id <NSObject>)value forKey:(NSString *)key
{
	// Remove any existing value
	NSUInteger i;
	for (i=0; i<[[self postData] count]; i++) {
		NSDictionary *val = [[self postData] objectAtIndex:i];
		if ([[val objectForKey:@"key"] isEqualToString:key]) {
			[[self postData] removeObjectAtIndex:i];
			i--;
		}
	}
	[self addPostValue:value forKey:key];
}


- (void)addFile:(NSString *)filePath forKey:(NSString *)key
{
	[self addFile:filePath withFileName:nil andContentType:nil forKey:key];
}

- (void)addFile:(NSString *)filePath withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key
{
	BOOL isDirectory = NO;
	BOOL fileExists = [[[[NSFileManager alloc] init] autorelease] fileExistsAtPath:filePath isDirectory:&isDirectory];
	if (!fileExists || isDirectory) {
		[self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileBuildingRequestType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"No file exists at %@",filePath],NSLocalizedDescriptionKey,nil]]];
	}

	// If the caller didn't specify a custom file name, we'll use the file name of the file we were passed
	if (!fileName) {
		fileName = [filePath lastPathComponent];
	}

	// If we were given the path to a file, and the user didn't specify a mime type, we can detect it from the file extension
	if (!contentType) {
		contentType = [ASIHTTPRequest mimeTypeForFileAtPath:filePath];
	}
	[self addData:filePath withFileName:fileName andContentType:contentType forKey:key];
}

- (void)setFile:(NSString *)filePath forKey:(NSString *)key
{
	[self setFile:filePath withFileName:nil andContentType:nil forKey:key];
}

- (void)setFile:(id)data withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key
{
	// Remove any existing value
	NSUInteger i;
	for (i=0; i<[[self fileData] count]; i++) {
		NSDictionary *val = [[self fileData] objectAtIndex:i];
		if ([[val objectForKey:@"key"] isEqualToString:key]) {
			[[self fileData] removeObjectAtIndex:i];
			i--;
		}
	}
	[self addFile:data withFileName:fileName andContentType:contentType forKey:key];
}

- (void)addData:(NSData *)data forKey:(NSString *)key
{
	[self addData:data withFileName:@"file" andContentType:nil forKey:key];
}

- (void)addData:(id)data withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key
{
	if (![self fileData]) {
		[self setFileData:[NSMutableArray array]];
	}
	if (!contentType) {
		contentType = @"application/octet-stream";
	}

	NSMutableDictionary *fileInfo = [NSMutableDictionary dictionaryWithCapacity:4];
	[fileInfo setValue:key forKey:@"key"];
	[fileInfo setValue:fileName forKey:@"fileName"];
	[fileInfo setValue:contentType forKey:@"contentType"];
	[fileInfo setValue:data forKey:@"data"];

	[[self fileData] addObject:fileInfo];
}

- (void)setData:(NSData *)data forKey:(NSString *)key
{
	[self setData:data withFileName:@"file" andContentType:nil forKey:key];
}

- (void)setData:(id)data withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key
{
	// Remove any existing value
	NSUInteger i;
	for (i=0; i<[[self fileData] count]; i++) {
		NSDictionary *val = [[self fileData] objectAtIndex:i];
		if ([[val objectForKey:@"key"] isEqualToString:key]) {
			[[self fileData] removeObjectAtIndex:i];
			i--;
		}
	}
	[self addData:data withFileName:fileName andContentType:contentType forKey:key];
}

- (void)buildPostBody
{
	if ([self haveBuiltPostBody]) {
		return;
	}
	
#if DEBUG_FORM_DATA_REQUEST
	[self setDebugBodyString:@""];	
#endif
	
	if (![self postData] && ![self fileData]) {
		[super buildPostBody];
		return;
	}	
	if ([[self fileData] count] > 0) {
		[self setShouldStreamPostDataFromDisk:YES];
	}
	
	if ([self postFormat] == ASIURLEncodedPostFormat) {
		[self buildURLEncodedPostBody];
	} else {
		[self buildMultipartFormDataPostBody];
	}

	[super buildPostBody];
	
#if DEBUG_FORM_DATA_REQUEST
	ASI_DEBUG_LOG(@"%@",[self debugBodyString]);
	[self setDebugBodyString:nil];
#endif
}


- (void)buildMultipartFormDataPostBody
{
#if DEBUG_FORM_DATA_REQUEST
	[self addToDebugBody:@"\r\n==== Building a multipart/form-data body ====\r\n"];
#endif
	
	NSString *charset = (NSString *)CFStringConvertEncodingToIANACharSetName(CFStringConvertNSStringEncodingToEncoding([self stringEncoding]));
	
	// We don't bother to check if post data contains the boundary, since it's pretty unlikely that it does.
	CFUUIDRef uuid = CFUUIDCreate(nil);
	NSString *uuidString = [(NSString*)CFUUIDCreateString(nil, uuid) autorelease];
	CFRelease(uuid);
	NSString *stringBoundary = [NSString stringWithFormat:@"0xKhTmLbOuNdArY-%@",uuidString];
	
	[self addRequestHeader:@"Content-Type" value:[NSString stringWithFormat:@"multipart/form-data; charset=%@; boundary=%@", charset, stringBoundary]];
	
	[self appendPostString:[NSString stringWithFormat:@"--%@\r\n",stringBoundary]];
	
	// Adds post data
	NSString *endItemBoundary = [NSString stringWithFormat:@"\r\n--%@\r\n",stringBoundary];
	NSUInteger i=0;
	for (NSDictionary *val in [self postData]) {
		[self appendPostString:[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"\r\n\r\n",[val objectForKey:@"key"]]];
		[self appendPostString:[val objectForKey:@"value"]];
		i++;
		if (i != [[self postData] count] || [[self fileData] count] > 0) { //Only add the boundary if this is not the last item in the post body
			[self appendPostString:endItemBoundary];
		}
	}
	
	// Adds files to upload
	i=0;
	for (NSDictionary *val in [self fileData]) {

		[self appendPostString:[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"; filename=\"%@\"\r\n", [val objectForKey:@"key"], [val objectForKey:@"fileName"]]];
		[self appendPostString:[NSString stringWithFormat:@"Content-Type: %@\r\n\r\n", [val objectForKey:@"contentType"]]];
		
		id data = [val objectForKey:@"data"];
		if ([data isKindOfClass:[NSString class]]) {
			[self appendPostDataFromFile:data];
		} else {
			[self appendPostData:data];
		}
		i++;
		// Only add the boundary if this is not the last item in the post body
		if (i != [[self fileData] count]) { 
			[self appendPostString:endItemBoundary];
		}
	}
	
	[self appendPostString:[NSString stringWithFormat:@"\r\n--%@--\r\n",stringBoundary]];
	
#if DEBUG_FORM_DATA_REQUEST
	[self addToDebugBody:@"==== End of multipart/form-data body ====\r\n"];
#endif
}

- (void)buildURLEncodedPostBody
{

	// We can't post binary data using application/x-www-form-urlencoded
	if ([[self fileData] count] > 0) {
		[self setPostFormat:ASIMultipartFormDataPostFormat];
		[self buildMultipartFormDataPostBody];
		return;
	}
	
#if DEBUG_FORM_DATA_REQUEST
	[self addToDebugBody:@"\r\n==== Building an application/x-www-form-urlencoded body ====\r\n"]; 
#endif
	
	
	NSString *charset = (NSString *)CFStringConvertEncodingToIANACharSetName(CFStringConvertNSStringEncodingToEncoding([self stringEncoding]));

	[self addRequestHeader:@"Content-Type" value:[NSString stringWithFormat:@"application/x-www-form-urlencoded; charset=%@",charset]];

	
	NSUInteger i=0;
	NSUInteger count = [[self postData] count]-1;
	for (NSDictionary *val in [self postData]) {
        NSString *data = [NSString stringWithFormat:@"%@=%@%@", [self encodeURL:[val objectForKey:@"key"]], [self encodeURL:[val objectForKey:@"value"]],(i<count ?  @"&" : @"")]; 
		[self appendPostString:data];
		i++;
	}
#if DEBUG_FORM_DATA_REQUEST
	[self addToDebugBody:@"\r\n==== End of application/x-www-form-urlencoded body ====\r\n"]; 
#endif
}

- (void)appendPostString:(NSString *)string
{
#if DEBUG_FORM_DATA_REQUEST
	[self addToDebugBody:string];
#endif
	[super appendPostData:[string dataUsingEncoding:[self stringEncoding]]];
}

#if DEBUG_FORM_DATA_REQUEST
- (void)appendPostData:(NSData *)data
{
	[self addToDebugBody:[NSString stringWithFormat:@"[%lu bytes of data]",(unsigned long)[data length]]];
	[super appendPostData:data];
}

- (void)appendPostDataFromFile:(NSString *)file
{
	NSError *err = nil;
	unsigned long long fileSize = [[[[[[NSFileManager alloc] init] autorelease] attributesOfItemAtPath:file error:&err] objectForKey:NSFileSize] unsignedLongLongValue];
	if (err) {
		[self addToDebugBody:[NSString stringWithFormat:@"[Error: Failed to obtain the size of the file at '%@']",file]];
	} else {
		[self addToDebugBody:[NSString stringWithFormat:@"[%llu bytes of data from file '%@']",fileSize,file]];
	}

	[super appendPostDataFromFile:file];
}

- (void)addToDebugBody:(NSString *)string
{
	if (string) {
		[self setDebugBodyString:[[self debugBodyString] stringByAppendingString:string]];
	}
}
#endif

#pragma mark NSCopying

- (id)copyWithZone:(NSZone *)zone
{
	ASIFormDataRequest *newRequest = [super copyWithZone:zone];
	[newRequest setPostData:[[[self postData] mutableCopyWithZone:zone] autorelease]];
	[newRequest setFileData:[[[self fileData] mutableCopyWithZone:zone] autorelease]];
	[newRequest setPostFormat:[self postFormat]];
	[newRequest setStringEncoding:[self stringEncoding]];
	[newRequest setRequestMethod:[self requestMethod]];
	return newRequest;
}

@synthesize postData;
@synthesize fileData;
@synthesize postFormat;
@synthesize stringEncoding;
#if DEBUG_FORM_DATA_REQUEST
@synthesize debugBodyString;
#endif
@end


================================================
FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIHTTPRequest.h
================================================
//
//  ASIHTTPRequest.h
//
//  Created by Ben Copsey on 04/10/2007.
//  Copyright 2007-2011 All-Seeing Interactive. All rights reserved.
//
//  A guide to the main features is available at:
//  http://allseeing-i.com/ASIHTTPRequest
//
//  Portions are based on the ImageClient example from Apple:
//  See: http://developer.apple.com/samplecode/ImageClient/listing37.html

#import <Foundation/Foundation.h>
#if TARGET_OS_IPHONE
	#import <CFNetwork/CFNetwork.h>
	#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
	#import <UIKit/UIKit.h> // Necessary for background task support
	#endif
#endif

#import <stdio.h>
#import "ASIHTTPRequestConfig.h"
#import "ASIHTTPRequestDelegate.h"
#import "ASIProgressDelegate.h"
#import "ASICacheDelegate.h"

@class ASIDataDecompressor;

extern NSString *ASIHTTPRequestVersion;

// Make targeting different platforms more reliable
// See: http://www.blumtnwerx.com/blog/2009/06/cross-sdk-code-hygiene-in-xcode/
#ifndef __IPHONE_3_2
	#define __IPHONE_3_2 30200
#endif
#ifndef __IPHONE_4_0
	#define __IPHONE_4_0 40000
#endif
#ifndef __MAC_10_5
	#define __MAC_10_5 1050
#endif
#ifndef __MAC_10_6
	#define __MAC_10_6 1060
#endif

typedef enum _ASIAuthenticationState {
	ASINoAuthenticationNeededYet = 0,
	ASIHTTPAuthenticationNeeded = 1,
	ASIProxyAuthenticationNeeded = 2
} ASIAuthenticationState;

typedef enum _ASINetworkErrorType {
  ASIConnectionFailureErrorType = 1,
  ASIRequestTimedOutErrorType = 2,
  ASIAuthenticationErrorType = 3,
  ASIRequestCancelledErrorType = 4,
  ASIUnableToCreateRequestErrorType = 5,
  ASIInternalErrorWhileBuildingRequestType  = 6,
  ASIInternalErrorWhileApplyingCredentialsType  = 7,
	ASIFileManagementError = 8,
	ASITooMuchRedirectionErrorType = 9,
	ASIUnhandledExceptionError = 10,
	ASICompressionError = 11
	
} ASINetworkErrorType;


// The error domain that all errors generated by ASIHTTPRequest use
extern NSString* const NetworkRequestErrorDomain;

// You can use this number to throttle upload and download bandwidth in iPhone OS apps send or receive a large amount of data
// This may help apps that might otherwise be rejected for inclusion into the app store for using excessive bandwidth
// This number is not official, as far as I know there is no officially documented bandwidth limit
extern unsigned long const ASIWWANBandwidthThrottleAmount;

#if NS_BLOCKS_AVAILABLE
typedef void (^ASIBasicBlock)(void);
typedef void (^ASIHeadersBlock)(NSDictionary *responseHeaders);
typedef void (^ASISizeBlock)(long long size);
typedef void (^ASIProgressBlock)(unsigned long long size, unsigned long long total);
typedef void (^ASIDataBlock)(NSData *data);
#endif

@interface ASIHTTPRequest : NSOperation <NSCopying> {
	
	// The url for this operation, should include GET params in the query string where appropriate
	NSURL *url; 
	
	// Will always contain the original url used for making the request (the value of url can change when a request is redirected)
	NSURL *originalURL;
	
	// Temporarily stores the url we are about to redirect to. Will be nil again when we do redirect
	NSURL *redirectURL;

	// The delegate - will be notified of various changes in state via the ASIHTTPRequestDelegate protocol
	id <ASIHTTPRequestDelegate> delegate;
	
	// Another delegate that is also notified of request status changes and progress updates
	// Generally, you won't use this directly, but ASINetworkQueue sets itself as the queue so it can proxy updates to its own delegates
	// NOTE: WILL BE RETAINED BY THE REQUEST
	id <ASIHTTPRequestDelegate, ASIProgressDelegate> queue;
	
	// HTTP method to use (eg: GET / POST / PUT / DELETE / HEAD etc). Defaults to GET
	NSString *requestMethod;
	
	// Request body - only used when the whole body is stored in memory (shouldStreamPostDataFromDisk is false)
	NSMutableData *postBody;
	
	// gzipped request body used when shouldCompressRequestBody is YES
	NSData *compressedPostBody;
	
	// When true, post body will be streamed from a file on disk, rather than loaded into memory at once (useful for large uploads)
	// Automatically set to true in ASIFormDataRequests when using setFile:forKey:
	BOOL shouldStreamPostDataFromDisk;
	
	// Path to file used to store post body (when shouldStreamPostDataFromDisk is true)
	// You can set this yourself - useful if you want to PUT a file from local disk 
	NSString *postBodyFilePath;
	
	// Path to a temporary file used to store a deflated post body (when shouldCompressPostBody is YES)
	NSString *compressedPostBodyFilePath;
	
	// Set to true when ASIHTTPRequest automatically created a temporary file containing the request body (when true, the file at postBodyFilePath will be deleted at the end of the request)
	BOOL didCreateTemporaryPostDataFile;
	
	// Used when writing to the post body when shouldStreamPostDataFromDisk is true (via appendPostData: or appendPostDataFromFile:)
	NSOutputStream *postBodyWriteStream;
	
	// Used for reading from the post body when sending the request
	NSInputStream *postBodyReadStream;
	
	// Dictionary for custom HTTP request headers
	NSMutableDictionary *requestHeaders;
	
	// Set to YES when the request header dictionary has been populated, used to prevent this happening more than once
	BOOL haveBuiltRequestHeaders;
	
	// Will be populated with HTTP response headers from the server
	NSDictionary *responseHeaders;
	
	// Can be used to manually insert cookie headers to a request, but it's more likely that sessionCookies will do this for you
	NSMutableArray *requestCookies;
	
	// Will be populated with cookies
	NSArray *responseCookies;
	
	// If use useCookiePersistence is true, network requests will present valid cookies from previous requests
	BOOL useCookiePersistence;
	
	// If useKeychainPersistence is true, network requests will attempt to read credentials from the keychain, and will save them in the keychain when they are successfully presented
	BOOL useKeychainPersistence;
	
	// If useSessionPersistence is true, network requests will save credentials and reuse for the duration of the session (until clearSession is called)
	BOOL useSessionPersistence;
	
	// If allowCompressedResponse is true, requests will inform the server they can accept compressed data, and will automatically decompress gzipped responses. Default is true.
	BOOL allowCompressedResponse;
	
	// If shouldCompressRequestBody is true, the request body will be gzipped. Default is false.
	// You will probably need to enable this feature on your webserver to make this work. Tested with apache only.
	BOOL shouldCompressRequestBody;
	
	// When downloadDestinationPath is set, the result of this request will be downloaded to the file at this location
	// If downloadDestinationPath is not set, download data will be stored in memory
	NSString *downloadDestinationPath;
	
	// The location that files will be downloaded to. Once a download is complete, files will be decompressed (if necessary) and moved to downloadDestinationPath
	NSString *temporaryFileDownloadPath;
	
	// If the response is gzipped and shouldWaitToInflateCompressedResponses is NO, a file will be created at this path containing the inflated response as it comes in
	NSString *temporaryUncompressedDataDownloadPath;
	
	// Used for writing data to a file when downloadDestinationPath is set
	NSOutputStream *fileDownloadOutputStream;
	
	NSOutputStream *inflatedFileDownloadOutputStream;
	
	// When the request fails or completes successfully, complete will be true
	BOOL complete;
	
  // external "finished" indicator, subject of KVO notifications; updates after 'complete'
  BOOL finished;
    
  // True if our 'cancel' selector has been called
  BOOL cancelled;
    
	// If an error occurs, error will contain an NSError
	// If error code is = ASIConnectionFailureErrorType (1, Connection failure occurred) - inspect [[error userInfo] objectForKey:NSUnderlyingErrorKey] for more information
	NSError *error;
	
	// Username and password used for authentication
	NSString *username;
	NSString *password;
	
	// User-Agent for this request
	NSString *userAgent;
	
	// Domain used for NTLM authentication
	NSString *domain;
	
	// Username and password used for proxy authentication
	NSString *proxyUsername;
	NSString *proxyPassword;
	
	// Domain used for NTLM proxy authentication
	NSString *proxyDomain;
	
	// Delegate for displaying upload progress (usually an NSProgressIndicator, but you can supply a different object and handle this yourself)
	id <ASIProgressDelegate> uploadProgressDelegate;
	
	// Delegate for displaying download progress (usually an NSProgressIndicator, but you can supply a different object and handle this yourself)
	id <ASIProgressDelegate> downloadProgressDelegate;
	
	// Whether we've seen the headers of the response yet
    BOOL haveExaminedHeaders;
	
	// Data we receive will be stored here. Data may be compressed unless allowCompressedResponse is false - you should use [request responseData] instead in most cases
	NSMutableData *rawResponseData;
	
	// Used for sending and receiving data
    CFHTTPMessageRef request;	
	NSInputStream *readStream;
	
	// Used for authentication
    CFHTTPAuthenticationRef requestAuthentication; 
	NSDictionary *requestCredentials;
	
	// Used during NTLM authentication
	int authenticationRetryCount;
	
	// Authentication scheme (Basic, Digest, NTLM)
	// If you are using Basic authentication and want to force ASIHTTPRequest to send an authorization header without waiting for a 401, you must set this to (NSString *)kCFHTTPAuthenticationSchemeBasic
	NSString *authenticationScheme;
	
	// Realm for authentication when credentials are required
	NSString *authenticationRealm;
	
	// When YES, ASIHTTPRequest will present a dialog allowing users to enter credentials when no-matching credentials were found for a server that requires authentication
	// The dialog will not be shown if your delegate responds to authenticationNeededForRequest:
	// Default is NO.
	BOOL shouldPresentAuthenticationDialog;
	
	// When YES, ASIHTTPRequest will present a dialog allowing users to enter credentials when no-matching credentials were found for a proxy server that requires authentication
	// The dialog will not be shown if your delegate responds to proxyAuthenticationNeededForRequest:
	// Default is YES (basically, because most people won't want the hassle of adding support for authenticating proxies to their apps)
	BOOL shouldPresentProxyAuthenticationDialog;	
	
	// Used for proxy authentication
    CFHTTPAuthenticationRef proxyAuthentication; 
	NSDictionary *proxyCredentials;
	
	// Used during authentication with an NTLM proxy
	int proxyAuthenticationRetryCount;
	
	// Authentication scheme for the proxy (Basic, Digest, NTLM)
	NSString *proxyAuthenticationScheme;	
	
	// Realm for proxy authentication when credentials are required
	NSString *proxyAuthenticationRealm;
	
	// HTTP status code, eg: 200 = OK, 404 = Not found etc
	int responseStatusCode;
	
	// Description of the HTTP status code
	NSString *responseStatusMessage;
	
	// Size of the response
	unsigned long long contentLength;
	
	// Size of the partially downloaded content
	unsigned long long partialDownloadSize;
	
	// Size of the POST payload
	unsigned long long postLength;	
	
	// The total amount of downloaded data
	unsigned long long totalBytesRead;
	
	// The total amount of uploaded data
	unsigned long long totalBytesSent;
	
	// Last amount of data read (used for incrementing progress)
	unsigned long long lastBytesRead;
	
	// Last amount of data sent (used for incrementing progress)
	unsigned long long lastBytesSent;
	
	// This lock prevents the operation from being cancelled at an inopportune moment
	NSRecursiveLock *cancelledLock;
	
	// Called on the delegate (if implemented) when the request starts. Default is requestStarted:
	SEL didStartSelector;
	
	// Called on the delegate (if implemented) when the request receives response headers. Default is request:didReceiveResponseHeaders:
	SEL didReceiveResponseHeadersSelector;

	// Called on the delegate (if implemented) when the request receives a Location header and shouldRedirect is YES
	// The delegate can then change the url if needed, and can restart the request by calling [request redirectToURL:], or simply cancel it
	SEL willRedirectSelector;

	// Called on the delegate (if implemented) when the request completes successfully. Default is requestFinished:
	SEL didFinishSelector;
	
	// Called on the delegate (if implemented) when the request fails. Default is requestFailed:
	SEL didFailSelector;
	
	// Called on the delegate (if implemented) when the request receives data. Default is request:didReceiveData:
	// If you set this and implement the method in your delegate, you must handle the data yourself - ASIHTTPRequest will not populate responseData or write the data to downloadDestinationPath
	SEL didReceiveDataSelector;
	
	// Used for recording when something last happened during the request, we will compare this value with the current date to time out requests when appropriate
	NSDate *lastActivityTime;
	
	// Number of seconds to wait before timing out - default is 10
	NSTimeInterval timeOutSeconds;
	
	// Will be YES when a HEAD request will handle the content-length before this request starts
	BOOL shouldResetUploadProgress;
	BOOL shouldResetDownloadProgress;
	
	// Used by HEAD requests when showAccurateProgress is YES to preset the content-length for this request
	ASIHTTPRequest *mainRequest;
	
	// When NO, this request will only update the progress indicator when it completes
	// When YES, this request will update the progress indicator according to how much data it has received so far
	// The default for requests is YES
	// Also see the comments in ASINetworkQueue.h
	BOOL showAccurateProgress;
	
	// Used to ensure the progress indicator is only incremented once when showAccurateProgress = NO
	BOOL updatedProgress;
	
	// Prevents the body of the post being built more than once (largely for subclasses)
	BOOL haveBuiltPostBody;
	
	// Used internally, may reflect the size of the internal buffer used by CFNetwork
	// POST / PUT operations with body sizes greater than uploadBufferSize will not timeout unless more than uploadBufferSize bytes have been sent
	// Likely to be 32KB on iPhone 3.0, 128KB on Mac OS X Leopard and iPhone 2.2.x
	unsigned long long uploadBufferSize;
	
	// Text encoding for responses that do not send a Content-Type with a charset value. Defaults to NSISOLatin1StringEncoding
	NSStringEncoding defaultResponseEncoding;
	
	// The text encoding of the response, will be defaultResponseEncoding if the server didn't specify. Can't be set.
	NSStringEncoding responseEncoding;
	
	// Tells ASIHTTPRequest not to delete partial downloads, and allows it to use an existing file to resume a download. Defaults to NO.
	BOOL allowResumeForFileDownloads;
	
	// Custom user information associated with the request (not sent to the server)
	NSDictionary *userInfo;
	NSInteger tag;
	
	// Use HTTP 1.0 rather than 1.1 (defaults to false)
	BOOL useHTTPVersionOne;
	
	// When YES, requests will automatically redirect when they get a HTTP 30x header (defaults to YES)
	BOOL shouldRedirect;
	
	// Used internally to tell the main loop we need to stop and retry with a new url
	BOOL needsRedirect;
	
	// Incremented every time this request redirects. When it reaches 5, we give up
	int redirectCount;
	
	// When NO, requests will not check the secure certificate is valid (use for self-signed certificates during development, DO NOT USE IN PRODUCTION) Default is YES
	BOOL validatesSecureCertificate;
    
    // If not nil and the URL scheme is https, CFNetwork configured to supply a client certificate
    SecIdentityRef clientCertificateIdentity;
	NSArray *clientCertificates;
	
	// Details on the proxy to use - you could set these yourself, but it's probably best to let ASIHTTPRequest detect the system proxy settings
	NSString *proxyHost;
	int proxyPort;
	
	// ASIHTTPRequest will assume kCFProxyTypeHTTP if the proxy type could not be automatically determined
	// Set to kCFProxyTypeSOCKS if you are manually configuring a SOCKS proxy
	NSString *proxyType;

	// URL for a PAC (Proxy Auto Configuration) file. If you want to set this yourself, it's probably best if you use a local file
	NSURL *PACurl;
	
	// See ASIAuthenticationState values above. 0 == default == No authentication needed yet
	ASIAuthenticationState authenticationNeeded;
	
	// When YES, ASIHTTPRequests will present credentials from the session store for requests to the same server before being asked for them
	// This avoids an extra round trip for requests after authentication has succeeded, which is much for efficient for authenticated requests with large bodies, or on slower connections
	// Set to NO to only present credentials when explicitly asked for them
	// This only affects credentials stored in the session cache when useSessionPersistence is YES. Credentials from the keychain are never presented unless the server asks for them
	// Default is YES
	// For requests using Basic authentication, set authenticationScheme to (NSString *)kCFHTTPAuthenticationSchemeBasic, and credentials can be sent on the very first request when shouldPresentCredentialsBeforeChallenge is YES
	BOOL shouldPresentCredentialsBeforeChallenge;
	
	// YES when the request hasn't finished yet. Will still be YES even if the request isn't doing anything (eg it's waiting for delegate authentication). READ-ONLY
	BOOL inProgress;
	
	// Used internally to track whether the stream is scheduled on the run loop or not
	// Bandwidth throttling can unschedule the stream to slow things down while a request is in progress
	BOOL readStreamIsScheduled;
	
	// Set to allow a request to automatically retry itself on timeout
	// Default is zero - timeout will stop the request
	int numberOfTimesToRetryOnTimeout;

	// The number of times this request has retried (when numberOfTimesToRetryOnTimeout > 0)
	int retryCount;

	// Temporarily set to YES when a closed connection forces a retry (internally, this stops ASIHTTPRequest cleaning up a temporary post body)
	BOOL willRetryRequest;

	// When YES, requests will keep the connection to the server alive for a while to allow subsequent requests to re-use it for a substantial speed-boost
	// Persistent connections will not be used if the server explicitly closes the connection
	// Default is YES
	BOOL shouldAttemptPersistentConnection;

	// Number of seconds to keep an inactive persistent connection open on the client side
	// Default is 60
	// If we get a keep-alive header, this is this value is replaced with how long the server told us to keep the connection around
	// A future date is created from this and used for expiring the connection, this is stored in connectionInfo's expires value
	NSTimeInterval persistentConnectionTimeoutSeconds;
	
	// Set to yes when an appropriate keep-alive header is found
	BOOL connectionCanBeReused;
	
	// Stores information about the persistent connection that is currently in use.
	// It may contain:
	// * The id we set for a particular connection, incremented every time we want to specify that we need a new connection
	// * The date that connection should expire
	// * A host, port and scheme for the connection. These are used to determine whether that connection can be reused by a subsequent request (all must match the new request)
	// * An id for the request that is currently using the connection. This is used for determining if a connection is available or not (we store a number rather than a reference to the request so we don't need to hang onto a request until the connection expires)
	// * A reference to the stream that is currently using the connection. This is necessary because we need to keep the old stream open until we've opened a new one.
	//   The stream will be closed + released either when another request comes to use the connection, or when the timer fires to tell the connection to expire
	NSMutableDictionary *connectionInfo;
	
	// When set to YES, 301 and 302 automatic redirects will use the original method and and body, according to the HTTP 1.1 standard
	// Default is NO (to follow the behaviour of most browsers)
	BOOL shouldUseRFC2616RedirectBehaviour;
	
	// Used internally to record when a request has finished downloading data
	BOOL downloadComplete;
	
	// An ID that uniquely identifies this request - primarily used for debugging persistent connections
	NSNumber *requestID;
	
	// Will be ASIHTTPRequestRunLoopMode for synchronous requests, NSDefaultRunLoopMode for all other requests
	NSString *runLoopMode;
	
	// This timer checks up on the request every 0.25 seconds, and updates progress
	NSTimer *statusTimer;
	
	// The download cache that will be used for this request (use [ASIHTTPRequest setDefaultCache:cache] to configure a default cache
	id <ASICacheDelegate> downloadCache;
	
	// The cache policy that will be used for this request - See ASICacheDelegate.h for possible values
	ASICachePolicy cachePolicy;
	
	// The cache storage policy that will be used for this request - See ASICacheDelegate.h for possible values
	ASICacheStoragePolicy cacheStoragePolicy;
	
	// Will be true when the response was pulled from the cache rather than downloaded
	BOOL didUseCachedResponse;

	// Set secondsToCache to use a custom time interval for expiring the response when it is stored in a cache
	NSTimeInterval secondsToCache;

	#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
	BOOL shouldContinueWhenAppEntersBackground;
	UIBackgroundTaskIdentifier backgroundTask;
	#endif
	
	// When downloading a gzipped response, the request will use this helper object to inflate the response
	ASIDataDecompressor *dataDecompressor;
	
	// Controls how responses with a gzipped encoding are inflated (decompressed)
	// When set to YES (This is the default):
	// * gzipped responses for requests without a downloadDestinationPath will be inflated only when [request responseData] / [request responseString] is called
	// * gzipped responses for requests with a downloadDestinationPath set will be inflated only when the request completes
	//
	// When set to NO
	// All requests will inflate the response as it comes in
	// * If the request has no downloadDestinationPath set, the raw (compressed) response is discarded and rawResponseData will contain the decompressed response
	// * If the request has a downloadDestinationPath, the raw response will be stored in temporaryFileDownloadPath as normal, the inflated response will be stored in temporaryUncompressedDataDownloadPath
	//   Once the request completes successfully, the contents of temporaryUncompressedDataDownloadPath are moved into downloadDestinationPath
	//
	// Setting this to NO may be especially useful for users using ASIHTTPRequest in conjunction with a streaming parser, as it will allow partial gzipped responses to be inflated and passed on to the parser while the request is still running
	BOOL shouldWaitToInflateCompressedResponses;

	// Will be YES if this is a request created behind the scenes to download a PAC file - these requests do not attempt to configure their own proxies
	BOOL isPACFileRequest;

	// Used for downloading PAC files from http / https webservers
	ASIHTTPRequest *PACFileRequest;

	// Used for asynchronously reading PAC files from file:// URLs
	NSInputStream *PACFileReadStream;

	// Used for storing PAC data from file URLs as it is downloaded
	NSMutableData *PACFileData;

	// Set to YES in startSynchronous. Currently used by proxy detection to download PAC files synchronously when appropriate
	BOOL isSynchronous;

	#if NS_BLOCKS_AVAILABLE
	//block to execute when request starts
	ASIBasicBlock startedBlock;

	//block to execute when headers are received
	ASIHeadersBlock headersReceivedBlock;

	//block to execute when request completes successfully
	ASIBasicBlock completionBlock;

	//block to execute when request fails
	ASIBasicBlock failureBlock;

	//block for when bytes are received
	ASIProgressBlock bytesReceivedBlock;

	//block for when bytes are sent
	ASIProgressBlock bytesSentBlock;

	//block for when download size is incremented
	ASISizeBlock downloadSizeIncrementedBlock;

	//block for when upload size is incremented
	ASISizeBlock uploadSizeIncrementedBlock;

	//block for handling raw bytes received
	ASIDataBlock dataReceivedBlock;

	//block for handling authentication
	ASIBasicBlock authenticationNeededBlock;

	//block for handling proxy authentication
	ASIBasicBlock proxyAuthenticationNeededBlock;
	
    //block for handling redirections, if you want to
    ASIBasicBlock requestRedirectedBlock;
	#endif
}

#pragma mark init / dealloc

// Should be an HTTP or HTTPS url, may include username and password if appropriate
- (id)initWithURL:(NSURL *)newURL;

// Convenience constructor
+ (id)requestWithURL:(NSURL *)newURL;

+ (id)requestWithURL:(NSURL *)newURL usingCache:(id <ASICacheDelegate>)cache;
+ (id)requestWithURL:(NSURL *)newURL usingCache:(id <ASICacheDelegate>)cache andCachePolicy:(ASICachePolicy)policy;

#if NS_BLOCKS_AVAILABLE
- (void)setStartedBlock:(ASIBasicBlock)aStartedBlock;
- (void)setHeadersReceivedBlock:(ASIHeadersBlock)aReceivedBlock;
- (void)setCompletionBlock:(ASIBasicBlock)aCompletionBlock;
- (void)setFailedBlock:(ASIBasicBlock)aFailedBlock;
- (void)setBytesReceivedBlock:(ASIProgressBlock)aBytesReceivedBlock;
- (void)setBytesSentBlock:(ASIProgressBlock)aBytesSentBlock;
- (void)setDownloadSizeIncrementedBlock:(ASISizeBlock) aDownloadSizeIncrementedBlock;
- (void)setUploadSizeIncrementedBlock:(ASISizeBlock) anUploadSizeIncrementedBlock;
- (void)setDataReceivedBlock:(ASIDataBlock)aReceivedBlock;
- (void)setAuthenticationNeededBlock:(ASIBasicBlock)anAuthenticationBlock;
- (void)setProxyAuthenticationNeededBlock:(ASIBasicBlock)aProxyAuthenticationBlock;
- (void)setRequestRedirectedBlock:(ASIBasicBlock)aRedirectBlock;
#endif

#pragma mark setup request

// Add a custom header to the request
- (void)addRequestHeader:(NSString *)header value:(NSString *)value;

// Called during buildRequestHeaders and after a redirect to create a cookie header from request cookies and the global store
- (void)applyCookieHeader;

// Populate the request headers dictionary. Called before a request is started, or by a HEAD request that needs to borrow them
- (void)buildRequestHeaders;

// Used to apply authorization header to a request before it is sent (when shouldPresentCredentialsBeforeChallenge is YES)
- (void)applyAuthorizationHeader;


// Create the post body
- (void)buildPostBody;

// Called to add data to the post body. Will append to postBody when shouldStreamPostDataFromDisk is false, or write to postBodyWriteStream when true
- (void)appendPostData:(NSData *)data;
- (void)appendPostDataFromFile:(NSString *)file;

#pragma mark get information about this request

// Returns the contents of the result as an NSString (not appropriate for binary data - used responseData instead)
- (NSString *)responseString;

// Response data, automatically uncompressed where appropriate
- (NSData *)responseData;

// Returns true if the response was gzip compressed
- (BOOL)isResponseCompressed;

#pragma mark running a request


// Run a request synchronously, and return control when the request completes or fails
- (void)startSynchronous;

// Run request in the background
- (void)startAsynchronous;

// Clears all delegates and blocks, then cancels the request
- (void)clearDelegatesAndCancel;

#pragma mark HEAD request

// Used by ASINetworkQueue to create a HEAD request appropriate for this request with the same headers (though you can use it yourself)
- (ASIHTTPRequest *)HEADRequest;

#pragma mark upload/download progress

// Called approximately every 0.25 seconds to update the progress delegates
- (void)updateProgressIndicators;

// Updates upload progress (notifies the queue and/or uploadProgressDelegate of this request)
- (void)updateUploadProgress;

// Updates download progress (notifies the queue and/or uploadProgressDelegate of this request)
- (void)updateDownloadProgress;

// Called when authorisation is needed, as we only find out we don't have permission to something when the upload is complete
- (void)removeUploadProgressSoFar;

// Called when we get a content-length header and shouldResetDownloadProgress is true
- (void)incrementDownloadSizeBy:(long long)length;

// Called when a request starts and shouldResetUploadProgress is true
// Also called (with a negative length) to remove the size of the underlying buffer used for uploading
- (void)incrementUploadSizeBy:(long long)length;

// Helper method for interacting with progress indicators to abstract the details of different APIS (NSProgressIndicator and UIProgressView)
+ (void)updateProgressIndicator:(id *)indicator withProgress:(unsigned long long)progress ofTotal:(unsigned long long)total;

// Helper method used for performing invocations on the main thread (used for progress)
+ (void)performSelector:(SEL)selector onTarget:(id *)target withObject:(id)object amount:(void *)amount callerToRetain:(id)caller;

#pragma mark talking to delegates

// Called when a request starts, lets the delegate know via didStartSelector
- (void)requestStarted;

// Called when a request receives response headers, lets the delegate know via didReceiveResponseHeadersSelector
- (void)requestReceivedResponseHeaders:(NSDictionary *)newHeaders;

// Called when a request completes successfully, lets the delegate know via didFinishSelector
- (void)requestFinished;

// Called when a request fails, and lets the delegate know via didFailSelector
- (void)failWithError:(NSError *)theError;

// Called to retry our request when our persistent connection is closed
// Returns YES if we haven't already retried, and connection will be restarted
// Otherwise, returns NO, and nothing will happen
- (BOOL)retryUsingNewConnection;

// Can be called by delegates from inside their willRedirectSelector implementations to restart the request with a new url
- (void)redirectToURL:(NSURL *)newURL;

#pragma mark parsing HTTP response headers

// Reads the response headers to find the content length, encoding, cookies for the session 
// Also initiates request redirection when shouldRedirect is true
// And works out if HTTP auth is required
- (void)readResponseHeaders;

// Attempts to set the correct encoding by looking at the Content-Type header, if this is one
- (void)parseStringEncodingFromHeaders;

+ (void)parseMimeType:(NSString **)mimeType andResponseEncoding:(NSStringEncoding *)stringEncoding fromContentType:(NSString *)contentType;

#pragma mark http authentication stuff

// Apply credentials to this request
- (BOOL)applyCredentials:(NSDictionary *)newCredentials;
- (BOOL)applyProxyCredentials:(NSDictionary *)newCredentials;

// Attempt to obtain credentials for this request from the URL, username and password or keychain
- (NSMutableDictionary *)findCredentials;
- (NSMutableDictionary *)findProxyCredentials;

// Unlock (unpause) the request thread so it can resume the request
// Should be called by delegates when they have populated the authentication information after an authentication challenge
- (void)retryUsingSuppliedCredentials;

// Should be called by delegates when they wish to cancel authentication and stop
- (void)cancelAuthentication;

// Apply authentication information and resume the request after an authentication challenge
- (void)attemptToApplyCredentialsAndResume;
- (void)attemptToApplyProxyCredentialsAndResume;

// Attempt to show the built-in authentication dialog, returns YES if credentials were supplied, NO if user cancelled dialog / dialog is disabled / running on main thread
// Currently only used on iPhone OS
- (BOOL)showProxyAuthenticationDialog;
- (BOOL)showAuthenticationDialog;

// Construct a basic authentication header from the username and password supplied, and add it to the request headers
// Used when shouldPresentCredentialsBeforeChallenge is YES
- (void)addBasicAuthenticationHeaderWithUsername:(NSString *)theUsername andPassword:(NSString *)thePassword;

#pragma mark stream status handlers

// CFnetwork event handlers
- (void)handleNetworkEvent:(CFStreamEventType)type;
- (void)handleBytesAvailable;
- (void)handleStreamComplete;
- (void)handleStreamError;

#pragma mark cleanup

// Cleans up and lets the queue know this operation is finished.
// Appears in this header for subclassing only, do not call this method from outside your request!
- (void)markAsFinished;

// Cleans up temporary files. There's normally no reason to call these yourself, they are called automatically when a request completes or fails

// Clean up the temporary file used to store the downloaded data when it comes in (if downloadDestinationPath is set)
- (BOOL)removeTemporaryDownloadFile;

// Clean up the temporary file used to store data that is inflated (decompressed) as it comes in
- (BOOL)removeTemporaryUncompressedDownloadFile;

// Clean up the temporary file used to store the request body (when shouldStreamPostDataFromDisk is YES)
- (BOOL)removeTemporaryUploadFile;

// Clean up the temporary file used to store a deflated (compressed) request body when shouldStreamPostDataFromDisk is YES
- (BOOL)removeTemporaryCompressedUploadFile;

// Remove a file on disk, returning NO and populating the passed error pointer if it fails
+ (BOOL)removeFileAtPath:(NSString *)path error:(NSError **)err;

#pragma mark persistent connections

// Get the ID of the connection this request used (only really useful in tests and debugging)
- (NSNumber *)connectionID;

// Called automatically when a request is started to clean up any persistent connections that have expired
+ (void)expirePersistentConnections;

#pragma mark default time out

+ (NSTimeInterval)defaultTimeOutSeconds;
+ (void)setDefaultTimeOutSeconds:(NSTimeInterval)newTimeOutSeconds;

#pragma mark client certificate

- (void)setClientCertificateIdentity:(SecIdentityRef)anIdentity;

#pragma mark session credentials

+ (NSMutableArray *)sessionProxyCredentialsStore;
+ (NSMutableArray *)sessionCredentialsStore;

+ (void)storeProxyAuthenticationCredentialsInSessionStore:(NSDictionary *)credentials;
+ (void)storeAuthenticationCredentialsInSessionStore:(NSDictionary *)credentials;

+ (void)removeProxyAuthenticationCredentialsFromSessionStore:(NSDictionary *)credentials;
+ (void)removeAuthenticationCredentialsFromSessionStore:(NSDictionary *)credentials;

- (NSDictionary *)findSessionProxyAuthenticationCredentials;
- (NSDictionary *)findSessionAuthenticationCredentials;

#pragma mark keychain storage

// Save credentials for this request to the keychain
- (void)saveCredentialsToKeychain:(NSDictionary *)newCredentials;

// Save credentials to the keychain
+ (void)saveCredentials:(NSURLCredential *)credentials forHost:(NSString *)host port:(int)port protocol:(NSString *)protocol realm:(NSString *)realm;
+ (void)saveCredentials:(NSURLCredential *)credentials forProxy:(NSString *)host port:(int)port realm:(NSString *)realm;

// Return credentials from the keychain
+ (NSURLCredential *)savedCredentialsForHost:(NSString *)host port:(int)port protocol:(NSString *)protocol realm:(NSString *)realm;
+ (NSURLCredential *)savedCredentialsForProxy:(NSString *)host port:(int)port protocol:(NSString *)protocol realm:(NSString *)realm;

// Remove credentials from the keychain
+ (void)removeCredentialsForHost:(NSString *)host port:(int)port protocol:(NSString *)protocol realm:(NSString *)realm;
+ (void)removeCredentialsForProxy:(NSString *)host port:(int)port realm:(NSString *)realm;

// We keep track of any cookies we accept, so that we can remove them from the persistent store later
+ (void)setSessionCookies:(NSMutableArray *)newSessionCookies;
+ (NSMutableArray *)sessionCookies;

// Adds a cookie to our list of cookies we've accepted, checking first for an old version of the same cookie and removing that
+ (void)addSessionCookie:(NSHTTPCookie *)newCookie;

// Dump all session data (authentication and cookies)
+ (void)clearSession;

#pragma mark get user agent

// Will be used as a user agent if requests do not specify a custom user agent
// Is only used when you have specified a Bundle Display Name (CFDisplayBundleName) or Bundle Name (CFBundleName) in your plist
+ (NSString *)defaultUserAgentString;
+ (void)setDefaultUserAgentString:(NSString *)agent;

#pragma mark mime-type detection

// Return the mime type for a file
+ (NSString *)mimeTypeForFileAtPath:(NSString *)path;

#pragma mark bandwidth measurement / throttling

// The maximum number of bytes ALL requests can send / receive in a second
// This is a rough figure. The actual amount used will be slightly more, this does not include HTTP headers
+ (unsigned long)maxBandwidthPerSecond;
+ (void)setMaxBandwidthPerSecond:(unsigned long)bytes;

// Get a rough average (for the last 5 seconds) of how much bandwidth is being used, in bytes
+ (unsigned long)averageBandwidthUsedPerSecond;

- (void)performThrottling;

// Will return YES is bandwidth throttling is currently in use
+ (BOOL)isBandwidthThrottled;

// Used internally to record bandwidth use, and by ASIInputStreams when uploading. It's probably best if you don't mess with this.
+ (void)incrementBandwidthUsedInLastSecond:(unsigned long)bytes;

// On iPhone, ASIHTTPRequest can automatically turn throttling on and off as the connection type changes between WWAN and WiFi

#if TARGET_OS_IPHONE
// Set to YES to automatically turn on throttling when WWAN is connected, and automatically turn it off when it isn't
+ (void)setShouldThrottleBandwidthForWWAN:(BOOL)throttle;

// Turns on throttling automatically when WWAN is connected using a custom limit, and turns it off automatically when it isn't
+ (void)throttleBandwidthForWWANUsingLimit:(unsigned long)limit;

#pragma mark reachability

// Returns YES when an iPhone OS device is connected via WWAN, false when connected via WIFI or not connected
+ (BOOL)isNetworkReachableViaWWAN;

#endif

#pragma mark queue

// Returns the shared queue
+ (NSOperationQueue *)sharedQueue;

#pragma mark cache

+ (void)setDefaultCache:(id <ASICacheDelegate>)cache;
+ (id <ASICacheDelegate>)defaultCache;

// Returns the maximum amount of data we can read as part of the current measurement period, and sleeps this thread if our allowance is used up
+ (unsigned long)maxUploadReadLength;

#pragma mark network activity

+ (BOOL)isNetworkInUse;

+ (void)setShouldUpdateNetworkActivityIndicator:(BOOL)shouldUpdate;

// Shows the network activity spinner thing on iOS. You may wish to override this to do something else in Mac projects
+ (void)showNetworkActivityIndicator;

// Hides the network activity spinner thing on iOS
+ (void)hideNetworkActivityIndicator;

#pragma mark miscellany

// Used for generating Authorization header when using basic authentication when shouldPresentCredentialsBeforeChallenge is true
// And also by ASIS3Request
+ (NSString *)base64forData:(NSData *)theData;

// Returns the expiration date for the request.
// Calculated from the Expires response header property, unless maxAge is non-zero or
// there exists a non-zero max-age property in the Cache-Control response header.
+ (NSDate *)expiryDateForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge;

// Returns a date from a string in RFC1123 format
+ (NSDate *)dateFromRFC1123String:(NSString *)string;


// Used for detecting multitasking support at runtime (for backgrounding requests)
#if TARGET_OS_IPHONE
+ (BOOL)isMultitaskingSupported;
#endif

#pragma mark threading behaviour

// In the default implementation, all requests run in a single background thread
// Advanced users only: Override this method in a subclass for a different threading behaviour
// Eg: return [NSThread mainThread] to run all requests in the main thread
// Alternatively, you can create a thread on demand, or manage a pool of threads
// Threads returned by this method will need to run the runloop in default mode (eg CFRunLoopRun())
// Requests will stop the runloop when they complete
// If you have multiple requests sharing the thread you'll need to restart the runloop when this happens
+ (NSThread *)threadForRequest:(ASIHTTPRequest *)request;


#pragma mark ===

@property (retain) NSString *username;
@property (retain) NSString *password;
@property (retain) NSString *userAgent;
@property (retain) NSString *domain;

@property (retain) NSString *proxyUsername;
@property (retain) NSString *proxyPassword;
@property (retain) NSString *proxyDomain;

@property (retain) NSString *proxyHost;
@property (assign) int proxyPort;
@property (retain) NSString *proxyType;

@property (retain,setter=setURL:, nonatomic) NSURL *url;
@property (retain) NSURL *originalURL;
@property (assign, nonatomic) id delegate;
@property (retain, nonatomic) id queue;
@property (assign, nonatomic) id uploadProgressDelegate;
@property (assign, nonatomic) id downloadProgressDelegate;
@property (assign) BOOL useKeychainPersistence;
@property (assign) BOOL useSessionPersistence;
@property (retain) NSString *downloadDestinationPath;
@property (retain) NSString *temporaryFileDownloadPath;
@property (retain) NSString *temporaryUncompressedDataDownloadPath;
@property (assign) SEL didStartSelector;
@property (assign) SEL didReceiveResponseHeadersSelector;
@property (assign) SEL willRedirectSelector;
@property (assign) SEL didFinishSelector;
@property (assign) SEL didFailSelector;
@property (assign) SEL didReceiveDataSelector;
@property (retain,readonly) NSString *authenticationRealm;
@property (retain,readonly) NSString *proxyAuthenticationRealm;
@property (retain) NSError *error;
@property (assign,readonly) BOOL complete;
@property (retain) NSDictionary *responseHeaders;
@property (retain) NSMutableDictionary *requestHeaders;
@property (retain) NSMutableArray *requestCookies;
@property (retain,readonly) NSArray *responseCookies;
@property (assign) BOOL useCookiePersistence;
@property (retain) NSDictionary *requestCredentials;
@property (retain) NSDictionary *proxyCredentials;
@property (assign,readonly) int responseStatusCode;
@property (retain,readonly) NSString *responseStatusMessage;
@property (retain) NSMutableData *rawResponseData;
@property (assign) NSTimeInterval timeOutSeconds;
@property (retain, nonatomic) NSString *requestMethod;
@property (retain) NSMutableData *postBody;
@property (assign) unsigned long long contentLength;
@property (assign) unsigned long long postLength;
@property (assign) BOOL shouldResetDownloadProgress;
@property (assign) BOOL shouldResetUploadProgress;
@property (assign) ASIHTTPRequest *mainRequest;
@property (assign) BOOL showAccurateProgress;
@property (assign) unsigned long long totalBytesRead;
@property (assign) unsigned long long totalBytesSent;
@property (assign) NSStringEncoding defaultResponseEncoding;
@property (assign) NSStringEncoding responseEncoding;
@property (assign) BOOL allowCompressedResponse;
@property (assign) BOOL allowResumeForFileDownloads;
@property (retain) NSDictionary *userInfo;
@property (assign) NSInteger tag;
@property (retain) NSString *postBodyFilePath;
@property (assign) BOOL shouldStreamPostDataFromDisk;
@property (assign) BOOL didCreateTemporaryPostDataFile;
@property (assign) BOOL useHTTPVersionOne;
@property (assign, readonly) unsigned long long partialDownloadSize;
@property (assign) BOOL shouldRedirect;
@property (assign) BOOL validatesSecureCertificate;
@property (assign) BOOL shouldCompressRequestBody;
@property (retain) NSURL *PACurl;
@property (retain) NSString *authenticationScheme;
@property (retain) NSString *proxyAuthenticationScheme;
@property (assign) BOOL shouldPresentAuthenticationDialog;
@property (assign) BOOL shouldPresentProxyAuthenticationDialog;
@property (assign, readonly) ASIAuthenticationState authenticationNeeded;
@property (assign) BOOL shouldPresentCredentialsBeforeChallenge;
@property (assign, readonly) int authenticationRetryCount;
@property (assign, readonly) int proxyAuthenticationRetryCount;
@property (assign) BOOL haveBuiltRequestHeaders;
@property (assign, nonatomic) BOOL haveBuiltPostBody;
@property (assign, readonly) BOOL inProgress;
@property (assign) int numberOfTimesToRetryOnTimeout;
@property (assign, readonly) int retryCount;
@property (assign) BOOL shouldAttemptPersistentConnection;
@property (assign) NSTimeInterval persistentConnectionTimeoutSeconds;
@property (assign) BOOL shouldUseRFC2616RedirectBehaviour;
@property (assign, readonly) BOOL connectionCanBeReused;
@property (retain, readonly) NSNumber *requestID;
@property (assign) id <ASICacheDelegate> downloadCache;
@property (assign) ASICachePolicy cachePolicy;
@property (assign) ASICacheStoragePolicy cacheStoragePolicy;
@property (assign, readonly) BOOL didUseCachedResponse;
@property (assign) NSTimeInterval secondsToCache;
@property (retain) NSArray *clientCertificates;
#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
@property (assign) BOOL shouldContinueWhenAppEntersBackground;
#endif
@property (retain) ASIDataDecompressor *dataDecompressor;
@property (assign) BOOL shouldWaitToInflateCompressedResponses;

@end


================================================
FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIHTTPRequest.m
================================================
//
//  ASIHTTPRequest.m
//
//  Created by Ben Copsey on 04/10/2007.
//  Copyright 2007-2011 All-Seeing Interactive. All rights reserved.
//
//  A guide to the main features is available at:
//  http://allseeing-i.com/ASIHTTPRequest
//
//  Portions are based on the ImageClient example from Apple:
//  See: http://developer.apple.com/samplecode/ImageClient/listing37.html

#import "ASIHTTPRequest.h"

#if TARGET_OS_IPHONE
#import "Reachability.h"
#import "ASIAuthenticationDialog.h"
#import <MobileCoreServices/MobileCoreServices.h>
#else
#import <SystemConfiguration/SystemConfiguration.h>
#endif
#import "ASIInputStream.h"
#import "ASIDataDecompressor.h"
#import "ASIDataCompressor.h"

// Automatically set on build
NSString *ASIHTTPRequestVersion = @"v1.8.1-61 2011-09-19";

static NSString *defaultUserAgent = nil;

NSString* const NetworkRequestErrorDomain = @"ASIHTTPRequestErrorDomain";

static NSString *ASIHTTPRequestRunLoopMode = @"ASIHTTPRequestRunLoopMode";

static const CFOptionFlags kNetworkEvents =  kCFStreamEventHasBytesAvailable | kCFStreamEventEndEncountered | kCFStreamEventErrorOccurred;

// In memory caches of credentials, used on when useSessionPersistence is YES
static NSMutableArray *sessionCredentialsStore = nil;
static NSMutableArray *sessionProxyCredentialsStore = nil;

// This lock mediates access to session credentials
static NSRecursiveLock *sessionCredentialsLock = nil;

// We keep track of cookies we have received here so we can remove them from the sharedHTTPCookieStorage later
static NSMutableArray *sessionCookies = nil;

// The number of times we will allow requests to redirect before we fail with a redirection error
const int RedirectionLimit = 5;

// The default number of seconds to use for a timeout
static NSTimeInterval defaultTimeOutSeconds = 10;

static void ReadStreamClientCallBack(CFReadStreamRef readStream, CFStreamEventType type, void *clientCallBackInfo) {
    [((ASIHTTPRequest*)clientCallBackInfo) handleNetworkEvent: type];
}

// This lock prevents the operation from being cancelled while it is trying to update the progress, and vice versa
static NSRecursiveLock *progressLock;

static NSError *ASIRequestCancelledError;
static NSError *ASIRequestTimedOutError;
static NSError *ASIAuthenticationError;
static NSError *ASIUnableToCreateRequestError;
static NSError *ASITooMuchRedirectionError;

static NSMutableArray *bandwidthUsageTracker = nil;
static unsigned long averageBandwidthUsedPerSecond = 0;

// These are used for queuing persistent connections on the same connection

// Incremented every time we specify we want a new connection
static unsigned int nextConnectionNumberToCreate = 0;

// An array of connectionInfo dictionaries.
// When attempting a persistent connection, we look here to try to find an existing connection to the same server that is currently not in use
static NSMutableArray *persistentConnectionsPool = nil;

// Mediates access to the persistent connections pool
static NSRecursiveLock *connectionsLock = nil;

// Each request gets a new id, we store this rather than a ref to the request itself in the connectionInfo dictionary.
// We do this so we don't have to keep the request around while we wait for the connection to expire
static unsigned int nextRequestID = 0;

// Records how much bandwidth all requests combined have used in the last second
static unsigned long bandwidthUsedInLastSecond = 0; 

// A date one second in the future from the time it was created
static NSDate *bandwidthMeasurementDate = nil;

// Since throttling variables are shared among all requests, we'll use a lock to mediate access
static NSLock *bandwidthThrottlingLock = nil;

// the maximum number of bytes that can be transmitted in one second
static unsigned long maxBandwidthPerSecond = 0;

// A default figure for throttling bandwidth on mobile devices
unsigned long const ASIWWANBandwidthThrottleAmount = 14800;

#if TARGET_OS_IPHONE
// YES when bandwidth throttling is active
// This flag does not denote whether throttling is turned on - rather whether it is currently in use
// It will be set to NO when throttling was turned on with setShouldThrottleBandwidthForWWAN, but a WI-FI connection is active
static BOOL isBandwidthThrottled = NO;

// When YES, bandwidth will be automatically throttled when using WWAN (3G/Edge/GPRS)
// Wifi will not be throttled
static BOOL shouldThrottleBandwidthForWWANOnly = NO;
#endif

// Mediates access to the session cookies so requests
static NSRecursiveLock *sessionCookiesLock = nil;

// This lock ensures delegates only receive one notification that authentication is required at once
// When using ASIAuthenticationDialogs, it also ensures only one dialog is shown at once
// If a request can't acquire the lock immediately, it means a dialog is being shown or a delegate is handling the authentication challenge
// Once it gets the lock, it will try to look for existing credentials again rather than showing the dialog / notifying the delegate
// This is so it can make use of any credentials supplied for the other request, if they are appropriate
static NSRecursiveLock *delegateAuthenticationLock = nil;

// When throttling bandwidth, Set to a date in future that we will allow all requests to wake up and reschedule their streams
static NSDate *throttleWakeUpTime = nil;

static id <ASICacheDelegate> defaultCache = nil;

// Used for tracking when requests are using the network
static unsigned int runningRequestCount = 0;

// You can use [ASIHTTPRequest setShouldUpdateNetworkActivityIndicator:NO] if you want to manage it yourself
// Alternatively, override showNetworkActivityIndicator / hideNetworkActivityIndicator
// By default this does nothing on Mac OS X, but again override the above methods for a different behaviour
static BOOL shouldUpdateNetworkActivityIndicator = YES;

// The thread all requests will run on
// Hangs around forever, but will be blocked unless there are requests underway
static NSThread *networkThread = nil;

static NSOperationQueue *sharedQueue = nil;

// Private stuff
@interface ASIHTTPRequest ()

- (void)cancelLoad;

- (void)destroyReadStream;
- (void)scheduleReadStream;
- (void)unscheduleReadStream;

- (BOOL)willAskDelegateForCredentials;
- (BOOL)willAskDelegateForProxyCredentials;
- (void)askDelegateForProxyCredentials;
- (void)askDelegateForCredentials;
- (void)failAuthentication;

+ (void)measureBandwidthUsage;
+ (void)recordBandwidthUsage;

- (void)startRequest;
- (void)updateStatus:(NSTimer *)timer;
- (void)checkRequestStatus;
- (void)reportFailure;
- (void)reportFinished;
- (void)markAsFinished;
- (void)performRedirect;
- (BOOL)shouldTimeOut;
- (BOOL)willRedirect;
- (BOOL)willAskDelegateToConfirmRedirect;

+ (void)performInvocation:(NSInvocation *)invocation onTarget:(id *)target releasingObject:(id)objectToRelease;
+ (void)hideNetworkActivityIndicatorAfterDelay;
+ (void)hideNetworkActivityIndicatorIfNeeeded;
+ (void)runRequests;

// Handling Proxy autodetection and PAC file downloads
- (BOOL)configureProxies;
- (void)fetchPACFile;
- (void)finishedDownloadingPACFile:(ASIHTTPRequest *)theRequest;
- (void)runPACScript:(NSString *)script;
- (void)timeOutPACRead;

- (void)useDataFromCache;

// Called to update the size of a partial download when starting a request, or retrying after a timeout
- (void)updatePartialDownloadSize;

#if TARGET_OS_IPHONE
+ (void)registerForNetworkReachabilityNotifications;
+ (void)unsubscribeFromNetworkReachabilityNotifications;
// Called when the status of the network changes
+ (void)reachabilityChanged:(NSNotification *)note;
#endif

#if NS_BLOCKS_AVAILABLE
- (void)performBlockOnMainThread:(ASIBasicBlock)block;
- (void)releaseBlocksOnMainThread;
+ (void)releaseBlocks:(NSArray *)blocks;
- (void)callBlock:(ASIBasicBlock)block;
#endif





@property (assign) BOOL complete;
@property (retain) NSArray *responseCookies;
@property (assign) int responseStatusCode;
@property (retain, nonatomic) NSDate *lastActivityTime;

@property (assign) unsigned long long partialDownloadSize;
@property (assign, nonatomic) unsigned long long uploadBufferSize;
@property (retain, nonatomic) NSOutputStream *postBodyWriteStream;
@property (retain, nonatomic) NSInputStream *postBodyReadStream;
@property (assign, nonatomic) unsigned long long lastBytesRead;
@property (assign, nonatomic) unsigned long long lastBytesSent;
@property (retain) NSRecursiveLock *cancelledLock;
@property (retain, nonatomic) NSOutputStream *fileDownloadOutputStream;
@property (retain, nonatomic) NSOutputStream *inflatedFileDownloadOutputStream;
@property (assign) int authenticationRetryCount;
@property (assign) int proxyAuthenticationRetryCount;
@property (assign, nonatomic) BOOL updatedProgress;
@property (assign, nonatomic) BOOL needsRedirect;
@property (assign, nonatomic) int redirectCount;
@property (retain, nonatomic) NSData *compressedPostBody;
@property (retain, nonatomic) NSString *compressedPostBodyFilePath;
@property (retain) NSString *authenticationRealm;
@property (retain) NSString *proxyAuthenticationRealm;
@property (retain) NSString *responseStatusMessage;
@property (assign) BOOL inProgress;
@property (assign) int retryCount;
@property (assign) BOOL willRetryRequest;
@property (assign) BOOL connectionCanBeReused;
@property (retain, nonatomic) NSMutableDictionary *connectionInfo;
@property (retain, nonatomic) NSInputStream *readStream;
@property (assign) ASIAuthenticationState authenticationNeeded;
@property (assign, nonatomic) BOOL readStreamIsScheduled;
@property (assign, nonatomic) BOOL downloadComplete;
@property (retain) NSNumber *requestID;
@property (assign, nonatomic) NSString *runLoopMode;
@property (retain, nonatomic) NSTimer *statusTimer;
@property (assign) BOOL didUseCachedResponse;
@property (retain, nonatomic) NSURL *redirectURL;

@property (assign, nonatomic) BOOL isPACFileRequest;
@property (retain, nonatomic) ASIHTTPRequest *PACFileRequest;
@property (retain, nonatomic) NSInputStream *PACFileReadStream;
@property (retain, nonatomic) NSMutableData *PACFileData;

@property (assign, nonatomic, setter=setSynchronous:) BOOL isSynchronous;
@end


@implementation ASIHTTPRequest

#pragma mark init / dealloc

+ (void)initialize
{
	if (self == [ASIHTTPRequest class]) {
		persistentConnectionsPool = [[NSMutableArray alloc] init];
		connectionsLock = [[NSRecursiveLock alloc] init];
		progressLock = [[NSRecursiveLock alloc] init];
		bandwidthThrottlingLock = [[NSLock alloc] init];
		sessionCookiesLock = [[NSRecursiveLock alloc] init];
		sessionCredentialsLock = [[NSRecursiveLock alloc] init];
		delegateAuthenticationLock = [[NSRecursiveLock alloc] init];
		bandwidthUsageTracker = [[NSMutableArray alloc] initWithCapacity:5];
		ASIRequestTimedOutError = [[NSError alloc] initWithDomain:NetworkRequestErrorDomain code:ASIRequestTimedOutErrorType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"The request timed out",NSLocalizedDescriptionKey,nil]];  
		ASIAuthenticationError = [[NSError alloc] initWithDomain:NetworkRequestErrorDomain code:ASIAuthenticationErrorType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Authentication needed",NSLocalizedDescriptionKey,nil]];
		ASIRequestCancelledError = [[NSError alloc] initWithDomain:NetworkRequestErrorDomain code:ASIRequestCancelledErrorType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"The request was cancelled",NSLocalizedDescriptionKey,nil]];
		ASIUnableToCreateRequestError = [[NSError alloc] initWithDomain:NetworkRequestErrorDomain code:ASIUnableToCreateRequestErrorType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Unable to create request (bad url?)",NSLocalizedDescriptionKey,nil]];
		ASITooMuchRedirectionError = [[NSError alloc] initWithDomain:NetworkRequestErrorDomain code:ASITooMuchRedirectionErrorType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"The request failed because it redirected too many times",NSLocalizedDescriptionKey,nil]];
		sharedQueue = [[NSOperationQueue alloc] init];
		[sharedQueue setMaxConcurrentOperationCount:4];

	}
}


- (id)initWithURL:(NSURL *)newURL
{
	self = [self init];
	[self setRequestMethod:@"GET"];

	[self setRunLoopMode:NSDefaultRunLoopMode];
	[self setShouldAttemptPersistentConnection:YES];
	[self setPersistentConnectionTimeoutSeconds:60.0];
	[self setShouldPresentCredentialsBeforeChallenge:YES];
	[self setShouldRedirect:YES];
	[self setShowAccurateProgress:YES];
	[self setShouldResetDownloadProgress:YES];
	[self setShouldResetUploadProgress:YES];
	[self setAllowCompressedResponse:YES];
	[self setShouldWaitToInflateCompressedResponses:YES];
	[self setDefaultResponseEncoding:NSISOLatin1StringEncoding];
	[self setShouldPresentProxyAuthenticationDialog:YES];
	
	[self setTimeOutSeconds:[ASIHTTPRequest defaultTimeOutSeconds]];
	[self setUseSessionPersistence:YES];
	[self setUseCookiePersistence:YES];
	[self setValidatesSecureCertificate:YES];
	[self setRequestCookies:[[[NSMutableArray alloc] init] autorelease]];
	[self setDidStartSelector:@selector(requestStarted:)];
	[self setDidReceiveResponseHeadersSelector:@selector(request:didReceiveResponseHeaders:)];
	[self setWillRedirectSelector:@selector(request:willRedirectToURL:)];
	[self setDidFinishSelector:@selector(requestFinished:)];
	[self setDidFailSelector:@selector(requestFailed:)];
	[self setDidReceiveDataSelector:@selector(request:didReceiveData:)];
	[self setURL:newURL];
	[self setCancelledLock:[[[NSRecursiveLock alloc] init] autorelease]];
	[self setDownloadCache:[[self class] defaultCache]];
	return self;
}

+ (id)requestWithURL:(NSURL *)newURL
{
	return [[[self alloc] initWithURL:newURL] autorelease];
}

+ (id)requestWithURL:(NSURL *)newURL usingCache:(id <ASICacheDelegate>)cache
{
	return [self requestWithURL:newURL usingCache:cache andCachePolicy:ASIUseDefaultCachePolicy];
}

+ (id)requestWithURL:(NSURL *)newURL usingCache:(id <ASICacheDelegate>)cache andCachePolicy:(ASICachePolicy)policy
{
	ASIHTTPRequest *request = [[[self alloc] initWithURL:newURL] autorelease];
	[request setDownloadCache:cache];
	[request setCachePolicy:policy];
	return request;
}

- (void)dealloc
{
	[self setAuthenticationNeeded:ASINoAuthenticationNeededYet];
	if (requestAuthentication) {
		CFRelease(requestAuthentication);
	}
	if (proxyAuthentication) {
		CFRelease(proxyAuthentication);
	}
	if (request) {
		CFRelease(request);
	}
	if (clientCertificateIdentity) {
		CFRelease(clientCertificateIdentity);
	}
	[self cancelLoad];
	[redirectURL release];
	[statusTimer invalidate];
	[statusTimer release];
	[queue release];
	[userInfo release];
	[postBody release];
	[compressedPostBody release];
	[error release];
	[requestHeaders release];
	[requestCookies release];
	[downloadDestinationPath release];
	[temporaryFileDownloadPath release];
	[temporaryUncompressedDataDownloadPath release];
	[fileDownloadOutputStream release];
	[inflatedFileDownloadOutputStream release];
	[username release];
	[password release];
	[domain release];
	[authenticationRealm release];
	[authenticationScheme release];
	[requestCredentials release];
	[proxyHost release];
	[proxyType release];
	[proxyUsername release];
	[proxyPassword release];
	[proxyDomain release];
	[proxyAuthenticationRealm release];
	[proxyAuthenticationScheme release];
	[proxyCredentials release];
	[url release];
	[originalURL release];
	[lastActivityTime release];
	[responseCookies release];
	[rawResponseData release];
	[responseHeaders release];
	[requestMethod release];
	[cancelledLock release];
	[postBodyFilePath release];
	[compressedPostBodyFilePath release];
	[postBodyWriteStream release];
	[postBodyReadStream release];
	[PACurl release];
	[clientCertificates release];
	[responseStatusMessage release];
	[connectionInfo release];
	[requestID release];
	[dataDecompressor release];
	[userAgent release];

	#if NS_BLOCKS_AVAILABLE
	[self releaseBlocksOnMainThread];
	#endif

	[super dealloc];
}

#if NS_BLOCKS_AVAILABLE
- (void)releaseBlocksOnMainThread
{
	NSMutableArray *blocks = [NSMutableArray array];
	if (completionBlock) {
		[blocks addObject:completionBlock];
		[completionBlock release];
		completionBlock = nil;
	}
	if (failureBlock) {
		[blocks addObject:failureBlock];
		[failureBlock release];
		failureBlock = nil;
	}
	if (startedBlock) {
		[blocks addObject:startedBlock];
		[startedBlock release];
		startedBlock = nil;
	}
	if (headersReceivedBlock) {
		[blocks addObject:headersReceivedBlock];
		[headersReceivedBlock release];
		headersReceivedBlock = nil;
	}
	if (bytesReceivedBlock) {
		[blocks addObject:bytesReceivedBlock];
		[bytesReceivedBlock release];
		bytesReceivedBlock = nil;
	}
	if (bytesSentBlock) {
		[blocks addObject:bytesSentBlock];
		[bytesSentBlock release];
		bytesSentBlock = nil;
	}
	if (downloadSizeIncrementedBlock) {
		[blocks addObject:downloadSizeIncrementedBlock];
		[downloadSizeIncrementedBlock release];
		downloadSizeIncrementedBlock = nil;
	}
	if (uploadSizeIncrementedBlock) {
		[blocks addObject:uploadSizeIncrementedBlock];
		[uploadSizeIncrementedBlock release];
		uploadSizeIncrementedBlock = nil;
	}
	if (dataReceivedBlock) {
		[blocks addObject:dataReceivedBlock];
		[dataReceivedBlock release];
		dataReceivedBlock = nil;
	}
	if (proxyAuthenticationNeededBlock) {
		[blocks addObject:proxyAuthenticationNeededBlock];
		[proxyAuthenticationNeededBlock release];
		proxyAuthenticationNeededBlock = nil;
	}
	if (authenticationNeededBlock) {
		[blocks addObject:authenticationNeededBlock];
		[authenticationNeededBlock release];
		authenticationNeededBlock = nil;
	}
	[[self class] performSelectorOnMainThread:@selector(releaseBlocks:) withObject:blocks waitUntilDone:[NSThread isMainThread]];
}
// Always called on main thread
+ (void)releaseBlocks:(NSArray *)blocks
{
	// Blocks will be released when this method exits
}
#endif


#pragma mark setup request

- (void)addRequestHeader:(NSString *)header value:(NSString *)value
{
	if (!requestHeaders) {
		[self setRequestHeaders:[NSMutableDictionary dictionaryWithCapacity:1]];
	}
	[requestHeaders setObject:value forKey:header];
}

// This function will be called either just before a request starts, or when postLength is needed, whichever comes first
// postLength must be set by the time this function is complete
- (void)buildPostBody
{

	if ([self haveBuiltPostBody]) {
		return;
	}
	
	// Are we submitting the request body from a file on disk
	if ([self postBodyFilePath]) {
		
		// If we were writing to the post body via appendPostData or appendPostDataFromFile, close the write stream
		if ([self postBodyWriteStream]) {
			[[self postBodyWriteStream] close];
			[self setPostBodyWriteStream:nil];
		}

		
		NSString *path;
		if ([self shouldCompressRequestBody]) {
			if (![self compressedPostBodyFilePath]) {
				[self setCompressedPostBodyFilePath:[NSTemporaryDirectory() stringByAppendingPathComponent:[[NSProcessInfo processInfo] globallyUniqueString]]];
				
				NSError *err = nil;
				if (![ASIDataCompressor compressDataFromFile:[self postBodyFilePath] toFile:[self compressedPostBodyFilePath] error:&err]) {
					[self failWithError:err];
					return;
				}
			}
			path = [self compressedPostBodyFilePath];
		} else {
			path = [self postBodyFilePath];
		}
		NSError *err = nil;
		[self setPostLength:[[[[[NSFileManager alloc] init] autorelease] attributesOfItemAtPath:path error:&err] fileSize]];
		if (err) {
			[self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIFileManagementError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Failed to get attributes for file at path '%@'",path],NSLocalizedDescriptionKey,error,NSUnderlyingErrorKey,nil]]];
			return;
		}
		
	// Otherwise, we have an in-memory request body
	} else {
		if ([self shouldCompressRequestBody]) {
			NSError *err = nil;
			NSData *compressedBody = [ASIDataCompressor compressData:[self postBody] error:&err];
			if (err) {
				[self failWithError:err];
				return;
			}
			[self setCompressedPostBody:compressedBody];
			[self setPostLength:[[self compressedPostBody] length]];
		} else {
			[self setPostLength:[[self postBody] length]];
		}
	}
		
	if ([self postLength] > 0) {
		if ([requestMethod isEqualToString:@"GET"] || [requestMethod isEqualToString:@"DELETE"] || [requestMethod isEqualToString:@"HEAD"]) {
			[self setRequestMethod:@"POST"];
		}
		[self addRequestHeader:@"Content-Length" value:[NSString stringWithFormat:@"%llu",[self postLength]]];
	}
	[self setHaveBuiltPostBody:YES];

}

// Sets up storage for the post body
- (void)setupPostBody
{
	if ([self shouldStreamPostDataFromDisk]) {
		if (![self postBodyFilePath]) {
			[self setPostBodyFilePath:[NSTemporaryDirectory() stringByAppendingPathComponent:[[NSProcessInfo processInfo] globallyUniqueString]]];
			[self setDidCreateTemporaryPostDataFile:YES];
		}
		if (![self postBodyWriteStream]) {
			[self setPostBodyWriteStream:[[[NSOutputStream alloc] initToFileAtPath:[self postBodyFilePath] append:NO] autorelease]];
			[[self postBodyWriteStream] open];
		}
	} else {
		if (![self postBody]) {
			[self setPostBody:[[[NSMutableData alloc] init] autorelease]];
		}
	}	
}

- (void)appendPostData:(NSData *)data
{
	[self setupPostBody];
	if ([data length] == 0) {
		return;
	}
	if ([self shouldStreamPostDataFromDisk]) {
		[[self postBodyWriteStream] write:[data bytes] maxLength:[data length]];
	} else {
		[[self postBody] appendData:data];
	}
}

- (void)appendPostDataFromFile:(NSString *)file
{
	[self setupPostBody];
	NSInputStream *stream = [[[NSInputStream alloc] initWithFileAtPath:file] autorelease];
	[stream open];
	NSUInteger bytesRead;
	while ([stream hasBytesAvailable]) {
		
		unsigned char buffer[1024*256];
		bytesRead = [stream read:buffer maxLength:sizeof(buffer)];
		if (bytesRead == 0) {
			break;
		}
		if ([self shouldStreamPostDataFromDisk]) {
			[[self postBodyWriteStream] write:buffer maxLength:bytesRead];
		} else {
			[[self postBody] appendData:[NSData dataWithBytes:buffer length:bytesRead]];
		}
	}
	[stream close];
}

- (NSString *)requestMethod
{
	[[self cancelledLock] lock];
	NSString *m = requestMethod;
	[[self cancelledLock] unlock];
	return m;
}

- (void)setRequestMethod:(NSString *)newRequestMethod
{
	[[self cancelledLock] lock];
	if (requestMethod != newRequestMethod) {
		[requestMethod release];
		requestMethod = [newRequestMethod retain];
		if ([requestMethod isEqualToString:@"POST"] || [requestMethod isEqualToString:@"PUT"] || [postBody length] || postBodyFilePath) {
			[self setShouldAttemptPersistentConnection:NO];
		}
	}
	[[self cancelledLock] unlock];
}

- (NSURL *)url
{
	[[self cancelledLock] lock];
	NSURL *u = url;
	[[self cancelledLock] unlock];
	return u;
}


- (void)setURL:(NSURL *)newURL
{
	[[self cancelledLock] lock];
	if ([newURL isEqual:[self url]]) {
		[[self cancelledLock] unlock];
		return;
	}
	[url release];
	url = [newURL retain];
	if (requestAuthentication) {
		CFRelease(requestAuthentication);
		requestAuthentication = NULL;
	}
	if (proxyAuthentication) {
		CFRelease(proxyAuthentication);
		proxyAuthentication = NULL;
	}
	if (request) {
		CFRelease(request);
		request = NULL;
	}
	[self setRedirectURL:nil];
	[[self cancelledLock] unlock];
}

- (id)delegate
{
	[[self cancelledLock] lock];
	id d = delegate;
	[[self cancelledLock] unlock];
	return d;
}

- (void)setDelegate:(id)newDelegate
{
	[[self cancelledLock] lock];
	delegate = newDelegate;
	[[self cancelledLock] unlock];
}

- (id)queue
{
	[[self cancelledLock] lock];
	id q = queue;
	[[self cancelledLock] unlock];
	return q;
}


- (void)setQueue:(id)newQueue
{
	[[self cancelledLock] lock];
	if (newQueue != queue) {
		[queue release];
		queue = [newQueue retain];
	}
	[[self cancelledLock] unlock];
}

#pragma mark get information about this request

// cancel the request - this must be run on the same thread as the request is running on
- (void)cancelOnRequestThread
{
	#if DEBUG_REQUEST_STATUS
	ASI_DEBUG_LOG(@"[STATUS] Request cancelled: %@",self);
	#endif
    
	[[self cancelledLock] lock];

    if ([self isCancelled] || [self complete]) {
		[[self cancelledLock] unlock];
		return;
	}
	[self failWithError:ASIRequestCancelledError];
	[self setComplete:YES];
	[self cancelLoad];
	
	CFRetain(self);
    [self willChangeValueForKey:@"isCancelled"];
    cancelled = YES;
    [self didChangeValueForKey:@"isCancelled"];
    
	[[self cancelledLock] unlock];
	CFRelease(self);
}

- (void)cancel
{
    [self performSelector:@selector(cancelOnRequestThread) onThread:[[self class] threadForRequest:self] withObject:nil waitUntilDone:NO];    
}

- (void)clearDelegatesAndCancel
{
	[[self cancelledLock] lock];

	// Clear delegates
	[self setDelegate:nil];
	[self setQueue:nil];
	[self setDownloadProgressDelegate:nil];
	[self setUploadProgressDelegate:nil];

	#if NS_BLOCKS_AVAILABLE
	// Clear blocks
	[self releaseBlocksOnMainThread];
	#endif

	[[self cancelledLock] unlock];
	[self cancel];
}


- (BOOL)isCancelled
{
    BOOL result;
    
	[[self cancelledLock] lock];
    result = cancelled;
    [[self cancelledLock] unlock];
    
    return result;
}

// Call this method to get the received data as an NSString. Don't use for binary data!
- (NSString *)responseString
{
	NSData *data = [self responseData];
	if (!data) {
		return nil;
	}
	
	return [[[NSString alloc] initWithBytes:[data bytes] length:[data length] encoding:[self responseEncoding]] autorelease];
}

- (BOOL)isResponseCompressed
{
	NSString *encoding = [[self responseHeaders] objectForKey:@"Content-Encoding"];
	return encoding && [encoding rangeOfString:@"gzip"].location != NSNotFound;
}

- (NSData *)responseData
{	
	if ([self isResponseCompressed] && [self shouldWaitToInflateCompressedResponses]) {
		return [ASIDataDecompressor uncompressData:[self rawResponseData] error:NULL];
	} else {
		return [self rawResponseData];
	}
	return nil;
}

#pragma mark running a request

- (void)startSynchronous
{
#if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING
	ASI_DEBUG_LOG(@"[STATUS] Starting synchronous request %@",self);
#endif
	[self setSynchronous:YES];
	[self setRunLoopMode:ASIHTTPRequestRunLoopMode];
	[self setInProgress:YES];

	if (![self isCancelled] && ![self complete]) {
		[self main];
		while (!complete) {
			[[NSRunLoop currentRunLoop] runMode:[self runLoopMode] beforeDate:[NSDate distantFuture]];
		}
	}

	[self setInProgress:NO];
}

- (void)start
{
	[self setInProgress:YES];
	[self performSelector:@selector(main) onThread:[[self class] threadForRequest:self] withObject:nil waitUntilDone:NO];
}

- (void)startAsynchronous
{
#if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING
	ASI_DEBUG_LOG(@"[STATUS] Starting asynchronous request %@",self);
#endif
	[sharedQueue addOperation:self];
}

#pragma mark concurrency

- (BOOL)isConcurrent
{
    return YES;
}

- (BOOL)isFinished 
{
	return finished;
}

- (BOOL)isExecuting {
	return [self inProgress];
}

#pragma mark request logic

// Create the request
- (void)main
{
	@try {
		
		[[self cancelledLock] lock];
		
		#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
		if ([ASIHTTPRequest isMultitaskingSupported] && [self shouldContinueWhenAppEntersBackground]) {
			backgroundTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
				// Synchronize the cleanup call on the main thread in case
				// the task actually finishes at around the same time.
				dispatch_async(dispatch_get_main_queue(), ^{
					if (backgroundTask != UIBackgroundTaskInvalid)
					{
						[[UIApplication sharedApplication] endBackgroundTask:backgroundTask];
						backgroundTask = UIBackgroundTaskInvalid;
						[self cancel];
					}
				});
			}];
		}
		#endif


		// A HEAD request generated by an ASINetworkQueue may have set the error already. If so, we should not proceed.
		if ([self error]) {
			[self setComplete:YES];
			[self markAsFinished];
			return;		
		}

		[self setComplete:NO];
		[self setDidUseCachedResponse:NO];
		
		if (![self url]) {
			[self failWithError:ASIUnableToCreateRequestError];
			return;		
		}
		
		// Must call before we create the request so that the request method can be set if needs be
		if (![self mainRequest]) {
			[self buildPostBody];
		}
		
		if (![[self requestMethod] isEqualToString:@"GET"]) {
			[self setDownloadCache:nil];
		}
		
		
		// If we're redirecting, we'll already have a CFHTTPMessageRef
		if (request) {
			CFRelease(request);
		}

		// Create a new HTTP request.
		request = CFHTTPMessageCreateRequest(kCFAllocatorDefault, (CFStringRef)[self requestMethod], (CFURLRef)[self url], [self useHTTPVersionOne] ? kCFHTTPVersion1_0 : kCFHTTPVersion1_1);
		if (!request) {
			[self failWithError:ASIUnableToCreateRequestError];
			return;
		}

		//If this is a HEAD request generated by an ASINetworkQueue, we need to let the main request generate its headers first so we can use them
		if ([self mainRequest]) {
			[[self mainRequest] buildRequestHeaders];
		}
		
		// Even if this is a HEAD request with a mainRequest, we still need to call to give subclasses a chance to add their own to HEAD requests (ASIS3Request does this)
		[self buildRequestHeaders];
		
		if ([self downloadCache]) {

			// If this request should use the default policy, set its policy to the download cache's default policy
			if (![self cachePolicy]) {
				[self setCachePolicy:[[self downloadCache] defaultCachePolicy]];
			}

			// If have have cached data that is valid for this request, use that and stop
			if ([[self downloadCache] canUseCachedDataForRequest:self]) {
				[self useDataFromCache];
				return;
			}

			// If cached data is stale, or we have been told to ask the server if it has been modified anyway, we need to add headers for a conditional GET
			if ([self cachePolicy] & (ASIAskServerIfModifiedWhenStaleCachePolicy|ASIAskServerIfModifiedCachePolicy)) {

				NSDictionary *cachedHeaders = [[self downloadCache] cachedResponseHeadersForURL:[self url]];
				if (cachedHeaders) {
					NSString *etag = [cachedHeaders objectForKey:@"Etag"];
					if (etag) {
						[[self requestHeaders] setObject:etag forKey:@"If-None-Match"];
					}
					NSString *lastModified = [cachedHeaders objectForKey:@"Last-Modified"];
					if (lastModified) {
						[[self requestHeaders] setObject:lastModified forKey:@"If-Modified-Since"];
					}
				}
			}
		}

		[self applyAuthorizationHeader];
		
		
		NSString *header;
		for (header in [self requestHeaders]) {
			CFHTTPMessageSetHeaderFieldValue(request, (CFStringRef)header, (CFStringRef)[[self requestHeaders] objectForKey:header]);
		}

		// If we immediately have access to proxy settings, start the request
		// Otherwise, we'll start downloading the proxy PAC file, and call startRequest once that process is complete
		if ([self configureProxies]) {
			[self startRequest];
		}

	} @catch (NSException *exception) {
		NSError *underlyingError = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASIUnhandledExceptionError userInfo:[exception userInfo]];
		[self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIUnhandledExceptionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[exception name],NSLocalizedDescriptionKey,[exception reason],NSLocalizedFailureReasonErrorKey,underlyingError,NSUnderlyingErrorKey,nil]]];

	} @finally {
		[[self cancelledLock] unlock];
	}
}

- (void)applyAuthorizationHeader
{
	// Do we want to send credentials before we are asked for them?
	if (![self shouldPresentCredentialsBeforeChallenge]) {
		#if DEBUG_HTTP_AUTHENTICATION
		ASI_DEBUG_LOG(@"[AUTH] Request %@ will not send credentials to the server until it asks for them",self);
		#endif
		return;
	}

	NSDictionary *credentials = nil;

	// Do we already have an auth header?
	if (![[self requestHeaders] objectForKey:@"Authorization"]) {

		// If we have basic authentication explicitly set and a username and password set on the request, add a basic auth header
		if ([self username] && [self password] && [[self authenticationScheme] isEqualToString:(NSString *)kCFHTTPAuthenticationSchemeBasic]) {
			[self addBasicAuthenticationHeaderWithUsername:[self username] andPassword:[self password]];

			#if DEBUG_HTTP_AUTHENTICATION
			ASI_DEBUG_LOG(@"[AUTH] Request %@ has a username and password set, and was manually configured to use BASIC. Will send credentials without waiting for an authentication challenge",self);	
			#endif

		} else {

			// See if we have any cached credentials we can use in the session store
			if ([self useSessionPersistence]) {
				credentials = [self findSessionAuthenticationCredentials];

				if (credentials) {

					// When the Authentication key is set, the credentials were stored after an authentication challenge, so we can let CFNetwork apply them
					// (credentials for Digest and NTLM will always be stored like this)
					if ([credentials objectForKey:@"Authentication"]) {

						// If we've already talked to this server and have valid credentials, let's apply them to the request
						if (CFHTTPMessageApplyCredentialDictionary(request, (CFHTTPAuthenticationRef)[credentials objectForKey:@"Authentication"], (CFDictionaryRef)[credentials objectForKey:@"Credentials"], NULL)) {
							[self setAuthenticationScheme:[credentials objectForKey:@"AuthenticationScheme"]];
							#if DEBUG_HTTP_AUTHENTICATION
							ASI_DEBUG_LOG(@"[AUTH] Request %@ found cached credentials (%@), will reuse without waiting for an authentication challenge",self,[credentials objectForKey:@"AuthenticationScheme"]);
							#endif
						} else {
							[[self class] removeAuthenticationCredentialsFromSessionStore:[credentials objectForKey:@"Credentials"]];
							#if DEBUG_HTTP_AUTHENTICATION
							ASI_DEBUG_LOG(@"[AUTH] Failed to apply cached credentials to request %@. These will be removed from the session store, and this request will wait for an authentication challenge",self);
							#endif
						}

					// If the Authentication key is not set, these credentials were stored after a username and password set on a previous request passed basic authentication
					// When this happens, we'll need to create the Authorization header ourselves
					} else {
						NSDictionary *usernameAndPassword = [credentials objectForKey:@"Credentials"];
						[self addBasicAuthenticationHeaderWithUsername:[usernameAndPassword objectForKey:(NSString *)kCFHTTPAuthenticationUsername] andPassword:[usernameAndPassword objectForKey:(NSString *)kCFHTTPAuthenticationPassword]];
						#if DEBUG_HTTP_AUTHENTICATION
						ASI_DEBUG_LOG(@"[AUTH] Request %@ found cached BASIC credentials from a previous request. Will send credentials without waiting for an authentication challenge",self);
						#endif
					}
				}
			}
		}
	}

	// Apply proxy authentication credentials
	if ([self useSessionPersistence]) {
		credentials = [self findSessionProxyAuthenticationCredentials];
		if (credentials) {
			if (!CFHTTPMessageApplyCredentialDictionary(request, (CFHTTPAuthenticationRef)[credentials objectForKey:@"Authentication"], (CFDictionaryRef)[credentials objectForKey:@"Credentials"], NULL)) {
				[[self class] removeProxyAuthenticationCredentialsFromSessionStore:[credentials objectForKey:@"Credentials"]];
			}
		}
	}
}

- (void)applyCookieHeader
{
	// Add cookies from the persistent (mac os global) store
	if ([self useCookiePersistence]) {
		NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:[[self url] absoluteURL]];
		if (cookies) {
			[[self requestCookies] addObjectsFromArray:cookies];
		}
	}
	
	// Apply request cookies
	NSArray *cookies;
	if ([self mainRequest]) {
		cookies = [[self mainRequest] requestCookies];
	} else {
		cookies = [self requestCookies];
	}
	if ([cookies count] > 0) {
		NSHTTPCookie *cookie;
		NSString *cookieHeader = nil;
		for (cookie in cookies) {
			if (!cookieHeader) {
				cookieHeader = [NSString stringWithFormat: @"%@=%@",[cookie name],[cookie value]];
			} else {
				cookieHeader = [NSString stringWithFormat: @"%@; %@=%@",cookieHeader,[cookie name],[cookie value]];
			}
		}
		if (cookieHeader) {
			[self addRequestHeader:@"Cookie" value:cookieHeader];
		}
	}	
}

- (void)buildRequestHeaders
{
	if ([self haveBuiltRequestHeaders]) {
		return;
	}
	[self setHaveBuiltRequestHeaders:YES];
	
	if ([self mainRequest]) {
		for (NSString *header in [[self mainRequest] requestHeaders]) {
			[self addRequestHeader:header value:[[[self mainRequest] requestHeaders] valueForKey:header]];
		}
		return;
	}
	
	[self applyCookieHeader];
	
	// Build and set the user agent string if the request does not already have a custom user agent specified
	if (![[self requestHeaders] objectForKey:@"User-Agent"]) {
		NSString *userAgentString = [self userAgent];
		if (!userAgentString) {
			userAgentString = [ASIHTTPRequest defaultUserAgentString];
		}
		if (userAgentString) {
			[self addRequestHeader:@"User-Agent" value:userAgentString];
		}
	}
	
	
	// Accept a compressed response
	if ([self allowCompressedResponse]) {
		[self addRequestHeader:@"Accept-Encoding" value:@"gzip"];
	}
	
	// Configure a compressed request body
	if ([self shouldCompressRequestBody]) {
		[self addRequestHeader:@"Content-Encoding" value:@"gzip"];
	}
	
	// Should this request resume an existing download?
	[self updatePartialDownloadSize];
	if ([self partialDownloadSize]) {
		[self addRequestHeader:@"Range" value:[NSString stringWithFormat:@"bytes=%llu-",[self partialDownloadSize]]];
	}
}

- (void)updatePartialDownloadSize
{
	NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];

	if ([self allowResumeForFileDownloads] && [self downloadDestinationPath] && [self temporaryFileDownloadPath] && [fileManager fileExistsAtPath:[self temporaryFileDownloadPath]]) {
		NSError *err = nil;
		[self setPartialDownloadSize:[[fileManager attributesOfItemAtPath:[self temporaryFileDownloadPath] error:&err] fileSize]];
		if (err) {
			[self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIFileManagementError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Failed to get attributes for file at path '%@'",[self temporaryFileDownloadPath]],NSLocalizedDescriptionKey,error,NSUnderlyingErrorKey,nil]]];
			return;
		}
	}
}

- (void)startRequest
{
	if ([self isCancelled]) {
		return;
	}
	
	[self performSelectorOnMainThread:@selector(requestStarted) withObject:nil waitUntilDone:[NSThread isMainThread]];
	
	[self setDownloadComplete:NO];
	[self setComplete:NO];
	[self setTotalBytesRead:0];
	[self setLastBytesRead:0];
	
	if ([self redirectCount] == 0) {
		[self setOriginalURL:[self url]];
	}
	
	// If we're retrying a request, let's remove any progress we made
	if ([self lastBytesSent] > 0) {
		[self removeUploadProgressSoFar];
	}
	
	[self setLastBytesSent:0];
	[self setContentLength:0];
	[self setResponseHeaders:nil];
	if (![self downloadDestinationPath]) {
		[self setRawResponseData:[[[NSMutableData alloc] init] autorelease]];
    }
	
	
    //
	// Create the stream for the request
	//

	NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];

	[self setReadStreamIsScheduled:NO];
	
	// Do we need to stream the request body from disk
	if ([self shouldStreamPostDataFromDisk] && [self postBodyFilePath] && [fileManager fileExistsAtPath:[self postBodyFilePath]]) {
		
		// Are we gzipping the request body?
		if ([self compressedPostBodyFilePath] && [fileManager fileExistsAtPath:[self compressedPostBodyFilePath]]) {
			[self setPostBodyReadStream:[ASIInputStream inputStreamWithFileAtPath:[self compressedPostBodyFilePath] request:self]];
		} else {
			[self setPostBodyReadStream:[ASIInputStream inputStreamWithFileAtPath:[self postBodyFilePath] request:self]];
		}
		[self setReadStream:[NSMakeCollectable(CFReadStreamCreateForStreamedHTTPRequest(kCFAllocatorDefault, request,(CFReadStreamRef)[self postBodyReadStream])) autorelease]];    
    } else {
		
		// If we have a request body, we'll stream it from memory using our custom stream, so that we can measure bandwidth use and it can be bandwidth-throttled if necessary
		if ([self postBody] && [[self postBody] length] > 0) {
			if ([self shouldCompressRequestBody] && [self compressedPostBody]) {
				[self setPostBodyReadStream:[ASIInputStream inputStreamWithData:[self compressedPostBody] request:self]];
			} else if ([self postBody]) {
				[self setPostBodyReadStream:[ASIInputStream inputStreamWithData:[self postBody] request:self]];
			}
			[self setReadStream:[NSMakeCollectable(CFReadStreamCreateForStreamedHTTPRequest(kCFAllocatorDefault, request,(CFReadStreamRef)[self postBodyReadStream])) autorelease]];
		
		} else {
			[self setReadStream:[NSMakeCollectable(CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, request)) autorelease]];
		}
	}

	if (![self readStream]) {
		[self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileBuildingRequestType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Unable to create read stream",NSLocalizedDescriptionKey,nil]]];
        return;
    }


    
    
    //
    // Handle SSL certificate settings
    //

    if([[[[self url] scheme] lowercaseString] isEqualToString:@"https"]) {       
       
        // Tell CFNetwork not to validate SSL certificates
        if (![self validatesSecureCertificate]) {
            // see: http://iphonedevelopment.blogspot.com/2010/05/nsstream-tcp-and-ssl.html
            
            NSDictionary *sslProperties = [[NSDictionary alloc] initWithObjectsAndKeys:
                                      [NSNumber numberWithBool:YES], kCFStreamSSLAllowsExpiredCertificates,
                                      [NSNumber numberWithBool:YES], kCFStreamSSLAllowsAnyRoot,
                                      [NSNumber numberWithBool:NO],  kCFStreamSSLValidatesCertificateChain,
                                      kCFNull,kCFStreamSSLPeerName,
                                      nil];
            
            CFReadStreamSetProperty((CFReadStreamRef)[self readStream], 
                                    kCFStreamPropertySSLSettings, 
                                    (CFTypeRef)sslProperties);
        } 
        
        // Tell CFNetwork to use a client certificate
        if (clientCertificateIdentity) {
            NSMutableDictionary *sslProperties = [NSMutableDictionary dictionaryWithCapacity:1];
            
			NSMutableArray *certificates = [NSMutableArray arrayWithCapacity:[clientCertificates count]+1];

			// The first object in the array is our SecIdentityRef
			[certificates addObject:(id)clientCertificateIdentity];

			// If we've added any additional certificates, add them too
			for (id cert in clientCertificates) {
				[certificates addObject:cert];
			}
            
            [sslProperties setObject:certificates forKey:(NSString *)kCFStreamSSLCertificates];
            
            CFReadStreamSetProperty((CFReadStreamRef)[self readStream], kCFStreamPropertySSLSettings, sslProperties);
        }
        
    }

	//
	// Handle proxy settings
	//

 	if ([self proxyHost] && [self proxyPort]) {
		NSString *hostKey;
		NSString *portKey;

		if (![self proxyType]) {
			[self setProxyType:(NSString *)kCFProxyTypeHTTP];
		}

		if ([[self proxyType] isEqualToString:(NSString *)kCFProxyTypeSOCKS]) {
			hostKey = (NSString *)kCFStreamPropertySOCKSProxyHost;
			portKey = (NSString *)kCFStreamPropertySOCKSProxyPort;
		} else {
			hostKey = (NSString *)kCFStreamPropertyHTTPProxyHost;
			portKey = (NSString *)kCFStreamPropertyHTTPProxyPort;
			if ([[[[self url] scheme] lowercaseString] isEqualToString:@"https"]) {
				hostKey = (NSString *)kCFStreamPropertyHTTPSProxyHost;
				portKey = (NSString *)kCFStreamPropertyHTTPSProxyPort;
			}
		}
		NSMutableDictionary *proxyToUse = [NSMutableDictionary dictionaryWithObjectsAndKeys:[self proxyHost],hostKey,[NSNumber numberWithInt:[self proxyPort]],portKey,nil];

		if ([[self proxyType] isEqualToString:(NSString *)kCFProxyTypeSOCKS]) {
			CFReadStreamSetProperty((CFReadStreamRef)[self readStream], kCFStreamPropertySOCKSProxy, proxyToUse);
		} else {
			CFReadStreamSetProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPProxy, proxyToUse);
		}
	}


	//
	// Handle persistent connections
	//
	
	[ASIHTTPRequest expirePersistentConnections];

	[connectionsLock lock];
	
	
	if (![[self url] host] || ![[self url] scheme]) {
		[self setConnectionInfo:nil];
		[self setShouldAttemptPersistentConnection:NO];
	}
	
	// Will store the old stream that was using this connection (if there was one) so we can clean it up once we've opened our own stream
	NSInputStream *oldStream = nil;
	
	// Use a persistent connection if possible
	if ([self shouldAttemptPersistentConnection]) {
		

		// If we are redirecting, we will re-use the current connection only if we are connecting to the same server
		if ([self connectionInfo]) {
			
			if (![[[self connectionInfo] objectForKey:@"host"] isEqualToString:[[self url] host]] || ![[[self connectionInfo] objectForKey:@"scheme"] isEqualToString:[[self url] scheme]] || [(NSNumber *)[[self connectionInfo] objectForKey:@"port"] intValue] != [[[self url] port] intValue]) {
				[self setConnectionInfo:nil];

			// Check if we should have expired this connection
			} else if ([[[self connectionInfo] objectForKey:@"expires"] timeIntervalSinceNow] < 0) {
				#if DEBUG_PERSISTENT_CONNECTIONS
				ASI_DEBUG_LOG(@"[CONNECTION] Not re-using connection #%i because it has expired",[[[self connectionInfo] objectForKey:@"id"] intValue]);
				#endif
				[persistentConnectionsPool removeObject:[self connectionInfo]];
				[self setConnectionInfo:nil];

			} else if ([[self connectionInfo] objectForKey:@"request"] != nil) {
                //Some other request reused this connection already - we'll have to create a new one
				#if DEBUG_PERSISTENT_CONNECTIONS
                ASI_DEBUG_LOG(@"%@ - Not re-using connection #%i for request #%i because it is already used by request #%i",self,[[[self connectionInfo] objectForKey:@"id"] intValue],[[self requestID] intValue],[[[self connectionInfo] objectForKey:@"request"] intValue]);
				#endif
                [self setConnectionInfo:nil];
            }
		}
		
		
		
		if (![self connectionInfo] && [[self url] host] && [[self url] scheme]) { // We must have a proper url with a host and scheme, or this will explode
			
			// Look for a connection to the same server in the pool
			for (NSMutableDictionary *existingConnection in persistentConnectionsPool) {
				if (![existingConnection objectForKey:@"request"] && [[existingConnection objectForKey:@"host"] isEqualToString:[[self url] host]] && [[existingConnection objectForKey:@"scheme"] isEqualToString:[[self url] scheme]] && [(NSNumber *)[existingConnection objectForKey:@"port"] intValue] == [[[self url] port] intValue]) {
					[self setConnectionInfo:existingConnection];
				}
			}
		}
		
		if ([[self connectionInfo] objectForKey:@"stream"]) {
			oldStream = [[[self connectionInfo] objectForKey:@"stream"] retain];

		}
		
		// No free connection was found in the pool matching the server/scheme/port we're connecting to, we'll need to create a new one
		if (![self connectionInfo]) {
			[self setConnectionInfo:[NSMutableDictionary dictionary]];
			nextConnectionNumberToCreate++;
			[[self connectionInfo] setObject:[NSNumber numberWithInt:nextConnectionNumberToCreate] forKey:@"id"];
			[[self connectionInfo] setObject:[[self url] host] forKey:@"host"];
			[[self connectionInfo] setObject:[NSNumber numberWithInt:[[[self url] port] intValue]] forKey:@"port"];
			[[self connectionInfo] setObject:[[self url] scheme] forKey:@"scheme"];
			[persistentConnectionsPool addObject:[self connectionInfo]];
		}
		
		// If we are retrying this request, it will already have a requestID
		if (![self requestID]) {
			nextRequestID++;
			[self setRequestID:[NSNumber numberWithUnsignedInt:nextRequestID]];
		}
		[[self connectionInfo] setObject:[self requestID] forKey:@"request"];		
		[[self connectionInfo] setObject:[self readStream] forKey:@"stream"];
		CFReadStreamSetProperty((CFReadStreamRef)[self readStream],  kCFStreamPropertyHTTPAttemptPersistentConnection, kCFBooleanTrue);
		
		#if DEBUG_PERSISTENT_CONNECTIONS
		ASI_DEBUG_LOG(@"[CONNECTION] Request #%@ will use connection #%i",[self requestID],[[[self connectionInfo] objectForKey:@"id"] intValue]);
		#endif
		
		
		// Tag the stream with an id that tells it which connection to use behind the scenes
		// See http://lists.apple.com/archives/macnetworkprog/2008/Dec/msg00001.html for details on this approach
		
		CFReadStreamSetProperty((CFReadStreamRef)[self readStream], CFSTR("ASIStreamID"), [[self connectionInfo] objectForKey:@"id"]);
	
	} else {
		#if DEBUG_PERSISTENT_CONNECTIONS
		ASI_DEBUG_LOG(@"[CONNECTION] Request %@ will not use a persistent connection",self);
		#endif
	}
	
	[connectionsLock unlock];

	// Schedule the stream
	if (![self readStreamIsScheduled] && (!throttleWakeUpTime || [throttleWakeUpTime timeIntervalSinceDate:[NSDate date]] < 0)) {
		[self scheduleReadStream];
	}
	
	BOOL streamSuccessfullyOpened = NO;


   // Start the HTTP connection
	CFStreamClientContext ctxt = {0, self, NULL, NULL, NULL};
    if (CFReadStreamSetClient((CFReadStreamRef)[self readStream], kNetworkEvents, ReadStreamClientCallBack, &ctxt)) {
		if (CFReadStreamOpen((CFReadStreamRef)[self readStream])) {
			streamSuccessfullyOpened = YES;
		}
	}
	
	// Here, we'll close the stream that was previously using this connection, if there was one
	// We've kept it open until now (when we've just opened a new stream) so that the new stream can make use of the old connection
	// http://lists.apple.com/archives/Macnetworkprog/2006/Mar/msg00119.html
	if (oldStream) {
		[oldStream close];
		[oldStream release];
		oldStream = nil;
	}

	if (!streamSuccessfullyOpened) {
		[self setConnectionCanBeReused:NO];
		[self destroyReadStream];
		[self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileBuildingRequestType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Unable to start HTTP connection",NSLocalizedDescriptionKey,nil]]];
		return;	
	}
	
	if (![self mainRequest]) {
		if ([self shouldResetUploadProgress]) {
			if ([self showAccurateProgress]) {
				[self incrementUploadSizeBy:[self postLength]];
			} else {
				[self incrementUploadSizeBy:1];	 
			}
			[ASIHTTPRequest updateProgressIndicator:&uploadProgressDelegate withProgress:0 ofTotal:1];
		}
		if ([self shouldResetDownloadProgress] && ![self partialDownloadSize]) {
			[ASIHTTPRequest updateProgressIndicator:&downloadProgressDelegate withProgress:0 ofTotal:1];
		}
	}	
	
	
	// Record when the request started, so we can timeout if nothing happens
	[self setLastActivityTime:[NSDate date]];
	[self setStatusTimer:[NSTimer timerWithTimeInterval:0.25 target:self selector:@selector(updateStatus:) userInfo:nil repeats:YES]];
	[[NSRunLoop currentRunLoop] addTimer:[self statusTimer] forMode:[self runLoopMode]];
}

- (void)setStatusTimer:(NSTimer *)timer
{
	CFRetain(self);
	// We must invalidate the old timer here, not before we've created and scheduled a new timer
	// This is because the timer may be the only thing retaining an asynchronous request
	if (statusTimer && timer != statusTimer) {
		[statusTimer invalidate];
		[statusTimer release];
	}
	statusTimer = [timer retain];
	CFRelease(self);
}

// This gets fired every 1/4 of a second to update the progress and work out if we need to timeout
- (void)updateStatus:(NSTimer*)timer
{
	[self checkRequestStatus];
	if (![self inProgress]) {
		[self setStatusTimer:nil];
	}
}

- (void)performRedirect
{
	[self setURL:[self redirectURL]];
	[self setComplete:YES];
	[self setNeedsRedirect:NO];
	[self setRedirectCount:[self redirectCount]+1];

	if ([self redirectCount] > RedirectionLimit) {
		// Some naughty / badly coded website is trying to force us into a redirection loop. This is not cool.
		[self failWithError:ASITooMuchRedirectionError];
		[self setComplete:YES];
	} else {
		// Go all the way back to the beginning and build the request again, so that we can apply any new cookies
		[self main];
	}
}

// Called by delegate to resume loading with a new url after the delegate received request:willRedirectToURL:
- (void)redirectToURL:(NSURL *)newURL
{
	[self setRedirectURL:newURL];
	[self performSelector:@selector(performRedirect) onThread:[[self class] threadForRequest:self] withObject:nil waitUntilDone:NO];
}

- (BOOL)shouldTimeOut
{
	NSTimeInterval secondsSinceLastActivity = [[NSDate date] timeIntervalSinceDate:lastActivityTime];
	// See if we need to timeout
	if ([self readStream] && [self readStreamIsScheduled] && [self lastActivityTime] && [self timeOutSeconds] > 0 && secondsSinceLastActivity > [self timeOutSeconds]) {
		
		// We have no body, or we've sent more than the upload buffer size,so we can safely time out here
		if ([self postLength] == 0 || ([self uploadBufferSize] > 0 && [self totalBytesSent] > [self uploadBufferSize])) {
			return YES;
			
		// ***Black magic warning***
		// We have a body, but we've taken longer than timeOutSeconds to upload the first small chunk of data
		// Since there's no reliable way to track upload progress for the first 32KB (iPhone) or 128KB (Mac) with CFNetwork, we'll be slightly more forgiving on the timeout, as there's a strong chance our connection is just very slow.
		} else if (secondsSinceLastActivity > [self timeOutSeconds]*1.5) {
			return YES;
		}
	}
	return NO;
}

- (void)checkRequestStatus
{
	// We won't let the request cancel while we're updating progress / checking for a timeout
	[[self cancelledLock] lock];
	// See if our NSOperationQueue told us to cancel
	if ([self isCancelled] || [self complete]) {
		[[self cancelledLock] unlock];
		return;
	}
	
	[self performThrottling];
	
	if ([self shouldTimeOut]) {			
		// Do we need to auto-retry this request?
		if ([self numberOfTimesToRetryOnTimeout] > [self retryCount]) {

			// If we are resuming a download, we may need to update the Range header to take account of data we've just downloaded
			[self updatePartialDownloadSize];
			if ([self partialDownloadSize]) {
				CFHTTPMessageSetHeaderFieldValue(request, (CFStringRef)@"Range", (CFStringRef)[NSString stringWithFormat:@"bytes=%llu-",[self partialDownloadSize]]);
			}
			[self setRetryCount:[self retryCount]+1];
			[self unscheduleReadStream];
			[[self cancelledLock] unlock];
			[self startRequest];
			return;
		}
		[self failWithError:ASIRequestTimedOutError];
		[self cancelLoad];
		[self setComplete:YES];
		[[self cancelledLock] unlock];
		return;
	}

	// readStream will be null if we aren't currently running (perhaps we're waiting for a delegate to supply credentials)
	if ([self readStream]) {
		
		// If we have a post body
		if ([self postLength]) {
		
			[self setLastBytesSent:totalBytesSent];	
			
			// Find out how much data we've uploaded so far
			[self setTotalBytesSent:[[NSMakeCollectable(CFReadStreamCopyProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPRequestBytesWrittenCount)) autorelease] unsignedLongLongValue]];
			if (totalBytesSent > lastBytesSent) {
				
				// We've uploaded more data,  reset the timeout
				[self setLastActivityTime:[NSDate date]];
				[ASIHTTPRequest incrementBandwidthUsedInLastSecond:(unsigned long)(totalBytesSent-lastBytesSent)];		
						
				#if DEBUG_REQUEST_STATUS
				if ([self totalBytesSent] == [self postLength]) {
					ASI_DEBUG_LOG(@"[STATUS] Request %@ finished uploading data",self);
				}
				#endif
			}
		}
			
		[self updateProgressIndicators];

	}
	
	[[self cancelledLock] unlock];
}


// Cancel loading and clean up. DO NOT USE THIS TO CANCEL REQUESTS - use [request cancel] instead
- (void)cancelLoad
{
	// If we're in the middle of downloading a PAC file, let's stop that first
	if (PACFileReadStream) {
		[PACFileReadStream setDelegate:nil];
		[PACFileReadStream close];
		[self setPACFileReadStream:nil];
		[self setPACFileData:nil];
	} else if (PACFileRequest) {
		[PACFileRequest setDelegate:nil];
		[PACFileRequest cancel];
		[self setPACFileRequest:nil];
	}

    [self destroyReadStream];
	
	[[self postBodyReadStream] close];
	[self setPostBodyReadStream:nil];
	
    if ([self rawResponseData]) {
		if (![self complete]) {
			[self setRawResponseData:nil];
		}
	// If we were downloading to a file
	} else if ([self temporaryFileDownloadPath]) {
		[[self fileDownloadOutputStream] close];
		[self setFileDownloadOutputStream:nil];
		
		[[self inflatedFileDownloadOutputStream] close];
		[self setInflatedFileDownloadOutputStream:nil];
		
		// If we haven't said we might want to resume, let's remove the temporary file too
		if (![self complete]) {
			if (![self allowResumeForFileDownloads]) {
				[self removeTemporaryDownloadFile];
			}
			[self removeTemporaryUncompressedDownloadFile];
		}
	}
	
	// Clean up any temporary file used to store request body for streaming
	if (![self authenticationNeeded] && ![self willRetryRequest] && [self didCreateTemporaryPostDataFile]) {
		[self removeTemporaryUploadFile];
		[self removeTemporaryCompressedUploadFile];
		[self setDidCreateTemporaryPostDataFile:NO];
	}
}

#pragma mark HEAD request

// Used by ASINetworkQueue to create a HEAD request appropriate for this request with the same headers (though you can use it yourself)
- (ASIHTTPRequest *)HEADRequest
{
	ASIHTTPRequest *headRequest = [[self class] requestWithURL:[self url]];
	
	// Copy the properties that make sense for a HEAD request
	[headRequest setRequestHeaders:[[[self requestHeaders] mutableCopy] autorelease]];
	[headRequest setRequestCookies:[[[self requestCookies] mutableCopy] autorelease]];
	[headRequest setUseCookiePersistence:[self useCookiePersistence]];
	[headRequest setUseKeychainPersistence:[self useKeychainPersistence]];
	[headRequest setUseSessionPersistence:[self useSessionPersistence]];
	[headRequest setAllowCompressedResponse:[self allowCompressedResponse]];
	[headRequest setUsername:[self username]];
	[headRequest setPassword:[self password]];
	[headRequest setDomain:[self domain]];
	[headRequest setProxyUsername:[self proxyUsername]];
	[headRequest setProxyPassword:[self proxyPassword]];
	[headRequest setProxyDomain:[self proxyDomain]];
	[headRequest setProxyHost:[self proxyHost]];
	[headRequest setProxyPort:[self proxyPort]];
	[headRequest setProxyType:[self proxyType]];
	[headRequest setShouldPresentAuthenticationDialog:[self shouldPresentAuthenticationDialog]];
	[headRequest setShouldPresentProxyAuthenticationDialog:[self shouldPresentProxyAuthenticationDialog]];
	[headRequest setTimeOutSeconds:[self timeOutSeconds]];
	[headRequest setUseHTTPVersionOne:[self useHTTPVersionOne]];
	[headRequest setValidatesSecureCertificate:[self validatesSecureCertificate]];
    [headRequest setClientCertificateIdentity:clientCertificateIdentity];
	[headRequest setClientCertificates:[[clientCertificates copy] autorelease]];
	[headRequest setPACurl:[self PACurl]];
	[headRequest setShouldPresentCredentialsBeforeChallenge:[self shouldPresentCredentialsBeforeChallenge]];
	[headRequest setNumberOfTimesToRetryOnTimeout:[self numberOfTimesToRetryOnTimeout]];
	[headRequest setShouldUseRFC2616RedirectBehaviour:[self shouldUseRFC2616RedirectBehaviour]];
	[headRequest setShouldAttemptPersistentConnection:[self shouldAttemptPersistentConnection]];
	[headRequest setPersistentConnectionTimeoutSeconds:[self persistentConnectionTimeoutSeconds]];
	
	[headRequest setMainRequest:self];
	[headRequest setRequestMethod:@"HEAD"];
	return headRequest;
}


#pragma mark upload/download progress


- (void)updateProgressIndicators
{
	//Only update progress if this isn't a HEAD request used to preset the content-length
	if (![self mainRequest]) {
		if ([self showAccurateProgress] || ([self complete] && ![self updatedProgress])) {
			[self updateUploadProgress];
			[self updateDownloadProgress];
		}
	}
}

- (id)uploadProgressDelegate
{
	[[self cancelledLock] lock];
	id d = [[uploadProgressDelegate retain] autorelease];
	[[self cancelledLock] unlock];
	return d;
}

- (void)setUploadProgressDelegate:(id)newDelegate
{
	[[self cancelledLock] lock];
	uploadProgressDelegate = newDelegate;

	#if !TARGET_OS_IPHONE
	// If the uploadProgressDelegate is an NSProgressIndicator, we set its MaxValue to 1.0 so we can update it as if it were a UIProgressView
	double max = 1.0;
	[ASIHTTPRequest performSelector:@selector(setMaxValue:) onTarget:&uploadProgressDelegate withObject:nil amount:&max callerToRetain:nil];
	#endif
	[[self cancelledLock] unlock];
}

- (id)downloadProgressDelegate
{
	[[self cancelledLock] lock];
	id d = [[downloadProgressDelegate retain] autorelease];
	[[self cancelledLock] unlock];
	return d;
}

- (void)setDownloadProgressDelegate:(id)newDelegate
{
	[[self cancelledLock] lock];
	downloadProgressDelegate = newDelegate;

	#if !TARGET_OS_IPHONE
	// If the downloadProgressDelegate is an NSProgressIndicator, we set its MaxValue to 1.0 so we can update it as if it were a UIProgressView
	double max = 1.0;
	[ASIHTTPRequest performSelector:@selector(setMaxValue:) onTarget:&downloadProgressDelegate withObject:nil amount:&max callerToRetain:nil];	
	#endif
	[[self cancelledLock] unlock];
}


- (void)updateDownloadProgress
{
	// We won't update download progress until we've examined the headers, since we might need to authenticate
	if (![self responseHeaders] || [self needsRedirect] || !([self contentLength] || [self complete])) {
		return;
	}
		
	unsigned long long bytesReadSoFar = [self totalBytesRead]+[self partialDownloadSize];
	unsigned long long value = 0;
	
	if ([self showAccurateProgress] && [self contentLength]) {
		value = bytesReadSoFar-[self lastBytesRead];
		if (value == 0) {
			return;
		}
	} else {
		value = 1;
		[self setUpdatedProgress:YES];
	}
	if (!value) {
		return;
	}

	[ASIHTTPRequest performSelector:@selector(request:didReceiveBytes:) onTarget:&queue withObject:self amount:&value callerToRetain:self];
	[ASIHTTPRequest performSelector:@selector(request:didReceiveBytes:) onTarget:&downloadProgressDelegate withObject:self amount:&value callerToRetain:self];

	[ASIHTTPRequest updateProgressIndicator:&downloadProgressDelegate withProgress:[self totalBytesRead]+[self partialDownloadSize] ofTotal:[self contentLength]+[self partialDownloadSize]];

	#if NS_BLOCKS_AVAILABLE
    if (bytesReceivedBlock) {
		unsigned long long totalSize = [self contentLength] + [self partialDownloadSize];
		[self performBlockOnMainThread:^{ if (bytesReceivedBlock) { bytesReceivedBlock(value, totalSize); }}];
    }
	#endif
	[self setLastBytesRead:bytesReadSoFar];
}

- (void)updateUploadProgress
{
	if ([self isCancelled] || [self totalBytesSent] == 0) {
		return;
	}
	
	// If this is the first time we've written to the buffer, totalBytesSent will be the size of the buffer (currently seems to be 128KB on both Leopard and iPhone 2.2.1, 32KB on iPhone 3.0)
	// If request body is less than the buffer size, totalBytesSent will be the total size of the request body
	// We will remove this from any progress display, as kCFStreamPropertyHTTPRequestBytesWrittenCount does not tell us how much data has actually be written
	if ([self uploadBufferSize] == 0 && [self totalBytesSent] != [self postLength]) {
		[self setUploadBufferSize:[self totalBytesSent]];
		[self incrementUploadSizeBy:-[self uploadBufferSize]];
	}
	
	unsigned long long value = 0;
	
	if ([self showAccurateProgress]) {
		if ([self totalBytesSent] == [self postLength] || [self lastBytesSent] > 0) {
			value = [self totalBytesSent]-[self lastBytesSent];
		} else {
			return;
		}
	} else {
		value = 1;
		[self setUpdatedProgress:YES];
	}
	
	if (!value) {
		return;
	}
	
	[ASIHTTPRequest performSelector:@selector(request:didSendBytes:) onTarget:&queue withObject:self amount:&value callerToRetain:self];
	[ASIHTTPRequest performSelector:@selector(request:didSendBytes:) onTarget:&uploadProgressDelegate withObject:self amount:&value callerToRetain:self];
	[ASIHTTPRequest updateProgressIndicator:&uploadProgressDelegate withProgress:[self totalBytesSent]-[self uploadBufferSize] ofTotal:[self postLength]-[self uploadBufferSize]];

	#if NS_BLOCKS_AVAILABLE
    if(bytesSentBlock){
		unsigned long long totalSize = [self postLength];
		[self performBlockOnMainThread:^{ if (bytesSentBlock) { bytesSentBlock(value, totalSize); }}];
	}
	#endif
}


- (void)incrementDownloadSizeBy:(long long)length
{
	[ASIHTTPRequest performSelector:@selector(request:incrementDownloadSizeBy:) onTarget:&queue withObject:self amount:&length callerToRetain:self];
	[ASIHTTPRequest performSelector:@selector(request:incrementDownloadSizeBy:) onTarget:&downloadProgressDelegate withObject:self amount:&length callerToRetain:self];

	#if NS_BLOCKS_AVAILABLE
    if(downloadSizeIncrementedBlock){
		[self performBlockOnMainThread:^{ if (downloadSizeIncrementedBlock) { downloadSizeIncrementedBlock(length); }}];
    }
	#endif
}

- (void)incrementUploadSizeBy:(long long)length
{
	[ASIHTTPRequest performSelector:@selector(request:incrementUploadSizeBy:) onTarget:&queue withObject:self amount:&length callerToRetain:self];
	[ASIHTTPRequest performSelector:@selector(request:incrementUploadSizeBy:) onTarget:&uploadProgressDelegate withObject:self amount:&length callerToRetain:self];

	#if NS_BLOCKS_AVAILABLE
    if(uploadSizeIncrementedBlock) {
		[self performBlockOnMainThread:^{ if (uploadSizeIncrementedBlock) { uploadSizeIncrementedBlock(length); }}];
    }
	#endif
}


-(void)removeUploadProgressSoFar
{
	long long progressToRemove = -[self totalBytesSent];
	[ASIHTTPRequest performSelector:@selector(request:didSendBytes:) onTarget:&queue withObject:self amount:&progressToRemove callerToRetain:self];
	[ASIHTTPRequest performSelector:@selector(request:didSendBytes:) onTarget:&uploadProgressDelegate withObject:self amount:&progressToRemove callerToRetain:self];
	[ASIHTTPRequest updateProgressIndicator:&uploadProgressDelegate withProgress:0 ofTotal:[self postLength]];

	#if NS_BLOCKS_AVAILABLE
    if(bytesSentBlock){
		unsigned long long totalSize = [self postLength];
		[self performBlockOnMainThread:^{  if (bytesSentBlock) { bytesSentBlock(progressToRemove, totalSize); }}];
	}
	#endif
}

#if NS_BLOCKS_AVAILABLE
- (void)performBlockOnMainThread:(ASIBasicBlock)block
{
	[self performSelectorOnMainThread:@selector(callBlock:) withObject:[[block copy] autorelease] waitUntilDone:[NSThread isMainThread]];
}

- (void)callBlock:(ASIBasicBlock)block
{
	block();
}
#endif


+ (void)performSelector:(SEL)selector onTarget:(id *)target withObject:(id)object amount:(void *)amount callerToRetain:(id)callerToRetain
{
	if ([*target respondsToSelector:selector]) {
		NSMethodSignature *signature = nil;
		signature = [*target methodSignatureForSelector:selector];
		NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];

		[invocation setSelector:selector];
		
		int argumentNumber = 2;
		
		// If we got an object parameter, we pass a pointer to the object pointer
		if (object) {
			[invocation setArgument:&object atIndex:argumentNumber];
			argumentNumber++;
		}
		
		// For the amount we'll just pass the pointer directly so NSInvocation will call the method using the number itself rather than a pointer to it
		if (amount) {
			[invocation setArgument:amount atIndex:argumentNumber];
		}

        SEL callback = @selector(performInvocation:onTarget:releasingObject:);
        NSMethodSignature *cbSignature = [ASIHTTPRequest methodSignatureForSelector:callback];
        NSInvocation *cbInvocation = [NSInvocation invocationWithMethodSignature:cbSignature];
        [cbInvocation setSelector:callback];
        [cbInvocation setTarget:self];
        [cbInvocation setArgument:&invocation atIndex:2];
        [cbInvocation setArgument:&target atIndex:3];
		if (callerToRetain) {
			[cbInvocation setArgument:&callerToRetain atIndex:4];
		}

		CFRetain(invocation);

		// Used to pass in a request that we must retain until after the call
		// We're using CFRetain rather than [callerToRetain retain] so things to avoid earthquakes when using garbage collection
		if (callerToRetain) {
			CFRetain(callerToRetain);
		}
        [cbInvocation performSelectorOnMainThread:@selector(invoke) withObject:nil waitUntilDone:[NSThread isMainThread]];
    }
}

+ (void)performInvocation:(NSInvocation *)invocation onTarget:(id *)target releasingObject:(id)objectToRelease
{
    if (*target && [*target respondsToSelector:[invocation selector]]) {
        [invocation invokeWithTarget:*target];
    }
	CFRelease(invocation);
	if (objectToRelease) {
		CFRelease(objectToRelease);
	}
}
	
	
+ (void)updateProgressIndicator:(id *)indicator withProgress:(unsigned long long)progress ofTotal:(unsigned long long)total
{
	#if TARGET_OS_IPHONE
		// Cocoa Touch: UIProgressView
		SEL selector = @selector(setProgress:);
		float progressAmount = (float)((progress*1.0)/(total*1.0));
		
	#else
		// Cocoa: NSProgressIndicator
		double progressAmount = progressAmount = (progress*1.0)/(total*1.0);
		SEL selector = @selector(setDoubleValue:);
	#endif
	
	if (![*indicator respondsToSelector:selector]) {
		return;
	}
	
	[progressLock lock];
	[ASIHTTPRequest performSelector:selector onTarget:indicator withObject:nil amount:&progressAmount callerToRetain:nil];
	[progressLock unlock];
}


#pragma mark talking to delegates / calling blocks

/* ALWAYS CALLED ON MAIN THREAD! */
- (void)requestStarted
{
	if ([self error] || [self mainRequest]) {
		return;
	}
	if (delegate && [delegate respondsToSelector:didStartSelector]) {
		[delegate performSelector:didStartSelector withObject:self];
	}
	#if NS_BLOCKS_AVAILABLE
	if(startedBlock){
		startedBlock();
	}
	#endif
	if (queue && [queue respondsToSelector:@selector(requestStarted:)]) {
		[queue performSelector:@selector(requestStarted:) withObject:self];
	}
}

/* ALWAYS CALLED ON MAIN THREAD! */
- (void)requestRedirected
{
	if ([self error] || [self mainRequest]) {
		return;
	}

	if([[self delegate] respondsToSelector:@selector(requestRedirected:)]){
		[[self delegate] performSelector:@selector(requestRedirected:) withObject:self];
	}

	#if NS_BLOCKS_AVAILABLE
	if(requestRedirectedBlock){
		requestRedirectedBlock();
	}
	#endif
}


/* ALWAYS CALLED ON MAIN THREAD! */
- (void)requestReceivedResponseHeaders:(NSMutableDictionary *)newResponseHeaders
{
	if ([self error] || [self mainRequest]) {
		return;
	}

	if (delegate && [delegate respondsToSelector:didReceiveResponseHeadersSelector]) {
		[delegate performSelector:didReceiveResponseHeadersSelector withObject:self withObject:newResponseHeaders];
	}

	#if NS_BLOCKS_AVAILABLE
	if(headersReceivedBlock){
		headersReceivedBlock(newResponseHeaders);
    }
	#endif

	if (queue && [queue respondsToSelector:@selector(request:didReceiveResponseHeaders:)]) {
		[queue performSelector:@selector(request:didReceiveResponseHeaders:) withObject:self withObject:newResponseHeaders];
	}
}

/* ALWAYS CALLED ON MAIN THREAD! */
- (void)requestWillRedirectToURL:(NSURL *)newURL
{
	if ([self error] || [self mainRequest]) {
		return;
	}
	if (delegate && [delegate respondsToSelector:willRedirectSelector]) {
		[delegate performSelector:willRedirectSelector withObject:self withObject:newURL];
	}
	if (queue && [queue respondsToSelector:@selector(request:willRedirectToURL:)]) {
		[queue performSelector:@selector(request:willRedirectToURL:) withObject:self withObject:newURL];
	}
}

// Subclasses might override this method to process the result in the same thread
// If you do this, don't forget to call [super requestFinished] to let the queue / delegate know we're done
- (void)requestFinished
{
#if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING
	ASI_DEBUG_LOG(@"[STATUS] Request finished: %@",self);
#endif
	if ([self error] || [self mainRequest]) {
		return;
	}
	if ([self isPACFileRequest]) {
		[self reportFinished];
	} else {
		[self performSelectorOnMainThread:@selector(reportFinished) withObject:nil waitUntilDone:[NSThread isMainThread]];
	}
}

/* ALWAYS CALLED ON MAIN THREAD! */
- (void)reportFinished
{
	if (delegate && [delegate respondsToSelector:didFinishSelector]) {
		[delegate performSelector:didFinishSelector withObject:self];
	}

	#if NS_BLOCKS_AVAILABLE
	if(completionBlock){
		completionBlock();
	}
	#endif

	if (queue && [queue respondsToSelector:@selector(requestFinished:)]) {
		[queue performSelector:@selector(requestFinished:) withObject:self];
	}
}

/* ALWAYS CALLED ON MAIN THREAD! */
- (void)reportFailure
{
	if (delegate && [delegate respondsToSelector:didFailSelector]) {
		[delegate performSelector:didFailSelector withObject:self];
	}

	#if NS_BLOCKS_AVAILABLE
    if(failureBlock){
        failureBlock();
    }
	#endif

	if (queue && [queue respondsToSelector:@selector(requestFailed:)]) {
		[queue performSelector:@selector(requestFailed:) withObject:self];
	}
}

/* ALWAYS CALLED ON MAIN THREAD! */
- (void)passOnReceivedData:(NSData *)data
{
	if (delegate && [delegate respondsToSelector:didReceiveDataSelector]) {
		[delegate performSelector:didReceiveDataSelector withObject:self withObject:data];
	}

	#if NS_BLOCKS_AVAILABLE
	if (dataReceivedBlock) {
		dataReceivedBlock(data);
	}
	#endif
}

// Subclasses might override this method to perform error handling in the same thread
// If you do this, don't forget to call [super failWithError:] to let the queue / delegate know we're done
- (void)failWithError:(NSError *)theError
{
#if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING
	ASI_DEBUG_LOG(@"[STATUS] Request %@: %@",self,(theError == ASIRequestCancelledError ? @"Cancelled" : @"Failed"));
#endif
	[self setComplete:YES];
	
	// Invalidate the current connection so subsequent requests don't attempt to reuse it
	if (theError && [theError code] != ASIAuthenticationErrorType && [theError code] != ASITooMuchRedirectionErrorType) {
		[connectionsLock lock];
		#if DEBUG_PERSISTENT_CONNECTIONS
		ASI_DEBUG_LOG(@"[CONNECTION] Request #%@ failed and will invalidate connection #%@",[self requestID],[[self connectionInfo] objectForKey:@"id"]);
		#endif
		[[self connectionInfo] removeObjectForKey:@"request"];
		[persistentConnectionsPool removeObject:[self connectionInfo]];
		[connectionsLock unlock];
		[self destroyReadStream];
	}
	if ([self connectionCanBeReused]) {
		[[self connectionInfo] setObject:[NSDate dateWithTimeIntervalSinceNow:[self persistentConnectionTimeoutSeconds]] forKey:@"expires"];
	}
	
    if ([self isCancelled] || [self error]) {
		return;
	}
	
	// If we have cached data, use it and ignore the error when using ASIFallbackToCacheIfLoadFailsCachePolicy
	if ([self downloadCache] && ([self cachePolicy] & ASIFallbackToCacheIfLoadFailsCachePolicy)) {
		if ([[self downloadCache] canUseCachedDataForRequest:self]) {
			[self useDataFromCache];
			return;
		}
	}
	
	
	[self setError:theError];
	
	ASIHTTPRequest *failedRequest = self;
	
	// If this is a HEAD request created by an ASINetworkQueue or compatible queue delegate, make the main request fail
	if ([self mainRequest]) {
		failedRequest = [self mainRequest];
		[failedRequest setError:theError];
	}

	if ([self isPACFileRequest]) {
		[failedRequest reportFailure];
	} else {
		[failedRequest performSelectorOnMainThread:@selector(reportFailure) withObject:nil waitUntilDone:[NSThread isMainThread]];
	}
	
    if (!inProgress)
    {
        // if we're not in progress, we can't notify the queue we've finished (doing so can cause a crash later on)
        // "markAsFinished" will be at the start of main() when we are started
        return;
    }
	[self markAsFinished];
}

#pragma mark parsing HTTP response headers

- (void)readResponseHeaders
{
	[self setAuthenticationNeeded:ASINoAuthenticationNeededYet];

	CFHTTPMessageRef message = (CFHTTPMessageRef)CFReadStreamCopyProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPResponseHeader);
	if (!message) {
		return;
	}
	
	// Make sure we've received all the headers
	if (!CFHTTPMessageIsHeaderComplete(message)) {
		CFRelease(message);
		return;
	}

	#if DEBUG_REQUEST_STATUS
	if ([self totalBytesSent] == [self postLength]) {
		ASI_DEBUG_LOG(@"[STATUS] Request %@ received response headers",self);
	}
	#endif		

	[self setResponseHeaders:[NSMakeCollectable(CFHTTPMessageCopyAllHeaderFields(message)) autorelease]];
	[self setResponseStatusCode:(int)CFHTTPMessageGetResponseStatusCode(message)];
	[self setResponseStatusMessage:[NSMakeCollectable(CFHTTPMessageCopyResponseStatusLine(message)) autorelease]];

	if ([self downloadCache] && ([[self downloadCache] canUseCachedDataForRequest:self])) {

		// Update the expiry date
		[[self downloadCache] updateExpiryForRequest:self maxAge:[self secondsToCache]];

		// Read the response from the cache
		[self useDataFromCache];

		CFRelease(message);
		return;
	}

	// Is the server response a challenge for credentials?
	if ([self responseStatusCode] == 401) {
		[self setAuthenticationNeeded:ASIHTTPAuthenticationNeeded];
	} else if ([self responseStatusCode] == 407) {
		[self setAuthenticationNeeded:ASIProxyAuthenticationNeeded];
	} else {
		#if DEBUG_HTTP_AUTHENTICATION
		if ([self authenticationScheme]) {
			ASI_DEBUG_LOG(@"[AUTH] Request %@ has passed %@ authentication",self,[self authenticationScheme]);
		}
		#endif
	}
		
	// Authentication succeeded, or no authentication was required
	if (![self authenticationNeeded]) {

		// Did we get here without an authentication challenge? (which can happen when shouldPresentCredentialsBeforeChallenge is YES and basic auth was successful)
		if (!requestAuthentication && [[self authenticationScheme] isEqualToString:(NSString *)kCFHTTPAuthenticationSchemeBasic] && [self username] && [self password] && [self useSessionPersistence]) {

			#if DEBUG_HTTP_AUTHENTICATION
			ASI_DEBUG_LOG(@"[AUTH] Request %@ passed BASIC authentication, and will save credentials in the session store for future use",self);
			#endif
			
			NSMutableDictionary *newCredentials = [NSMutableDictionary dictionaryWithCapacity:2];
			[newCredentials setObject:[self username] forKey:(NSString *)kCFHTTPAuthenticationUsername];
			[newCredentials setObject:[self password] forKey:(NSString *)kCFHTTPAuthenticationPassword];
			
			// Store the credentials in the session 
			NSMutableDictionary *sessionCredentials = [NSMutableDictionary dictionary];
			[sessionCredentials setObject:newCredentials forKey:@"Credentials"];
			[sessionCredentials setObject:[self url] forKey:@"URL"];
			[sessionCredentials setObject:(NSString *)kCFHTTPAuthenticationSchemeBasic forKey:@"AuthenticationScheme"];
			[[self class] storeAuthenticationCredentialsInSessionStore:sessionCredentials];
		}
	}

	// Read response textEncoding
	[self parseStringEncodingFromHeaders];

	// Handle cookies
	NSArray *newCookies = [NSHTTPCookie cookiesWithResponseHeaderFields:[self responseHeaders] forURL:[self url]];
	[self setResponseCookies:newCookies];
	
	if ([self useCookiePersistence]) {
		
		// Store cookies in global persistent store
		[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookies:newCookies forURL:[self url] mainDocumentURL:nil];
		
		// We also keep any cookies in the sessionCookies array, so that we have a reference to them if we need to remove them later
		NSHTTPCookie *cookie;
		for (cookie in newCookies) {
			[ASIHTTPRequest addSessionCookie:cookie];
		}
	}
	
	// Do we need to redirect?
	if (![self willRedirect]) {
		// See if we got a Content-length header
		NSString *cLength = [responseHeaders valueForKey:@"Content-Length"];
		ASIHTTPRequest *theRequest = self;
		if ([self mainRequest]) {
			theRequest = [self mainRequest];
		}

		if (cLength) {
			unsigned long long length = strtoull([cLength UTF8String], NULL, 0);

			// Workaround for Apache HEAD requests for dynamically generated content returning the wron
Download .txt
gitextract_h1qthytv/

├── .gitignore
├── DoubanAPIEngine/
│   ├── DoubanAPIEngine/
│   │   ├── DoubanAPIEngine-Prefix.pch
│   │   ├── OtherSources/
│   │   │   ├── ASIHTTPRequest/
│   │   │   │   ├── ASIAuthenticationDialog.h
│   │   │   │   ├── ASIAuthenticationDialog.m
│   │   │   │   ├── ASICacheDelegate.h
│   │   │   │   ├── ASIDataCompressor.h
│   │   │   │   ├── ASIDataCompressor.m
│   │   │   │   ├── ASIDataDecompressor.h
│   │   │   │   ├── ASIDataDecompressor.m
│   │   │   │   ├── ASIDownloadCache.h
│   │   │   │   ├── ASIDownloadCache.m
│   │   │   │   ├── ASIFormDataRequest.h
│   │   │   │   ├── ASIFormDataRequest.m
│   │   │   │   ├── ASIHTTPRequest.h
│   │   │   │   ├── ASIHTTPRequest.m
│   │   │   │   ├── ASIHTTPRequestConfig.h
│   │   │   │   ├── ASIHTTPRequestDelegate.h
│   │   │   │   ├── ASIInputStream.h
│   │   │   │   ├── ASIInputStream.m
│   │   │   │   ├── ASINetworkQueue.h
│   │   │   │   ├── ASINetworkQueue.m
│   │   │   │   ├── ASIProgressDelegate.h
│   │   │   │   ├── ASIWebPageRequest/
│   │   │   │   │   ├── ASIWebPageRequest.h
│   │   │   │   │   └── ASIWebPageRequest.m
│   │   │   │   ├── CloudFiles/
│   │   │   │   │   ├── ASICloudFilesCDNRequest.h
│   │   │   │   │   ├── ASICloudFilesCDNRequest.m
│   │   │   │   │   ├── ASICloudFilesContainer.h
│   │   │   │   │   ├── ASICloudFilesContainer.m
│   │   │   │   │   ├── ASICloudFilesContainerRequest.h
│   │   │   │   │   ├── ASICloudFilesContainerRequest.m
│   │   │   │   │   ├── ASICloudFilesContainerXMLParserDelegate.h
│   │   │   │   │   ├── ASICloudFilesContainerXMLParserDelegate.m
│   │   │   │   │   ├── ASICloudFilesObject.h
│   │   │   │   │   ├── ASICloudFilesObject.m
│   │   │   │   │   ├── ASICloudFilesObjectRequest.h
│   │   │   │   │   ├── ASICloudFilesObjectRequest.m
│   │   │   │   │   ├── ASICloudFilesRequest.h
│   │   │   │   │   └── ASICloudFilesRequest.m
│   │   │   │   └── S3/
│   │   │   │       ├── ASINSXMLParserCompat.h
│   │   │   │       ├── ASIS3Bucket.h
│   │   │   │       ├── ASIS3Bucket.m
│   │   │   │       ├── ASIS3BucketObject.h
│   │   │   │       ├── ASIS3BucketObject.m
│   │   │   │       ├── ASIS3BucketRequest.h
│   │   │   │       ├── ASIS3BucketRequest.m
│   │   │   │       ├── ASIS3ObjectRequest.h
│   │   │   │       ├── ASIS3ObjectRequest.m
│   │   │   │       ├── ASIS3Request.h
│   │   │   │       ├── ASIS3Request.m
│   │   │   │       ├── ASIS3ServiceRequest.h
│   │   │   │       └── ASIS3ServiceRequest.m
│   │   │   ├── Base64/
│   │   │   │   ├── NSData+Base64.h
│   │   │   │   └── NSData+Base64.m
│   │   │   ├── JSON/
│   │   │   │   ├── JSON.h
│   │   │   │   ├── NSObject+SBJson.h
│   │   │   │   ├── NSObject+SBJson.m
│   │   │   │   ├── SBJson.h
│   │   │   │   ├── SBJsonParser.h
│   │   │   │   ├── SBJsonParser.m
│   │   │   │   ├── SBJsonStreamParser.h
│   │   │   │   ├── SBJsonStreamParser.m
│   │   │   │   ├── SBJsonStreamParserAccumulator.h
│   │   │   │   ├── SBJsonStreamParserAccumulator.m
│   │   │   │   ├── SBJsonStreamParserAdapter.h
│   │   │   │   ├── SBJsonStreamParserAdapter.m
│   │   │   │   ├── SBJsonStreamParserState.h
│   │   │   │   ├── SBJsonStreamParserState.m
│   │   │   │   ├── SBJsonStreamWriter.h
│   │   │   │   ├── SBJsonStreamWriter.m
│   │   │   │   ├── SBJsonStreamWriterAccumulator.h
│   │   │   │   ├── SBJsonStreamWriterAccumulator.m
│   │   │   │   ├── SBJsonStreamWriterState.h
│   │   │   │   ├── SBJsonStreamWriterState.m
│   │   │   │   ├── SBJsonTokeniser.h
│   │   │   │   ├── SBJsonTokeniser.m
│   │   │   │   ├── SBJsonUTF8Stream.h
│   │   │   │   ├── SBJsonUTF8Stream.m
│   │   │   │   ├── SBJsonWriter.h
│   │   │   │   └── SBJsonWriter.m
│   │   │   └── Reachability/
│   │   │       ├── Reachability.h
│   │   │       └── Reachability.m
│   │   └── Sources/
│   │       ├── DOUAPIConfig.h
│   │       ├── DOUAPIConfig.m
│   │       ├── DOUAPIEngine.h
│   │       ├── Model/
│   │       │   ├── GData/
│   │       │   │   ├── BaseClasses/
│   │       │   │   │   ├── GDataEntryBase.h
│   │       │   │   │   ├── GDataEntryBase.m
│   │       │   │   │   ├── GDataFeedBase.h
│   │       │   │   │   ├── GDataFeedBase.m
│   │       │   │   │   ├── GDataObject.h
│   │       │   │   │   └── GDataObject.m
│   │       │   │   ├── Elements/
│   │       │   │   │   ├── GDataAtomPubControl.h
│   │       │   │   │   ├── GDataAtomPubControl.m
│   │       │   │   │   ├── GDataBaseElements.h
│   │       │   │   │   ├── GDataBaseElements.m
│   │       │   │   │   ├── GDataBatchID.h
│   │       │   │   │   ├── GDataBatchID.m
│   │       │   │   │   ├── GDataBatchInterrupted.h
│   │       │   │   │   ├── GDataBatchInterrupted.m
│   │       │   │   │   ├── GDataBatchOperation.h
│   │       │   │   │   ├── GDataBatchOperation.m
│   │       │   │   │   ├── GDataBatchStatus.h
│   │       │   │   │   ├── GDataBatchStatus.m
│   │       │   │   │   ├── GDataCategory.h
│   │       │   │   │   ├── GDataCategory.m
│   │       │   │   │   ├── GDataComment.h
│   │       │   │   │   ├── GDataComment.m
│   │       │   │   │   ├── GDataCustomProperty.h
│   │       │   │   │   ├── GDataCustomProperty.m
│   │       │   │   │   ├── GDataDateTime.h
│   │       │   │   │   ├── GDataDateTime.m
│   │       │   │   │   ├── GDataDeleted.h
│   │       │   │   │   ├── GDataDeleted.m
│   │       │   │   │   ├── GDataElements.h
│   │       │   │   │   ├── GDataEmail.h
│   │       │   │   │   ├── GDataEmail.m
│   │       │   │   │   ├── GDataEntryContent.h
│   │       │   │   │   ├── GDataEntryContent.m
│   │       │   │   │   ├── GDataEntryLink.h
│   │       │   │   │   ├── GDataEntryLink.m
│   │       │   │   │   ├── GDataExtendedProperty.h
│   │       │   │   │   ├── GDataExtendedProperty.m
│   │       │   │   │   ├── GDataFeedLink.h
│   │       │   │   │   ├── GDataFeedLink.m
│   │       │   │   │   ├── GDataGenerator.h
│   │       │   │   │   ├── GDataGenerator.m
│   │       │   │   │   ├── GDataGeoPt.h
│   │       │   │   │   ├── GDataGeoPt.m
│   │       │   │   │   ├── GDataIM.h
│   │       │   │   │   ├── GDataIM.m
│   │       │   │   │   ├── GDataLink.h
│   │       │   │   │   ├── GDataLink.m
│   │       │   │   │   ├── GDataMoney.h
│   │       │   │   │   ├── GDataMoney.m
│   │       │   │   │   ├── GDataName.h
│   │       │   │   │   ├── GDataName.m
│   │       │   │   │   ├── GDataOrganization.h
│   │       │   │   │   ├── GDataOrganization.m
│   │       │   │   │   ├── GDataOrganizationName.h
│   │       │   │   │   ├── GDataOrganizationName.m
│   │       │   │   │   ├── GDataPerson.h
│   │       │   │   │   ├── GDataPerson.m
│   │       │   │   │   ├── GDataPhoneNumber.h
│   │       │   │   │   ├── GDataPhoneNumber.m
│   │       │   │   │   ├── GDataPostalAddress.h
│   │       │   │   │   ├── GDataPostalAddress.m
│   │       │   │   │   ├── GDataRating.h
│   │       │   │   │   ├── GDataRating.m
│   │       │   │   │   ├── GDataStructuredPostalAddress.h
│   │       │   │   │   ├── GDataStructuredPostalAddress.m
│   │       │   │   │   ├── GDataTextConstruct.h
│   │       │   │   │   ├── GDataTextConstruct.m
│   │       │   │   │   ├── GDataValueConstruct.h
│   │       │   │   │   ├── GDataValueConstruct.m
│   │       │   │   │   ├── GDataWhen.h
│   │       │   │   │   ├── GDataWhen.m
│   │       │   │   │   ├── GDataWhere.h
│   │       │   │   │   ├── GDataWhere.m
│   │       │   │   │   ├── GDataWho.h
│   │       │   │   │   └── GDataWho.m
│   │       │   │   ├── GDataDefines.h
│   │       │   │   ├── GDataUtilities.h
│   │       │   │   ├── GDataUtilities.m
│   │       │   │   ├── HTTPFetcher/
│   │       │   │   │   ├── GTMGatherInputStream.h
│   │       │   │   │   ├── GTMGatherInputStream.m
│   │       │   │   │   ├── GTMMIMEDocument.h
│   │       │   │   │   └── GTMMIMEDocument.m
│   │       │   │   └── XMLSupport/
│   │       │   │       ├── GDataXMLNode.h
│   │       │   │       └── GDataXMLNode.m
│   │       │   └── GDataDoubanWrapper/
│   │       │       ├── Clients/
│   │       │       │   ├── Comment/
│   │       │       │   │   ├── DoubanEntryComment.h
│   │       │       │   │   ├── DoubanEntryComment.m
│   │       │       │   │   ├── DoubanFeedComment.h
│   │       │       │   │   └── DoubanFeedComment.m
│   │       │       │   ├── Event/
│   │       │       │   │   ├── DoubanEntryCity.h
│   │       │       │   │   ├── DoubanEntryCity.m
│   │       │       │   │   ├── DoubanEntryEvent.h
│   │       │       │   │   ├── DoubanEntryEvent.m
│   │       │       │   │   ├── DoubanEntryEventCategory.h
│   │       │       │   │   ├── DoubanEntryEventCategory.m
│   │       │       │   │   ├── DoubanFeedCity.h
│   │       │       │   │   ├── DoubanFeedCity.m
│   │       │       │   │   ├── DoubanFeedEvent.h
│   │       │       │   │   ├── DoubanFeedEvent.m
│   │       │       │   │   ├── DoubanFeedEventCategory.h
│   │       │       │   │   └── DoubanFeedEventCategory.m
│   │       │       │   ├── GDataAtomAuthor+Extension.h
│   │       │       │   ├── GDataAtomAuthor+Extension.m
│   │       │       │   ├── GDataEntryBase+Extension.h
│   │       │       │   ├── GDataEntryBase+Extension.m
│   │       │       │   ├── Miniblog/
│   │       │       │   │   ├── DoubanEntryMiniblog.h
│   │       │       │   │   ├── DoubanEntryMiniblog.m
│   │       │       │   │   ├── DoubanFeedMiniblog.h
│   │       │       │   │   └── DoubanFeedMiniblog.m
│   │       │       │   ├── People/
│   │       │       │   │   ├── DoubanEntryPeople.h
│   │       │       │   │   ├── DoubanEntryPeople.m
│   │       │       │   │   ├── DoubanFeedPeople.h
│   │       │       │   │   └── DoubanFeedPeople.m
│   │       │       │   ├── Photo/
│   │       │       │   │   ├── DoubanEntryAlbum.h
│   │       │       │   │   ├── DoubanEntryAlbum.m
│   │       │       │   │   ├── DoubanEntryPhoto.h
│   │       │       │   │   ├── DoubanEntryPhoto.m
│   │       │       │   │   ├── DoubanFeedAlbum.h
│   │       │       │   │   ├── DoubanFeedAlbum.m
│   │       │       │   │   ├── DoubanFeedPhoto.h
│   │       │       │   │   └── DoubanFeedPhoto.m
│   │       │       │   ├── Recommendation/
│   │       │       │   │   ├── DoubanEntryRecommendation.h
│   │       │       │   │   ├── DoubanEntryRecommendation.m
│   │       │       │   │   ├── DoubanFeedRecommendation.h
│   │       │       │   │   └── DoubanFeedRecommendation.m
│   │       │       │   ├── Review/
│   │       │       │   │   ├── DoubanEntryReview.h
│   │       │       │   │   ├── DoubanEntryReview.m
│   │       │       │   │   ├── DoubanFeedReview.h
│   │       │       │   │   └── DoubanFeedReview.m
│   │       │       │   └── Subject/
│   │       │       │       ├── DoubanEntrySubject.h
│   │       │       │       ├── DoubanEntrySubject.m
│   │       │       │       ├── DoubanFeedSubject.h
│   │       │       │       └── DoubanFeedSubject.m
│   │       │       ├── DoubanDefines.h
│   │       │       ├── DoubanDefines.m
│   │       │       └── Elements/
│   │       │           ├── DoubanAttribute.h
│   │       │           ├── DoubanAttribute.m
│   │       │           ├── DoubanLocation.h
│   │       │           ├── DoubanLocation.m
│   │       │           ├── DoubanSignature.h
│   │       │           ├── DoubanSignature.m
│   │       │           ├── DoubanTag.h
│   │       │           ├── DoubanTag.m
│   │       │           ├── DoubanUID.h
│   │       │           ├── DoubanUID.m
│   │       │           ├── GeorssPoint.h
│   │       │           └── GeorssPoint.m
│   │       ├── Model2/
│   │       │   ├── Book/
│   │       │   │   ├── DOUAnnotation.h
│   │       │   │   ├── DOUAnnotation.m
│   │       │   │   ├── DOUAnnotationArray.h
│   │       │   │   ├── DOUAnnotationArray.m
│   │       │   │   ├── DOUBook.h
│   │       │   │   ├── DOUBook.m
│   │       │   │   ├── DOUBookArray.h
│   │       │   │   └── DOUBookArray.m
│   │       │   ├── Collection/
│   │       │   │   ├── DOUCollection.h
│   │       │   │   ├── DOUCollection.m
│   │       │   │   ├── DOUCollectionArray.h
│   │       │   │   └── DOUCollectionArray.m
│   │       │   ├── Community/
│   │       │   │   ├── DOUComment.h
│   │       │   │   ├── DOUComment.m
│   │       │   │   ├── DOUCommentArray.h
│   │       │   │   ├── DOUCommentArray.m
│   │       │   │   ├── DOUNote.h
│   │       │   │   ├── DOUNote.m
│   │       │   │   ├── DOUNoteArray.h
│   │       │   │   ├── DOUNoteArray.m
│   │       │   │   ├── DOUNotification.h
│   │       │   │   ├── DOUNotification.m
│   │       │   │   ├── DOUNotificationArray.h
│   │       │   │   ├── DOUNotificationArray.m
│   │       │   │   ├── DOUOnline.h
│   │       │   │   ├── DOUOnline.m
│   │       │   │   ├── DOUOnlineArray.h
│   │       │   │   ├── DOUOnlineArray.m
│   │       │   │   ├── DOUUser.h
│   │       │   │   └── DOUUser.m
│   │       │   ├── DOUObject+Utils.h
│   │       │   ├── DOUObject+Utils.m
│   │       │   ├── DOUObject.h
│   │       │   ├── DOUObject.m
│   │       │   ├── DOUObjectArray.h
│   │       │   ├── DOUObjectArray.m
│   │       │   ├── Event/
│   │       │   │   ├── DOUEvent.h
│   │       │   │   ├── DOUEvent.m
│   │       │   │   ├── DOUEventArray.h
│   │       │   │   ├── DOUEventArray.m
│   │       │   │   ├── DOULoc.h
│   │       │   │   ├── DOULoc.m
│   │       │   │   ├── DOULocArray.h
│   │       │   │   └── DOULocArray.m
│   │       │   ├── Movie/
│   │       │   │   ├── DOUMovie.h
│   │       │   │   ├── DOUMovie.m
│   │       │   │   ├── DOUMovieArray.h
│   │       │   │   └── DOUMovieArray.m
│   │       │   ├── Music/
│   │       │   │   ├── DOUMusic.h
│   │       │   │   ├── DOUMusic.m
│   │       │   │   ├── DOUMusicArray.h
│   │       │   │   └── DOUMusicArray.m
│   │       │   ├── Photo/
│   │       │   │   ├── DOUAlbum.h
│   │       │   │   ├── DOUAlbum.m
│   │       │   │   ├── DOUAlbumArray.h
│   │       │   │   ├── DOUAlbumArray.m
│   │       │   │   ├── DOUPhoto.h
│   │       │   │   ├── DOUPhoto.m
│   │       │   │   ├── DOUPhotoArray.h
│   │       │   │   └── DOUPhotoArray.m
│   │       │   └── Tag/
│   │       │       ├── DOUTag.h
│   │       │       ├── DOUTag.m
│   │       │       ├── DOUTagArray.h
│   │       │       ├── DOUTagArray.m
│   │       │       ├── DOUUserTag.h
│   │       │       ├── DOUUserTag.m
│   │       │       ├── DOUUserTagArray.h
│   │       │       └── DOUUserTagArray.m
│   │       ├── Network/
│   │       │   ├── DOUHttpRequest.h
│   │       │   ├── DOUHttpRequest.m
│   │       │   ├── DOUQuery.h
│   │       │   ├── DOUQuery.m
│   │       │   ├── DOUService.h
│   │       │   └── DOUService.m
│   │       └── OAuth2/
│   │           ├── DOUOAuth2.h
│   │           ├── DOUOAuthService.h
│   │           ├── DOUOAuthService.m
│   │           ├── DOUOAuthStore.h
│   │           └── DOUOAuthStore.m
│   ├── DoubanAPIEngine.xcodeproj/
│   │   └── project.pbxproj
│   └── DoubanAPIEngineTests/
│       ├── DOUOAuthServiceTests.m
│       ├── DoubanAPIEngineTests-Info.plist
│       ├── DoubanAPIEngineTests.m
│       ├── Model/
│       │   ├── DoubanCityTests.m
│       │   ├── DoubanCommentTests.m
│       │   ├── DoubanEventCategoryTests.m
│       │   ├── DoubanEventTests.m
│       │   ├── DoubanMiniblogTests.m
│       │   ├── DoubanPeopleTests.m
│       │   ├── DoubanPhotoTests.m
│       │   └── DoubanSubjectTests.m
│       ├── Model2/
│       │   ├── DOUBookTests.m
│       │   ├── DOUCommentTests.m
│       │   ├── DOUMovieTests.m
│       │   ├── DOUMusicTests.m
│       │   ├── DOUNoteTests.m
│       │   ├── DOUOnlineTests.m
│       │   └── DOUPhotoTests.m
│       ├── Resources/
│       │   ├── Model/
│       │   │   ├── DoubanEntryCity.xml
│       │   │   ├── DoubanEntryEvent.xml
│       │   │   ├── DoubanEntryMiniblog.xml
│       │   │   ├── DoubanEntryPeople.xml
│       │   │   ├── DoubanEntryPhoto.xml
│       │   │   ├── DoubanEntryRecommendation.xml
│       │   │   ├── DoubanEntrySubject.xml
│       │   │   ├── DoubanFeedCity.xml
│       │   │   ├── DoubanFeedComment.xml
│       │   │   ├── DoubanFeedEvent.xml
│       │   │   ├── DoubanFeedEventCategory.xml
│       │   │   ├── DoubanFeedMiniblog.xml
│       │   │   ├── DoubanFeedPeople.xml
│       │   │   ├── DoubanFeedPhoto.xml
│       │   │   ├── DoubanFeedRecommendation.xml
│       │   │   └── DoubanFeedSubject.xml
│       │   └── Model2/
│       │       ├── Album.json
│       │       ├── BookArray.json
│       │       ├── CommentArray.json
│       │       ├── Event.json
│       │       ├── MovieArray.json
│       │       ├── MusicArray.json
│       │       ├── Note.json
│       │       ├── Online.json
│       │       ├── OnlineArray.json
│       │       ├── Photo.json
│       │       └── PhotoArray.json
│       ├── Testing/
│       │   ├── DOUTestResponseLoader.h
│       │   └── DOUTestResponseLoader.m
│       └── en.lproj/
│           └── InfoPlist.strings
├── DoubanAPIEngineDemo/
│   ├── DoubanAPIEngineDemo/
│   │   ├── AppDelegate.h
│   │   ├── AppDelegate.m
│   │   ├── DoubanAPIEngineDemo-Info.plist
│   │   ├── DoubanAPIEngineDemo-Prefix.pch
│   │   ├── DoubanQueryEvent.h
│   │   ├── DoubanQueryEvent.m
│   │   ├── GetEventController.h
│   │   ├── GetEventController.m
│   │   ├── NavController.h
│   │   ├── NavController.m
│   │   ├── NavController.xib
│   │   ├── PhotosController.h
│   │   ├── PhotosController.m
│   │   ├── StatusController.h
│   │   ├── StatusController.m
│   │   ├── WebViewController.h
│   │   ├── WebViewController.m
│   │   ├── en.lproj/
│   │   │   ├── GetEventController.xib
│   │   │   └── InfoPlist.strings
│   │   └── main.m
│   └── DoubanAPIEngineDemo.xcodeproj/
│       └── project.pbxproj
├── README.markdown
└── libDoubanApiEngine.framework/
    └── Versions/
        └── A/
            ├── Headers/
            │   ├── ASICacheDelegate.h
            │   ├── ASIHTTPRequest.h
            │   ├── ASIHTTPRequestConfig.h
            │   ├── ASIHTTPRequestDelegate.h
            │   ├── ASIProgressDelegate.h
            │   ├── DOUAPIConfig.h
            │   ├── DOUAPIEngine.h
            │   ├── DOUAlbum.h
            │   ├── DOUAlbumArray.h
            │   ├── DOUBook.h
            │   ├── DOUBookArray.h
            │   ├── DOUComment.h
            │   ├── DOUCommentArray.h
            │   ├── DOUEvent.h
            │   ├── DOUEventArray.h
            │   ├── DOUHttpRequest.h
            │   ├── DOULoc.h
            │   ├── DOULocArray.h
            │   ├── DOUMovie.h
            │   ├── DOUMovieArray.h
            │   ├── DOUMusic.h
            │   ├── DOUMusicArray.h
            │   ├── DOUNote.h
            │   ├── DOUNoteArray.h
            │   ├── DOUOAuth2.h
            │   ├── DOUOAuthService.h
            │   ├── DOUOAuthStore.h
            │   ├── DOUObject+Utils.h
            │   ├── DOUObject.h
            │   ├── DOUObjectArray.h
            │   ├── DOUOnline.h
            │   ├── DOUOnlineArray.h
            │   ├── DOUPhoto.h
            │   ├── DOUPhotoArray.h
            │   ├── DOUQuery.h
            │   ├── DOUService.h
            │   ├── DOUUser.h
            │   ├── DoubanAttribute.h
            │   ├── DoubanDefines.h
            │   ├── DoubanEntryAlbum.h
            │   ├── DoubanEntryCity.h
            │   ├── DoubanEntryComment.h
            │   ├── DoubanEntryEvent.h
            │   ├── DoubanEntryEventCategory.h
            │   ├── DoubanEntryMiniblog.h
            │   ├── DoubanEntryPeople.h
            │   ├── DoubanEntryPhoto.h
            │   ├── DoubanEntryRecommendation.h
            │   ├── DoubanEntryReview.h
            │   ├── DoubanEntrySubject.h
            │   ├── DoubanFeedAlbum.h
            │   ├── DoubanFeedCity.h
            │   ├── DoubanFeedComment.h
            │   ├── DoubanFeedEvent.h
            │   ├── DoubanFeedEventCategory.h
            │   ├── DoubanFeedMiniblog.h
            │   ├── DoubanFeedPeople.h
            │   ├── DoubanFeedPhoto.h
            │   ├── DoubanFeedRecommendation.h
            │   ├── DoubanFeedReview.h
            │   ├── DoubanFeedSubject.h
            │   ├── DoubanLocation.h
            │   ├── DoubanSignature.h
            │   ├── DoubanTag.h
            │   ├── DoubanUID.h
            │   ├── GDataAtomPubControl.h
            │   ├── GDataBaseElements.h
            │   ├── GDataBatchID.h
            │   ├── GDataBatchInterrupted.h
            │   ├── GDataBatchOperation.h
            │   ├── GDataBatchStatus.h
            │   ├── GDataCategory.h
            │   ├── GDataComment.h
            │   ├── GDataCustomProperty.h
            │   ├── GDataDateTime.h
            │   ├── GDataDefines.h
            │   ├── GDataDeleted.h
            │   ├── GDataElements.h
            │   ├── GDataEmail.h
            │   ├── GDataEntryBase.h
            │   ├── GDataEntryContent.h
            │   ├── GDataEntryLink.h
            │   ├── GDataExtendedProperty.h
            │   ├── GDataFeedBase.h
            │   ├── GDataFeedLink.h
            │   ├── GDataGenerator.h
            │   ├── GDataGeoPt.h
            │   ├── GDataIM.h
            │   ├── GDataLink.h
            │   ├── GDataMoney.h
            │   ├── GDataName.h
            │   ├── GDataObject.h
            │   ├── GDataOrganization.h
            │   ├── GDataOrganizationName.h
            │   ├── GDataPerson.h
            │   ├── GDataPhoneNumber.h
            │   ├── GDataPostalAddress.h
            │   ├── GDataRating.h
            │   ├── GDataStructuredPostalAddress.h
            │   ├── GDataTextConstruct.h
            │   ├── GDataUtilities.h
            │   ├── GDataValueConstruct.h
            │   ├── GDataWhen.h
            │   ├── GDataWhere.h
            │   ├── GDataWho.h
            │   ├── GDataXMLNode.h
            │   ├── GTMGatherInputStream.h
            │   ├── GTMMIMEDocument.h
            │   └── GeorssPoint.h
            └── libDoubanApiEngine
Download .txt
SYMBOL INDEX (102 symbols across 85 files)

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIAuthenticationDialog.h
  type ASIAuthenticationType (line 13) | typedef enum _ASIAuthenticationType {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASICacheDelegate.h
  type ASICachePolicy (line 16) | typedef enum _ASICachePolicy {
  type ASICacheStoragePolicy (line 46) | typedef enum _ASICacheStoragePolicy {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIDataCompressor.h
  function interface (line 16) | interface ASIDataCompressor : NSObject {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIDataDecompressor.h
  function interface (line 16) | interface ASIDataDecompressor : NSObject {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIDownloadCache.h
  function interface (line 12) | interface ASIDownloadCache : NSObject <ASICacheDelegate> {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIFormDataRequest.h
  type ASIPostFormat (line 13) | typedef enum _ASIPostFormat {
  function interface (line 19) | interface ASIFormDataRequest : ASIHTTPRequest <NSCopying> {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIHTTPRequest.h
  type ASIAuthenticationState (line 46) | typedef enum _ASIAuthenticationState {
  type ASINetworkErrorType (line 52) | typedef enum _ASINetworkErrorType {
  function interface (line 84) | interface ASIHTTPRequest : NSOperation <NSCopying> {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIInputStream.h
  function interface (line 17) | interface ASIInputStream : NSObject {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIWebPageRequest/ASIWebPageRequest.h
  type ASIWebContentType (line 18) | typedef enum _ASIWebContentType {
  type ASIURLReplacementMode (line 25) | typedef enum _ASIURLReplacementMode {
  function interface (line 42) | interface ASIWebPageRequest : ASIHTTPRequest {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesCDNRequest.h
  function interface (line 11) | interface ASICloudFilesCDNRequest : ASICloudFilesRequest {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesContainer.h
  function interface (line 10) | interface ASICloudFilesContainer : NSObject {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesContainerRequest.h
  function interface (line 11) | interface ASICloudFilesContainerRequest : ASICloudFilesRequest {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesContainerXMLParserDelegate.h
  function interface (line 15) | interface ASICloudFilesContainerXMLParserDelegate : NSObject <NSXMLParse...

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesObject.h
  function interface (line 10) | interface ASICloudFilesObject : NSObject {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesObjectRequest.h
  function interface (line 15) | interface ASICloudFilesObjectRequest : ASICloudFilesRequest <NSXMLParser...

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesRequest.h
  function interface (line 20) | interface ASICloudFilesRequest : ASIHTTPRequest {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/S3/ASIS3Bucket.h
  function interface (line 15) | interface ASIS3Bucket : NSObject {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/S3/ASIS3BucketObject.h
  function interface (line 14) | interface ASIS3BucketObject : NSObject <NSCopying> {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/S3/ASIS3BucketRequest.h
  function interface (line 15) | interface ASIS3BucketRequest : ASIS3Request {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/S3/ASIS3ObjectRequest.h
  function interface (line 17) | interface ASIS3ObjectRequest : ASIS3Request {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/S3/ASIS3Request.h
  type ASIS3ErrorType (line 32) | typedef enum _ASIS3ErrorType {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/S3/ASIS3ServiceRequest.h
  function interface (line 15) | interface ASIS3ServiceRequest : ASIS3Request {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonParser.h
  function interface (line 41) | interface SBJsonParser : NSObject {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonStreamParser.h
  type SBJsonStreamParserStatus (line 39) | typedef enum {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonStreamParserAccumulator.h
  function interface (line 33) | interface SBJsonStreamParserAccumulator : NSObject <SBJsonStreamParserAd...

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonStreamParserAdapter.h
  type SBJsonStreamParserAdapterType (line 36) | typedef enum {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonStreamWriter.h
  function interface (line 85) | interface SBJsonStreamWriter : NSObject {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonStreamWriterAccumulator.h
  function interface (line 32) | interface SBJsonStreamWriterAccumulator : NSObject <SBJsonStreamWriterDe...

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonTokeniser.h
  type sbjson_token_t (line 35) | typedef enum {
  function interface (line 58) | interface SBJsonTokeniser : NSObject {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonUTF8Stream.h
  function interface (line 35) | interface SBJsonUTF8Stream : NSObject {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonWriter.h
  function interface (line 40) | interface SBJsonWriter : NSObject {

FILE: DoubanAPIEngine/DoubanAPIEngine/OtherSources/Reachability/Reachability.h
  type NetworkStatus (line 122) | typedef	uint32_t NetworkStatus;
  function interface (line 138) | interface Reachability: NSObject {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/BaseClasses/GDataEntryBase.h
  function interface (line 48) | interface GDataEntryBase : GDataObject <NSCopying> {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/BaseClasses/GDataFeedBase.h
  function interface (line 47) | interface GDataFeedBase : GDataObject <NSFastEnumeration> {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/BaseClasses/GDataObject.h
  type GDataDescRecTypes (line 177) | enum GDataDescRecTypes {
  type GDataDescriptionRecord (line 188) | typedef struct GDataDescriptionRecord {
  function interface (line 195) | interface GDataObject : NSObject <NSCopying> {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataBatchID.h
  function interface (line 25) | interface GDataBatchID : GDataObject <GDataExtension> {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataBatchInterrupted.h
  function interface (line 26) | interface GDataBatchInterrupted : GDataObject <GDataExtension> {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataBatchStatus.h
  function interface (line 33) | interface GDataBatchStatus : GDataObject <GDataExtension> {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataComment.h
  function interface (line 33) | interface GDataComment : GDataObject <GDataExtension> {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataDateTime.h
  function interface (line 23) | interface GDataDateTime : NSObject <NSCopying> {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataEntryContent.h
  function interface (line 47) | interface GDataEntryContent : GDataObject {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataEntryLink.h
  function interface (line 26) | interface GDataEntryLink : GDataObject <GDataExtension> {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataGenerator.h
  function interface (line 24) | interface GDataGenerator : GDataObject <GDataExtension> {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataIM.h
  function interface (line 51) | interface GDataIM : GDataObject <GDataExtension> {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataPhoneNumber.h
  function interface (line 64) | interface GDataPhoneNumber : GDataObject <GDataExtension> {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataPostalAddress.h
  function interface (line 32) | interface GDataPostalAddress : GDataObject <GDataExtension> {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataTextConstruct.h
  function interface (line 25) | interface GDataTextConstruct : GDataObject {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataWhen.h
  function interface (line 32) | interface GDataWhen : GDataObject <GDataExtension> {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/HTTPFetcher/GTMGatherInputStream.h
  function interface (line 44) | interface GTMGatherInputStream : NSInputStream GTM_NSSTREAM_DELEGATE {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/HTTPFetcher/GTMMIMEDocument.h
  function interface (line 33) | interface GTMMIMEDocument : NSObject {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/XMLSupport/GDataXMLNode.h
  type NSUInteger (line 95) | typedef NSUInteger GDataXMLNodeKind;
  function interface (line 97) | interface GDataXMLNode : NSObject <NSCopying> {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Miniblog/DoubanEntryMiniblog.h
  type MiniblogCategory (line 27) | typedef enum {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Photo/DoubanEntryPhoto.h
  function interface (line 24) | interface DoubanEntryPhoto : GDataEntryBase {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Network/DOUHttpRequest.h
  type _DOUNetworkErrorType (line 31) | enum _DOUNetworkErrorType {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Network/DOUQuery.h
  function interface (line 14) | interface DOUQuery : NSObject {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/Network/DOUService.h
  function interface (line 14) | interface DOUService : NSObject {

FILE: DoubanAPIEngine/DoubanAPIEngine/Sources/OAuth2/DOUOAuthStore.h
  function interface (line 11) | interface DOUOAuthStore : NSObject {

FILE: DoubanAPIEngineDemo/DoubanAPIEngineDemo/GetEventController.h
  function interface (line 11) | interface GetEventController : UIViewController {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/ASICacheDelegate.h
  type ASICachePolicy (line 16) | typedef enum _ASICachePolicy {
  type ASICacheStoragePolicy (line 46) | typedef enum _ASICacheStoragePolicy {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/ASIHTTPRequest.h
  type ASIAuthenticationState (line 46) | typedef enum _ASIAuthenticationState {
  type ASINetworkErrorType (line 52) | typedef enum _ASINetworkErrorType {
  function interface (line 84) | interface ASIHTTPRequest : NSOperation <NSCopying> {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/DOUHttpRequest.h
  type _DOUNetworkErrorType (line 31) | enum _DOUNetworkErrorType {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/DOUOAuthStore.h
  function interface (line 11) | interface DOUOAuthStore : NSObject {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/DOUQuery.h
  function interface (line 14) | interface DOUQuery : NSObject {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/DOUService.h
  function interface (line 14) | interface DOUService : NSObject {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/DoubanEntryMiniblog.h
  type MiniblogCategory (line 27) | typedef enum {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/DoubanEntryPhoto.h
  function interface (line 24) | interface DoubanEntryPhoto : GDataEntryBase {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/GDataBatchID.h
  function interface (line 25) | interface GDataBatchID : GDataObject <GDataExtension> {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/GDataBatchInterrupted.h
  function interface (line 26) | interface GDataBatchInterrupted : GDataObject <GDataExtension> {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/GDataBatchStatus.h
  function interface (line 33) | interface GDataBatchStatus : GDataObject <GDataExtension> {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/GDataComment.h
  function interface (line 33) | interface GDataComment : GDataObject <GDataExtension> {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/GDataDateTime.h
  function interface (line 23) | interface GDataDateTime : NSObject <NSCopying> {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/GDataEntryBase.h
  function interface (line 48) | interface GDataEntryBase : GDataObject <NSCopying> {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/GDataEntryContent.h
  function interface (line 47) | interface GDataEntryContent : GDataObject {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/GDataEntryLink.h
  function interface (line 26) | interface GDataEntryLink : GDataObject <GDataExtension> {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/GDataFeedBase.h
  function interface (line 47) | interface GDataFeedBase : GDataObject <NSFastEnumeration> {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/GDataGenerator.h
  function interface (line 24) | interface GDataGenerator : GDataObject <GDataExtension> {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/GDataIM.h
  function interface (line 51) | interface GDataIM : GDataObject <GDataExtension> {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/GDataObject.h
  type GDataDescRecTypes (line 177) | enum GDataDescRecTypes {
  type GDataDescriptionRecord (line 188) | typedef struct GDataDescriptionRecord {
  function interface (line 195) | interface GDataObject : NSObject <NSCopying> {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/GDataPhoneNumber.h
  function interface (line 64) | interface GDataPhoneNumber : GDataObject <GDataExtension> {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/GDataPostalAddress.h
  function interface (line 32) | interface GDataPostalAddress : GDataObject <GDataExtension> {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/GDataTextConstruct.h
  function interface (line 25) | interface GDataTextConstruct : GDataObject {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/GDataWhen.h
  function interface (line 32) | interface GDataWhen : GDataObject <GDataExtension> {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/GDataXMLNode.h
  type NSUInteger (line 95) | typedef NSUInteger GDataXMLNodeKind;
  function interface (line 97) | interface GDataXMLNode : NSObject <NSCopying> {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/GTMGatherInputStream.h
  function interface (line 44) | interface GTMGatherInputStream : NSInputStream GTM_NSSTREAM_DELEGATE {

FILE: libDoubanApiEngine.framework/Versions/A/Headers/GTMMIMEDocument.h
  function interface (line 33) | interface GTMMIMEDocument : NSObject {
Condensed preview — 490 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,042K chars).
[
  {
    "path": ".gitignore",
    "chars": 75,
    "preview": "\n#global\n*.orig\n\n#ios\n.DS_Store\nbuild/\n*~\nproject.xcworkspace/\nxcuserdata/\n"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/DoubanAPIEngine-Prefix.pch",
    "chars": 169,
    "preview": "//\n// Prefix header for all source files of the 'DoubanAPIEngine' target in the 'DoubanAPIEngine' project\n//\n\n#ifdef __O"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIAuthenticationDialog.h",
    "chars": 1107,
    "preview": "//\n//  ASIAuthenticationDialog.h\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by B"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIAuthenticationDialog.m",
    "chars": 15880,
    "preview": "//\n//  ASIAuthenticationDialog.m\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by B"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASICacheDelegate.h",
    "chars": 5151,
    "preview": "//\n//  ASICacheDelegate.h\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Cops"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIDataCompressor.h",
    "chars": 1836,
    "preview": "//\n//  ASIDataCompressor.h\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Cop"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIDataCompressor.m",
    "chars": 6755,
    "preview": "//\n//  ASIDataCompressor.m\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Cop"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIDataDecompressor.h",
    "chars": 1699,
    "preview": "//\n//  ASIDataDecompressor.h\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben C"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIDataDecompressor.m",
    "chars": 6422,
    "preview": "//\n//  ASIDataDecompressor.m\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben C"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIDownloadCache.h",
    "chars": 1996,
    "preview": "//\n//  ASIDownloadCache.h\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Cops"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIDownloadCache.m",
    "chars": 17761,
    "preview": "//\n//  ASIDownloadCache.m\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Cops"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIFormDataRequest.h",
    "chars": 2693,
    "preview": "//\n//  ASIFormDataRequest.h\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Co"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIFormDataRequest.m",
    "chars": 11266,
    "preview": "//\n//  ASIFormDataRequest.m\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Co"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIHTTPRequest.h",
    "chars": 45011,
    "preview": "//\n//  ASIHTTPRequest.h\n//\n//  Created by Ben Copsey on 04/10/2007.\n//  Copyright 2007-2011 All-Seeing Interactive. All "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIHTTPRequest.m",
    "chars": 184116,
    "preview": "//\n//  ASIHTTPRequest.m\n//\n//  Created by Ben Copsey on 04/10/2007.\n//  Copyright 2007-2011 All-Seeing Interactive. All "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIHTTPRequestConfig.h",
    "chars": 1297,
    "preview": "//\n//  ASIHTTPRequestConfig.h\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIHTTPRequestDelegate.h",
    "chars": 1598,
    "preview": "//\n//  ASIHTTPRequestDelegate.h\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Be"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIInputStream.h",
    "chars": 969,
    "preview": "//\n//  ASIInputStream.h\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Copsey"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIInputStream.m",
    "chars": 3122,
    "preview": "//\n//  ASIInputStream.m\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Copsey"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASINetworkQueue.h",
    "chars": 4621,
    "preview": "//\n//  ASINetworkQueue.h\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Copse"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASINetworkQueue.m",
    "chars": 11405,
    "preview": "//\n//  ASINetworkQueue.m\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Copse"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIProgressDelegate.h",
    "chars": 1656,
    "preview": "//\n//  ASIProgressDelegate.h\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben C"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIWebPageRequest/ASIWebPageRequest.h",
    "chars": 3673,
    "preview": "//\n//  ASIWebPageRequest.h\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Cop"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/ASIWebPageRequest/ASIWebPageRequest.m",
    "chars": 31494,
    "preview": "//\n//  ASIWebPageRequest.m\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Cop"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesCDNRequest.h",
    "chars": 1931,
    "preview": "//\n//  ASICloudFilesCDNRequest.h\n//\n//  Created by Michael Mayo on 1/6/10.\n//\n\n#import \"ASICloudFilesRequest.h\"\n\n@class "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesCDNRequest.m",
    "chars": 5592,
    "preview": "//\n//  ASICloudFilesCDNRequest.m\n//\n//  Created by Michael Mayo on 1/6/10.\n//\n\n#import \"ASICloudFilesCDNRequest.h\"\n#impo"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesContainer.h",
    "chars": 833,
    "preview": "//\n//  ASICloudFilesContainer.h\n//\n//  Created by Michael Mayo on 1/7/10.\n//\n\n#import <Foundation/Foundation.h>\n\n\n@inter"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesContainer.m",
    "chars": 568,
    "preview": "//\n//  ASICloudFilesContainer.m\n//\n//  Created by Michael Mayo on 1/7/10.\n//\n\n#import \"ASICloudFilesContainer.h\"\n\n\n@impl"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesContainerRequest.h",
    "chars": 1474,
    "preview": "//\n//  ASICloudFilesContainerRequest.h\n//\n//  Created by Michael Mayo on 1/6/10.\n//\n\n#import \"ASICloudFilesRequest.h\"\n\n@"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesContainerRequest.m",
    "chars": 4483,
    "preview": "//\n//  ASICloudFilesContainerRequest.m\n//\n//  Created by Michael Mayo on 1/6/10.\n//\n\n#import \"ASICloudFilesContainerRequ"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesContainerXMLParserDelegate.h",
    "chars": 774,
    "preview": "//\n//  ASICloudFilesContainerXMLParserDelegate.h\n//\n//  Created by Michael Mayo on 1/10/10.\n//\n\n#import \"ASICloudFilesRe"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesContainerXMLParserDelegate.m",
    "chars": 2637,
    "preview": "//\n//  ASICloudFilesContainerXMLParserDelegate.m\n//\n//  Created by Michael Mayo on 1/10/10.\n//\n\n#import \"ASICloudFilesCo"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesObject.h",
    "chars": 600,
    "preview": "//\n//  ASICloudFilesObject.h\n//\n//  Created by Michael Mayo on 1/7/10.\n//\n\n#import <Foundation/Foundation.h>\n\n\n@interfac"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesObject.m",
    "chars": 485,
    "preview": "//\n//  ASICloudFilesObject.m\n//\n//  Created by Michael Mayo on 1/7/10.\n//\n\n#import \"ASICloudFilesObject.h\"\n\n\n@implementa"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesObjectRequest.h",
    "chars": 3534,
    "preview": "//\n//  ASICloudFilesObjectRequest.h\n//\n//  Created by Michael Mayo on 1/6/10.\n//\n\n#import \"ASICloudFilesRequest.h\"\n\n#if "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesObjectRequest.m",
    "chars": 10581,
    "preview": "//\n//  ASICloudFilesObjectRequest.m\n//\n//  Created by Michael Mayo on 1/6/10.\n//\n\n#import \"ASICloudFilesObjectRequest.h\""
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesRequest.h",
    "chars": 1076,
    "preview": "//\n//  ASICloudFilesRequest.h\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Mich"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/CloudFiles/ASICloudFilesRequest.m",
    "chars": 3790,
    "preview": "//\n//  ASICloudFilesRequest.m\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Mich"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/S3/ASINSXMLParserCompat.h",
    "chars": 867,
    "preview": "//\n//  ASINSXMLParserCompat.h\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//  This file exists t"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/S3/ASIS3Bucket.h",
    "chars": 972,
    "preview": "//\n//  ASIS3Bucket.h\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Copsey on"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/S3/ASIS3Bucket.m",
    "chars": 886,
    "preview": "//\n//  ASIS3Bucket.m\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Copsey on"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/S3/ASIS3BucketObject.h",
    "chars": 1550,
    "preview": "//\n//  ASIS3BucketObject.h\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Cop"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/S3/ASIS3BucketObject.m",
    "chars": 1927,
    "preview": "//\n//  ASIS3BucketObject.m\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Cop"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/S3/ASIS3BucketRequest.h",
    "chars": 2606,
    "preview": "//\n//  ASIS3BucketRequest.h\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Co"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/S3/ASIS3BucketRequest.m",
    "chars": 6167,
    "preview": "//\n//  ASIS3BucketRequest.m\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Co"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/S3/ASIS3ObjectRequest.h",
    "chars": 3612,
    "preview": "//\n//  ASIS3ObjectRequest.h\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Co"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/S3/ASIS3ObjectRequest.m",
    "chars": 5427,
    "preview": "//\n//  ASIS3ObjectRequest.m\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Co"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/S3/ASIS3Request.h",
    "chars": 4326,
    "preview": "//\n//  ASIS3Request.h\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Copsey o"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/S3/ASIS3Request.m",
    "chars": 10492,
    "preview": "//\n//  ASIS3Request.m\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben Copsey o"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/S3/ASIS3ServiceRequest.h",
    "chars": 805,
    "preview": "//\n//  ASIS3ServiceRequest.h\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben C"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/ASIHTTPRequest/S3/ASIS3ServiceRequest.m",
    "chars": 2635,
    "preview": "//\n//  ASIS3ServiceRequest.m\n//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest\n//\n//  Created by Ben C"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/Base64/NSData+Base64.h",
    "chars": 1378,
    "preview": "//\n//  NSData+Base64.h\n//  base64\n//\n//  Created by Matt Gallagher on 2009/06/03.\n//  Copyright 2009 Matt Gallagher. All"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/Base64/NSData+Base64.m",
    "chars": 8869,
    "preview": "//\n//  NSData+Base64.m\n//  base64\n//\n//  Created by Matt Gallagher on 2009/06/03.\n//  Copyright 2009 Matt Gallagher. All"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/JSON.h",
    "chars": 277,
    "preview": "//\n//  JSON.h\n//  SBJson\n//\n//  Created by Stig Brautaset on 01/06/2011.\n//  Copyright 2011 Stig Brautaset. All rights r"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/NSObject+SBJson.h",
    "chars": 2231,
    "preview": "/*\n Copyright (C) 2009 Stig Brautaset. All rights reserved.\n \n Redistribution and use in source and binary forms, with o"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/NSObject+SBJson.m",
    "chars": 2214,
    "preview": "/*\n Copyright (C) 2009 Stig Brautaset. All rights reserved.\n \n Redistribution and use in source and binary forms, with o"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJson.h",
    "chars": 3490,
    "preview": "/*\n Copyright (C) 2009-2011 Stig Brautaset. All rights reserved.\n \n Redistribution and use in source and binary forms, w"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonParser.h",
    "chars": 3595,
    "preview": "/*\n Copyright (C) 2009 Stig Brautaset. All rights reserved.\n\n Redistribution and use in source and binary forms, with or"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonParser.m",
    "chars": 3264,
    "preview": "/*\n Copyright (C) 2009,2010 Stig Brautaset. All rights reserved.\n \n Redistribution and use in source and binary forms, w"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonStreamParser.h",
    "chars": 5649,
    "preview": "/*\n Copyright (c) 2010, Stig Brautaset.\n All rights reserved.\n \n Redistribution and use in source and binary forms, with"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonStreamParser.m",
    "chars": 6689,
    "preview": "/*\n Copyright (c) 2010, Stig Brautaset.\n All rights reserved.\n\n Redistribution and use in source and binary forms, with "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonStreamParserAccumulator.h",
    "chars": 1751,
    "preview": "/*\n Copyright (C) 2011 Stig Brautaset. All rights reserved.\n \n Redistribution and use in source and binary forms, with o"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonStreamParserAccumulator.m",
    "chars": 1947,
    "preview": "/*\n Copyright (C) 2011 Stig Brautaset. All rights reserved.\n \n Redistribution and use in source and binary forms, with o"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonStreamParserAdapter.h",
    "chars": 5223,
    "preview": "/*\n Copyright (c) 2010, Stig Brautaset.\n All rights reserved.\n \n Redistribution and use in source and binary forms, with"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonStreamParserAdapter.m",
    "chars": 4553,
    "preview": "/*\n Copyright (c) 2010, Stig Brautaset.\n All rights reserved.\n \n Redistribution and use in source and binary forms, with"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonStreamParserState.h",
    "chars": 2832,
    "preview": "/*\n Copyright (c) 2010, Stig Brautaset.\n All rights reserved.\n \n Redistribution and use in source and binary forms, with"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonStreamParserState.m",
    "chars": 8045,
    "preview": "/*\n Copyright (c) 2010, Stig Brautaset.\n All rights reserved.\n\n Redistribution and use in source and binary forms, with "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonStreamWriter.h",
    "chars": 5839,
    "preview": "/*\n Copyright (c) 2010, Stig Brautaset.\n All rights reserved.\n \n Redistribution and use in source and binary forms, with"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonStreamWriter.m",
    "chars": 10644,
    "preview": "/*\n Copyright (c) 2010, Stig Brautaset.\n All rights reserved.\n\n Redistribution and use in source and binary forms, with "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonStreamWriterAccumulator.h",
    "chars": 1714,
    "preview": "/*\n Copyright (C) 2011 Stig Brautaset. All rights reserved.\n \n Redistribution and use in source and binary forms, with o"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonStreamWriterAccumulator.m",
    "chars": 2027,
    "preview": "/*\n Copyright (C) 2011 Stig Brautaset. All rights reserved.\n \n Redistribution and use in source and binary forms, with o"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonStreamWriterState.h",
    "chars": 2540,
    "preview": "/*\n Copyright (c) 2010, Stig Brautaset.\n All rights reserved.\n \n Redistribution and use in source and binary forms, with"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonStreamWriterState.m",
    "chars": 3937,
    "preview": "/*\n Copyright (c) 2010, Stig Brautaset.\n All rights reserved.\n\n Redistribution and use in source and binary forms, with "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonTokeniser.h",
    "chars": 2204,
    "preview": "/*\n Copyright (c) 2010, Stig Brautaset.\n All rights reserved.\n \n Redistribution and use in source and binary forms, with"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonTokeniser.m",
    "chars": 12666,
    "preview": "/*\n Copyright (c) 2010-2011, Stig Brautaset. All rights reserved.\n\n Redistribution and use in source and binary forms, w"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonUTF8Stream.h",
    "chars": 2091,
    "preview": "/*\n Copyright (c) 2011, Stig Brautaset. All rights reserved.\n \n Redistribution and use in source and binary forms, with "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonUTF8Stream.m",
    "chars": 3877,
    "preview": "/*\n Copyright (c) 2011, Stig Brautaset. All rights reserved.\n \n Redistribution and use in source and binary forms, with "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonWriter.h",
    "chars": 4278,
    "preview": "/*\n Copyright (C) 2009 Stig Brautaset. All rights reserved.\n \n Redistribution and use in source and binary forms, with o"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/JSON/SBJsonWriter.m",
    "chars": 3519,
    "preview": "/*\n Copyright (C) 2009 Stig Brautaset. All rights reserved.\n \n Redistribution and use in source and binary forms, with o"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/Reachability/Reachability.h",
    "chars": 7461,
    "preview": "/*\n \n File: Reachability.h\n Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.\n \n Ver"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/OtherSources/Reachability/Reachability.m",
    "chars": 23990,
    "preview": "/*\n \n File: Reachability.m\n Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.\n \n Ver"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/DOUAPIConfig.h",
    "chars": 329,
    "preview": "//\n//  DOUAPIConfig.h\n//  DOUAPIEngine\n//\n//  Created by Lin GUO on 11-11-1.\n//  Copyright (c) 2011年 Douban Inc. All rig"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/DOUAPIConfig.m",
    "chars": 634,
    "preview": "//\n//  DOUAPIConfig.m\n//  DOUAPIEngine\n//\n//  Created by Lin GUO on 11-11-1.\n//  Copyright (c) 2011年 Douban Inc. All rig"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/DOUAPIEngine.h",
    "chars": 337,
    "preview": "//\n//  DOUAPIEngine.h\n//  DOUAPIEngine\n//\n//  Created by Lin GUO on 11-11-2.\n//  Copyright (c) 2011年 Douban Inc. All rig"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/BaseClasses/GDataEntryBase.h",
    "chars": 6681,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/BaseClasses/GDataEntryBase.m",
    "chars": 25426,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/BaseClasses/GDataFeedBase.h",
    "chars": 6542,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/BaseClasses/GDataFeedBase.m",
    "chars": 22865,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/BaseClasses/GDataObject.h",
    "chars": 24131,
    "preview": "/* Copyright (c) 2007 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/BaseClasses/GDataObject.m",
    "chars": 91811,
    "preview": "/* Copyright (c) 2007 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataAtomPubControl.h",
    "chars": 964,
    "preview": "/* Copyright (c) 2007 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataAtomPubControl.m",
    "chars": 3036,
    "preview": "/* Copyright (c) 2007 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataBaseElements.h",
    "chars": 2455,
    "preview": "/* Copyright (c) 2008 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataBaseElements.m",
    "chars": 6258,
    "preview": "/* Copyright (c) 2008 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataBatchID.h",
    "chars": 878,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataBatchID.m",
    "chars": 1293,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataBatchInterrupted.h",
    "chars": 1271,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataBatchInterrupted.m",
    "chars": 3044,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataBatchOperation.h",
    "chars": 1400,
    "preview": "/* Copyright (c) 2007-2008 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataBatchOperation.m",
    "chars": 1516,
    "preview": "/* Copyright (c) 2007-2008 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataBatchStatus.h",
    "chars": 1332,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataBatchStatus.m",
    "chars": 2463,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataCategory.h",
    "chars": 2899,
    "preview": "/* Copyright (c) 2007 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataCategory.m",
    "chars": 5140,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataComment.h",
    "chars": 1340,
    "preview": "/* Copyright (c) 2007-2008 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataComment.m",
    "chars": 2479,
    "preview": "/* Copyright (c) 2007-2008 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataCustomProperty.h",
    "chars": 1483,
    "preview": "/* Copyright (c) 2009 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataCustomProperty.m",
    "chars": 2621,
    "preview": "/* Copyright (c) 2009 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataDateTime.h",
    "chars": 1957,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataDateTime.m",
    "chars": 12545,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataDeleted.h",
    "chars": 827,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataDeleted.m",
    "chars": 1003,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataElements.h",
    "chars": 1107,
    "preview": "/* Copyright (c) 2007-2008 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataEmail.h",
    "chars": 1322,
    "preview": "/* Copyright (c) 2007 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataEmail.m",
    "chars": 2579,
    "preview": "/* Copyright (c) 2007 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataEntryContent.h",
    "chars": 2201,
    "preview": "/* Copyright (c) 2007-2008 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataEntryContent.m",
    "chars": 6910,
    "preview": "/* Copyright (c) 2007-2008 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataEntryLink.h",
    "chars": 1346,
    "preview": "/* Copyright (c) 2007-2008 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataEntryLink.m",
    "chars": 3786,
    "preview": "/* Copyright (c) 2007-2008 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataExtendedProperty.h",
    "chars": 2417,
    "preview": "/* Copyright (c) 2007 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataExtendedProperty.m",
    "chars": 5341,
    "preview": "/* Copyright (c) 2007 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataFeedLink.h",
    "chars": 1437,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataFeedLink.m",
    "chars": 4548,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataGenerator.h",
    "chars": 1155,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataGenerator.m",
    "chars": 2086,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataGeoPt.h",
    "chars": 1862,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataGeoPt.m",
    "chars": 5423,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataIM.h",
    "chars": 2756,
    "preview": "/* Copyright (c) 2007 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataIM.m",
    "chars": 3120,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataLink.h",
    "chars": 3118,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataLink.m",
    "chars": 6294,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataMoney.h",
    "chars": 1229,
    "preview": "/* Copyright (c) 2008 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataMoney.m",
    "chars": 2102,
    "preview": "/* Copyright (c) 2008 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataName.h",
    "chars": 2094,
    "preview": "/* Copyright (c) 2009 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataName.m",
    "chars": 9398,
    "preview": "/* Copyright (c) 2009 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataOrganization.h",
    "chars": 1992,
    "preview": "/* Copyright (c) 2008 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataOrganization.m",
    "chars": 8395,
    "preview": "/* Copyright (c) 2008 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataOrganizationName.h",
    "chars": 1156,
    "preview": "/* Copyright (c) 2009 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataOrganizationName.m",
    "chars": 2263,
    "preview": "/* Copyright (c) 2009 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataPerson.h",
    "chars": 1105,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataPerson.m",
    "chars": 4268,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataPhoneNumber.h",
    "chars": 3943,
    "preview": "/* Copyright (c) 2007 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataPhoneNumber.m",
    "chars": 2842,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataPostalAddress.h",
    "chars": 1356,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataPostalAddress.m",
    "chars": 2566,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataRating.h",
    "chars": 2008,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataRating.m",
    "chars": 3282,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataStructuredPostalAddress.h",
    "chars": 3666,
    "preview": "/* Copyright (c) 2009 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataStructuredPostalAddress.m",
    "chars": 14200,
    "preview": "/* Copyright (c) 2009 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataTextConstruct.h",
    "chars": 1063,
    "preview": "/* Copyright (c) 2007-2008 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataTextConstruct.m",
    "chars": 2608,
    "preview": "/* Copyright (c) 2007-2008 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataValueConstruct.h",
    "chars": 3239,
    "preview": "/* Copyright (c) 2007-2008 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataValueConstruct.m",
    "chars": 7031,
    "preview": "/* Copyright (c) 2007-2008 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataWhen.h",
    "chars": 1408,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataWhen.m",
    "chars": 2389,
    "preview": "/* Copyright (c) 2007 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataWhere.h",
    "chars": 2092,
    "preview": "/* Copyright (c) 2007-2008 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataWhere.m",
    "chars": 3107,
    "preview": "/* Copyright (c) 2007-2008 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataWho.h",
    "chars": 4247,
    "preview": "/* Copyright (c) 2007-2008 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/Elements/GDataWho.m",
    "chars": 4752,
    "preview": "/* Copyright (c) 2007-2008 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/GDataDefines.h",
    "chars": 5401,
    "preview": "/* Copyright (c) 2008 Google Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/GDataUtilities.h",
    "chars": 3899,
    "preview": "/* Copyright (c) 2008 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/GDataUtilities.m",
    "chars": 16456,
    "preview": "/* Copyright (c) 2008 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/HTTPFetcher/GTMGatherInputStream.h",
    "chars": 2549,
    "preview": "/* Copyright (c) 2010 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/HTTPFetcher/GTMGatherInputStream.m",
    "chars": 5116,
    "preview": "/* Copyright (c) 2010 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/HTTPFetcher/GTMMIMEDocument.h",
    "chars": 2047,
    "preview": "/* Copyright (c) 2010 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/HTTPFetcher/GTMMIMEDocument.m",
    "chars": 8734,
    "preview": "/* Copyright (c) 2010 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/XMLSupport/GDataXMLNode.h",
    "chars": 7230,
    "preview": "/* Copyright (c) 2008 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GData/XMLSupport/GDataXMLNode.m",
    "chars": 51492,
    "preview": "/* Copyright (c) 2008 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Comment/DoubanEntryComment.h",
    "chars": 504,
    "preview": "//\n//  DoubanEntryComment.h\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 3/23/12.\n//  Copyright (c) 2012 Douban Inc."
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Comment/DoubanEntryComment.m",
    "chars": 522,
    "preview": "//\n//  DoubanEntryComment.m\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 3/23/12.\n//  Copyright (c) 2012 Douban Inc."
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Comment/DoubanFeedComment.h",
    "chars": 254,
    "preview": "//\n//  DoubanFeedComment.h\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 3/23/12.\n//  Copyright (c) 2012 Douban Inc. "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Comment/DoubanFeedComment.m",
    "chars": 450,
    "preview": "//\n//  DoubanFeedComment.m\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 3/23/12.\n//  Copyright (c) 2012 Douban Inc. "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Event/DoubanEntryCity.h",
    "chars": 649,
    "preview": "//\n//  DoubanEntryCity.h\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 11-12-27.\n//  Copyright (c) 2011年 Douban Inc. "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Event/DoubanEntryCity.m",
    "chars": 2169,
    "preview": "//\n//  DoubanEntryCity.m\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 11-12-27.\n//  Copyright (c) 2011年 Douban Inc. "
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Event/DoubanEntryEvent.h",
    "chars": 1626,
    "preview": "//\n//  DoubanEntryEvent.h\n//  douban-objective-c\n//\n//  Created by py on 3/19/10.\n//  Copyright 2010 Douban Inc. All rig"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Event/DoubanEntryEvent.m",
    "chars": 9141,
    "preview": "//\n//  DoubanEntryEvent.m\n//  douban-objective-c\n//\n//  Created by py on 3/19/10.\n//  Copyright 2010 Douban Inc. All rig"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Event/DoubanEntryEventCategory.h",
    "chars": 1244,
    "preview": "//\n//  DoubanEntryEventCategory.h\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 11-12-26.\n//  Copyright (c) 2011年 Dou"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Event/DoubanEntryEventCategory.m",
    "chars": 2118,
    "preview": "//\n//  DoubanEntryEventCategory.m\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 11-12-26.\n//  Copyright (c) 2011年 Dou"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Event/DoubanFeedCity.h",
    "chars": 220,
    "preview": "//\n//  DoubanFeedCity.h\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 11-12-27.\n//  Copyright (c) 2011年 Douban Inc. A"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Event/DoubanFeedCity.m",
    "chars": 471,
    "preview": "//\n//  DoubanFeedCity.m\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 11-12-27.\n//  Copyright (c) 2011年 Douban Inc. A"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Event/DoubanFeedEvent.h",
    "chars": 214,
    "preview": "//\n//  DoubanFeedEvent.h\n//  douban-objective-c\n//\n//  Created by py on 3/19/10.\n//  Copyright 2010 Douban Inc. All righ"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Event/DoubanFeedEvent.m",
    "chars": 470,
    "preview": "//\n//  DoubanFeedEvent.m\n//  douban-objective-c\n//\n//  Created by py on 3/19/10.\n//  Copyright 2010 Douban Inc. All righ"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Event/DoubanFeedEventCategory.h",
    "chars": 238,
    "preview": "//\n//  DoubanFeedEventCategory.h\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 11-12-26.\n//  Copyright (c) 2011年 Doub"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Event/DoubanFeedEventCategory.m",
    "chars": 540,
    "preview": "//\n//  DoubanFeedEventCategory.m\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 11-12-26.\n//  Copyright (c) 2011年 Doub"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/GDataAtomAuthor+Extension.h",
    "chars": 341,
    "preview": "//\n//  GDataAtomAuthor+Extension.h\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 1/26/12.\n//  Copyright (c) 2012 Doub"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/GDataAtomAuthor+Extension.m",
    "chars": 562,
    "preview": "//\n//  GDataAtomAuthor+Extension.m\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 1/26/12.\n//  Copyright (c) 2012 Doub"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/GDataEntryBase+Extension.h",
    "chars": 441,
    "preview": "//\n// GDataEntryBase+Extension.h\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 1/16/12.\n//  Copyright (c) 2012 Douban"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/GDataEntryBase+Extension.m",
    "chars": 880,
    "preview": "//\n//  GDataEntryBase+Extension.m\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 1/16/12.\n//  Copyright (c) 2012 Douba"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Miniblog/DoubanEntryMiniblog.h",
    "chars": 1137,
    "preview": "//\n//  DoubanEntryMiniblog.h\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 11-12-9.\n//  Copyright (c) 2011年 Douban In"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Miniblog/DoubanEntryMiniblog.m",
    "chars": 4239,
    "preview": "//\n//  DoubanEntryMiniblog.m\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 11-12-9.\n//  Copyright (c) 2011年 Douban In"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Miniblog/DoubanFeedMiniblog.h",
    "chars": 227,
    "preview": "//\n//  DoubanFeedMiniblog.h\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 11-12-9.\n//  Copyright (c) 2011年 Douban Inc"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Miniblog/DoubanFeedMiniblog.m",
    "chars": 501,
    "preview": "//\n//  DoubanFeedMiniblog.m\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 11-12-9.\n//  Copyright (c) 2011年 Douban Inc"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/People/DoubanEntryPeople.h",
    "chars": 847,
    "preview": "//\n//  DoubanEntryEvent.h\n//  douban-objective-c\n//\n//  Created by py on 3/19/10.\n//  Copyright 2010 Douban Inc. All rig"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/People/DoubanEntryPeople.m",
    "chars": 1489,
    "preview": "//\n//  DoubanEntryPeople.m\n//  douban-objective-c\n//\n//  Created by py on 3/23/10.\n//  Copyright 2010 Douban Inc. All ri"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/People/DoubanFeedPeople.h",
    "chars": 223,
    "preview": "//\n//  DoubanFeedPeople.h\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 11-11-15.\n//  Copyright (c) 2011年 Douban Inc."
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/People/DoubanFeedPeople.m",
    "chars": 485,
    "preview": "//\n//  DoubanFeedPeople.m\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 11-11-15.\n//  Copyright (c) 2011年 Douban Inc."
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Photo/DoubanEntryAlbum.h",
    "chars": 1194,
    "preview": "//\n//  DoubanEntryAlbum.h\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 1/31/12.\n//  Copyright (c) 2012 Douban Inc. A"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Photo/DoubanEntryAlbum.m",
    "chars": 2242,
    "preview": "//\n//  DoubanEntryAlbum.m\n//  DoubanAPIEngine\n//\n//  Created by Lin GUO on 1/31/12.\n//  Copyright (c) 2012 Douban Inc. A"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Photo/DoubanEntryPhoto.h",
    "chars": 1353,
    "preview": "//\n//  DoubanEntryPhoto.h\n//  douban-objective-c\n//\n//  Created by py on 4/6/10.\n//  Copyright 2010 Douban Inc. All righ"
  },
  {
    "path": "DoubanAPIEngine/DoubanAPIEngine/Sources/Model/GDataDoubanWrapper/Clients/Photo/DoubanEntryPhoto.m",
    "chars": 2827,
    "preview": "//\n//  DoubanEntryPhoto.m\n//  douban-objective-c\n//\n//  Created by py on 4/6/10.\n//  Copyright 2010 Douban Inc. All righ"
  }
]

// ... and 290 more files (download for full content)

About this extraction

This page contains the full source code of the douban/douban-objc-client GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 490 files (13.7 MB), approximately 515.4k tokens, and a symbol index with 102 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!