Replies: 2 comments 8 replies
-
|
Wow, that was quick. :) I have another issue though: The problematic generated code: string formEncodeDatalist(Data formDataSet)
{
char* _cretval;
_cretval = soup_form_encode_datalist(formDataSet);
string _retval = _cretval.fromCString(Yes.Free);
return _retval;
}Do we have a case somewhere where we deal with pointer of pointers? |
Beta Was this translation helpful? Give feedback.
3 replies
-
|
It all works now. Here is a demo from my gid-examples project ( https://codeberg.org/dejan/gid-examples/src/branch/main/soup/source/app.d ): import std.stdio;
import soup.session; // Session
import soup.message_headers; // MessageHeaders
import soup.message; // Message
import soup.types; // Bytes
import gio.file; // File (Gio.File)
import gio.types; // FileCreateFlags
import glib.bytes; // Bytes
enum FILE_CREATE_NONE = 0;
enum SOUP_METHOD_GET = "GET";
void main(string[] args) {
Session session = new Session();
MessageHeaders mhs = null;
string contentType;
Message msg = new Message(SOUP_METHOD_GET, "https://editor.dlang.io/static/img/tour/dman.png");
Bytes contentBytes = session.sendAndRead(msg, null);
if (contentBytes is null) {
writeln("Could not download the DMan PNG file! :(");
} else {
auto rhs = msg.getResponseHeaders(); // Returns MessageHeaders
string[string] params;
contentType = rhs.getContentType(params);
writeln("Content-Type: ", contentType, ", Size: ", contentBytes.getSize);
}
// Let's use GIO File to save contentBytes
auto file = gio.file.File.newForPath("dman.png");
file.replaceContentsBytesAsync(contentBytes, null, false, FileCreateFlags.None, null, null);
}, and after Obviously it did not save those bytes to the file for some reason, but that is me not knowing anything about GIO... :) |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am working on the Soup v3 binding.
Found a tiny bug in gidgen that caused gidgen not to generate valid D code. The PR is here: Kymorphia/gidgen#4 . There are few other issues. I will try to solve those too, and may make some additional PRs in gidgen eventually...
Beta Was this translation helpful? Give feedback.
All reactions