1 module soup.ContentDecoder; 2 3 private import gobject.ObjectG; 4 private import soup.SessionFeatureIF; 5 private import soup.SessionFeatureT; 6 private import soup.c.functions; 7 public import soup.c.types; 8 9 10 /** 11 * #SoupContentDecoder handles adding the "Accept-Encoding" header on 12 * outgoing messages, and processing the "Content-Encoding" header on 13 * incoming ones. Currently it supports the "gzip", "deflate", and "br" 14 * content codings. 15 * 16 * If you are using a plain #SoupSession (ie, not #SoupSessionAsync or 17 * #SoupSessionSync), then a #SoupContentDecoder will automatically be 18 * added to the session by default. (You can use 19 * %SOUP_SESSION_REMOVE_FEATURE_BY_TYPE at construct time if you don't 20 * want this.) If you are using one of the deprecated #SoupSession 21 * subclasses, you can add a #SoupContentDecoder to your session with 22 * soup_session_add_feature() or soup_session_add_feature_by_type(). 23 * 24 * If #SoupContentDecoder successfully decodes the Content-Encoding, 25 * it will set the %SOUP_MESSAGE_CONTENT_DECODED flag on the message, 26 * and the message body and the chunks in the #SoupMessage::got_chunk 27 * signals will contain the decoded data; however, the message headers 28 * will be unchanged (and so "Content-Encoding" will still be present, 29 * "Content-Length" will describe the original encoded length, etc). 30 * 31 * If "Content-Encoding" contains any encoding types that 32 * #SoupContentDecoder doesn't recognize, then none of the encodings 33 * will be decoded (and the %SOUP_MESSAGE_CONTENT_DECODED flag will 34 * not be set). 35 * 36 * (Note that currently there is no way to (automatically) use 37 * Content-Encoding when sending a request body, or to pick specific 38 * encoding types to support.) 39 * 40 * Since: 2.30 41 */ 42 public class ContentDecoder : ObjectG, SessionFeatureIF 43 { 44 /** the main Gtk struct */ 45 protected SoupContentDecoder* soupContentDecoder; 46 47 /** Get the main Gtk struct */ 48 public SoupContentDecoder* getContentDecoderStruct(bool transferOwnership = false) 49 { 50 if (transferOwnership) 51 ownedRef = false; 52 return soupContentDecoder; 53 } 54 55 /** the main Gtk struct as a void* */ 56 protected override void* getStruct() 57 { 58 return cast(void*)soupContentDecoder; 59 } 60 61 /** 62 * Sets our main struct and passes it to the parent class. 63 */ 64 public this (SoupContentDecoder* soupContentDecoder, bool ownedRef = false) 65 { 66 this.soupContentDecoder = soupContentDecoder; 67 super(cast(GObject*)soupContentDecoder, ownedRef); 68 } 69 70 // add the SessionFeature capabilities 71 mixin SessionFeatureT!(SoupContentDecoder); 72 73 74 /** */ 75 public static GType getType() 76 { 77 return soup_content_decoder_get_type(); 78 } 79 }