Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - tofiffe

Pages: [1]
1
Network / Http session/login
« on: May 22, 2014, 08:07:15 pm »
Hi I was trying(for fun) to make an app that would connect to my router, which requests password using pop-up  prompt box, so I don't know what the name of the values are, but I can use "user:passwd@modemip" to connect to it, but the sf::Http returns 1001 when I try to attempt this, so I've tried sending a post request like this:
(click to show/hide)

where sysUsername and sysPassword were the same as in modem site for changing username and password.

Is there any way to perform a working http request or should I resort to sockets?

2
Network / Re: Using sf::Http to send file
« on: May 05, 2013, 06:26:11 pm »
I've got the server set up, the upload works in browsers, now, I've tried sending the file to server but since in the file there are null characters that I cannot append to string - only up to that point, the rest gets cut off...

from what I read it is supposed to be
request.setField("Content-Type", "multipart/form-data");

this however gives this error: Missing boundary in multipart/form-data POST data on line 0
also the content length on page equals to ~20 characters, from which 16 are the "file=" and "&fname=blah", so there are only 4 characters left for the file.

Needles to say, file is not uploaded.

edit: after adding the ";boundary=(size of file+16)" the content length is now matching, still the file is not uploaded.

3
Window / Re: Trouble with sf::Keyboard::isKeyPressed()
« on: May 05, 2013, 04:41:38 pm »
yes that is correct.

4
Window / Re: Trouble with sf::Keyboard::isKeyPressed()
« on: May 05, 2013, 03:48:13 pm »
I don't think it's the compilers fault, since everything but this works. Version is TDM MinGW 32 bit, GCC 4.7

5
Network / Re: Using sf::Http to send file
« on: May 05, 2013, 03:16:53 pm »
Can you perhaps give me an example how this can be done?

Let me see if I got this correct:
1. I have to read the file in binary and replace the path with it
2. Set the header to the specified file type (which I'm not quite sure how)

Anything else I should do on the server?

6
Window / Trouble with sf::Keyboard::isKeyPressed()
« on: May 05, 2013, 02:59:03 pm »
I have tried many things, but no matter what I do my compiler crashes when I use the function.
I'm using Code::Blocks with MinGW, GCC 4.7 on Windows 8.

When I put the function in comments the whole program starts working, but no matter what button I want to check for the process "ld.exe" stops working.

7
Network / Re: Using sf::Http to send file
« on: May 05, 2013, 02:49:38 pm »
okay, moving the shost to request worked, now I'm not getting any errors, however the file isn't uploaded...am I supposed to do anything else with it?

8
Network / Using sf::Http to send file
« on: May 05, 2013, 02:02:29 pm »
I have a webpage, that accepts a file and name for it on server.
for the post so far I have:
sf::Http http;
http.setHost("http://localhost/shost");
sf::Http::Request request;
request.setMethod(sf::Http::Request::Post);
request.setBody("file=C:\\path\\to\\file.txt&name=something");
sf::Http::Response response=http.sendRequest(request);
if(response.getStatus()==sf::Http::Response::Ok)
{
        cout<<response.getBody();
}
else
{
        cout<<"error "<<response.getStatus()<<endl;
}

I get error 1001 which appears to be a file transfer error, how can I fix this?

Pages: [1]
anything