Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
How can I set cookies with c++ on a mongoose web server?
I found something here https://www.cesanta.com/developer/mongoose#_mg_http_parse_header But i'm not sure if is what I'm looking.
You should send a Set-Cookie HTTP header to the client. There multiple ways of doing that with mongoose, for example using mg_send_head() , https://www.cesanta.com/developer/mongoose#_mg_send_head :
mg_send_head(conn, 200, content_len, "Set-Cookie: token=1234; Expires=Wed, 09 Jun 2021 10:18:14 GMT");
Set-Cookie header format is described in https://www.rfc-editor.org/rfc/rfc6265. Wikipedia also has a good article on it, https://en.wikipedia.org/wiki/HTTP_cookie
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I keep getting this when I try to visit a website that I have previously visited many times before.
403 ERROR
The request could not be satisfied.
The Amazon CloudFront distribution is configured to block access from your country. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
Generated by cloudfront (CloudFront)
Request ID: db4AJqwG88H12zSDESOE7SIS8twSWZGScHR005VdWdEQ4RF8fx_ITA==
This might mean that the website is blocked on your country, your IP is blocked, or the website it's wrongly configured.
You can try contacting the site owner. 😉
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
Please consider the following code (serverless.yml):
functions:
exportCvToPdf:
handler: handler.exportCvToPdf
timeout: 20
events:
- http:
path: export
method: post
Deploying to AWS returns a link to the API endpoint.
CURL'ing the endpoint returns:
{"message":"Missing Authentication Token"}
How can I make a public endpoint using Serverless Framework?
I have tried the following:
functions:
exportCvToPdf:
handler: handler.exportCvToPdf
timeout: 20
events:
- http:
path: export
method: post
authorizer: none # None NONE "none" "NONE" "None" has also been tried
The above returns an error at deploy:
Function none doesn't exist in this Service
You should be able to just omit authorizer and your endpoint will be publicly accessible right after deployment. Ensure that you're calling proper URL with proper path and method. Could you share how are you calling the deployed endpoint?
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
I have just moved a MERN Stack app to AWS and I'm currently facing some problems with the certificates.
Current Scenario:
My website (example.com) has Cloudflare as the DNS Management.
I have added Cloudflare's Full SSL (end-to-end) encryption and a page rule for always redirect to https.
On the AWS Side, I have an Application Load Balancer (ALB) which is having a listener for HTTPS:443 using the certificate provided by AWS CA for example.com.
Problem:
When making a call to example.com, it redirects me to https://example.com and renders the static page which is fine.
When I change the page to https://example.com/articles the website goes berserk and changes it to http://example.com/articles and the certificate sign shows insecure now! Although, I do get my articles response from the server. Moreover, this is only happening in chrome and not firefox!
I would be more than happy to share any details/images required to support my query.
Thanks in advance!
Please share your page rules here. Your page rules are getting problem for you.
You can use the Always Use HTTPS function provided without wasting your page rules.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I am trying to make a graph api call to post status update to a fan pages.
I am using http post here
my base url: https://graph.facebook.com/{page_id}/feed
message=hi&access_token={access_token}
I am however getting an error
{"error":{"message":"An unexpected error has occurred. Please retry your request later.","type":"OAuthException","code":2}}
Could you tell me if I am missing anything?
Things I checked:
Access token is valid
Page exisits
You need the extended permission manage_pages for your app (or through graph explorer) to be able to publish to the page feed. Once you have a new access_token with that permission, this should work:
curl \
-F "message=hi" \
"https://graph.facebook.com/<page_id>/feed"
Or whatever method you prefer.
Edit: You may also need the page access token, as described in the Publish page API
There was a genuine bug at Fb's end.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Is it possible to use Winsock to create a program that will login to a website with http form submission?
I am currently reading some Winsock tutorials (listed below) but I would like to see an example of sending login data to a website.
http://msdn.microsoft.com/en-us/library/ms738545(v=vs.85).aspx
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=2241&lngWId=3
http://tangentsoft.net/wskfaq/
I have done this with LibCurl. Would like some tips to apply what I have done with curl to Winsock.
curl_easy_setopt(myHandle, CURLOPT_USERAGENT, "Mozilla/4.0");
curl_easy_setopt(myHandle, CURLOPT_AUTOREFERER, 1);
curl_easy_setopt(myHandle, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(myHandle, CURLOPT_COOKIEFILE, "");
// Visit the login page once to obtain a PHPSESSID cookie
curl_easy_setopt(myHandle, CURLOPT_URL, result);
curl_easy_perform(myHandle);
// Now, can actually login. First we forge the HTTP referer field, or HTS will deny the login
curl_easy_setopt(myHandle, CURLOPT_REFERER, result);
// Next we tell LibCurl what HTTP POST data to submit
char *data = "username=username&password=password";
curl_easy_setopt(myHandle, CURLOPT_POSTFIELDS, data);
curl_easy_perform(myHandle);
Perfectly possible and very educational but I do not recommended writing your own HTTP client for any software you intend using or distributing. The problem is that although basic HTTP is very simple, things like web proxies and differences in server configuration make writing a client that works in all situations very difficult.
Using a library like libCurl that handles all the annoyances for you is much easier.