Thanks for the quick answer, I'll fallback to having a copy of the substring 
then !

Clément Gregoire  |  Engine Programmer  

ASOBO Studio
23 Parvis des Chartrons, 33074 Bordeaux Cedex France 
P +33 5 56 01 04 98  |  M cgrego...@asobostudio.com  |  W www.asobostudio.com  
|  f / t @AsoboStudio

L'intégrité de ce message n'étant pas assurée sur internet, ASOBO STUDIO ne 
peut être tenue responsable de son contenu. Toute utilisation ou diffusion non 
autorisée est interdite. Si vous n'êtes pas destinataire de ce message, merci 
de le détruire et d'avertir l'expéditeur. Les opinions, conclusions, idées 
exprimées dans ce message, qui seraient sans relation avec l'activité d'ASOBO 
STUDIO, ne peuvent être considérées ni comme émises ni comme approuvées par 
ASOBO STUDIO. The integrity of this message cannot be guaranteed on the 
Internet. ASOBO STUDIO cannot therefore be considered responsible for the 
contents. Any unauthorized use or dissemination is prohibited. If you are not 
the intended recipient of this message, then please delete it and notify the 
sender. Opinions, conclusions, or other statements in this message which do not 
relate to the business of ASOBO STUDIO are neither given nor endorsed by ASOBO 
STUDIO.

        Avant d'imprimer, pensez à l'environnement - Think about environment 
before printing

-----Message d'origine-----
De : Daniel Stenberg [mailto:dan...@haxx.se] 
Envoyé : jeudi 3 octobre 2019 11:56
À : Clément Gregoire via curl-library <curl-library@cool.haxx.se>
Cc : Clément Gregoire <cgrego...@asobostudio.com>
Objet : Re: CURLOPT_HEADERFUNCTION and buffer modifications

On Thu, 3 Oct 2019, Clément Gregoire via curl-library wrote:

> I'm using CURLOPT_HEADERFUNCTION to read/parse headers, and it'd be 
> useful for me if I could replace some characters with for example the 
> '\0'. Typical usage would be for strtok. Is this allowed ? I know the 
> header callback buffer member is `char*` and not `const char*` but I 
> still wanted to make sure.

A fair question as it isn't specifically mentioned in the documentation. We 
should probably add something to this effect.

I would strongly discourage doing that. The prototype and callbacks should be 
considered a 'const char *'. Not using that was just an omission (by me) and 
stuck like this to not rock the boat.

You will *likely* be able to write to that buffer without it hurting, but 
that's not something we can guarantee will continue to work nor that it worked 
correctly in older libcurl versions.

That's also why strtok_r() and friends were invented! ;-)

-- 

  / daniel.haxx.se | Get the best commercial curl support there is - from me
                   | Private help, bug fixes, support, ports, new features
                   | https://www.wolfssl.com/contact/

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to