For upload, consider using [NSMutableURLRequest setHTTPBodyStream] instead of setHTTPBody

Open
#37 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
ios, objective-c
Domain
mobile

Research direction

Start by locating the iOS upload request implementation that currently assigns the upload data with setHTTPBody, then inspect how file and video uploads are constructed. Compare the existing request flow with NSMutableURLRequest's setHTTPBodyStream and determine how completion and error handling work. Done means large uploads no longer require the full payload in memory without breaking existing uploads.

Written by the indexing model from the issue text.

Description

enhancement

Hi there,

I wanted to make a quick suggestion.

Cloudinary can use a significant amount of memory, particularly when uploading videos or large photos because image/video data must be fully loaded into RAM before being sent over the wire.

It looks as though NSMutableURLRequest supports setting an body stream instead of data.

NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
NSInputStream *stream = [[NSInputStream alloc] initWithFileAtPath:filePath];
[request setHTTPBodyStream:stream];

This might be something worth looking into to reduce Cloudinary's memory footprint.

Thanks,
Martin

Dominant language
Swift
Stars
169
Forks
107
PR merge metrics
No merged PRs in 30d

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudinary/cloudinary_ios

All issues in cloudinary/cloudinary_ios

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.