Golang iris-web. Get HTTP referer and useragent - go

lang and trying to use a framework called iris-web.
i wanted to know how to get the http referrer and user-agent properly..
I've been through the documentation pdf. No clear explanation..
Any help will be deeply appreciated.

As in regular Go http:
request.Header.Get("User-Agent")
request.Header.Get("Referer")

import "github.com/kataras/iris"
// [...]
func(ctx iris.Context){
uag:= ctx.GetHeader("User-Agent")
ref:= ctx.GetHeader("Referer")
}
Iris provides features that other frameworks doesn't have while in the same time it's faster. Iris ,as github project is more active than others. There is no reason to suggest other lower frameworks when the user asks for Iris answer.
#Sergey Lanzman What's the problem with Iris?

Related

Gorilla/Mux Reverse mapping URL

I'm new in development. Now trying to learn gorilla/mux router.
The question is about reversed urls.
In gorilla/mux I know we name them with .Name() method and access with .Url().
Could someone explain real use case of reserved URL's(Reverse mapping URL)?
But a few hours of googling didn't help me to find any info about that why we even need them? Will be really thankfull if you could show some practical examples.
Use cases if someone needs.
• Constructing redirects to send to a client - eg programmatically, so you don’t have to fix the URLs in your code elsewhere
• Building examples & tests
• Generating docs

Getting readable information from Amazon sdk ruby

Maybe someone could help me with an issue while working with Amazon SDK for Ruby.
When trying to retrieve information with commands like "get_bucket_login" or "get_bucket_location" what I get as a response is:
<Seahorse::Client::Response:....>
According to the documentation, these requests should return strings.
What am I missing? Someone found the same issue?
Seahorse is part of the core of the SDK:
https://github.com/aws/aws-sdk-ruby/tree/master/aws-sdk-core/lib/seahorse
The clients of all the services are modeled to use the Base of this.
Now back to your question:
You get an "empty" response as in it does not conform to what the client base is used to.
=== for get_bucket_location ===
the way to get your bucket location is the following:
resp = s3.get_bucket_location(bucket: "mybucketname")
puts resp.data.location_constraint
empty string means US Standard, per documentation here: http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlocation.html
the code that monkey patches this in is here: https://github.com/aws/aws-sdk-ruby/blob/53712d3e4583c982837fb3a301fa2c67226a05ff/aws-sdk-core/lib/aws-sdk-core/plugins/s3_get_bucket_location_fix.rb
== for get_bucket_login ==
I don't see this method on the client. If it's logging instead of login, you can see the response structure in the documentation: http://docs.aws.amazon.com/sdkforruby/api/Aws/S3/Client.html#get_bucket_logging-instance_method

Resume in articulate with tin-can api

I am trying to implement this endpoint activities/state/?method=GET in my LRS - but I can not seem to get the resume functionality working. I have all the data, but not sure what does Articulate expect the LRS to return in order to resume where the user left off. I also tried looking at Articulate support page, but nothing useful so far. Any help would be appreciated.
It's looking for the state string to be returned. Which is just a long string that is sent out when the state ( bookmark ) is saved.
I recommend testing with the Golf Prototype at http://tincanapi.com/prototypes/ first so that you know the issue is with the LRS. Try the prototypes in both Internet Explorer and another browser such as Chrome; any difference in behaviour could be a clue.
Please also look at your network tab in Chrome's developer tools and let us know if any requests are failing and what is being stored and retrieved from the State.
Full details of how the State API is supposed to work are found in the spec. Here's the relevant section in version 1.0.2: https://github.com/adlnet/xAPI-Spec/blob/a752217060b83a2e15dfab69f8c257cd86a888e6/xAPI.md#stateapi
It's also worth noting that building an LRS is hard. There are a number of commercial and open source LRS that will likely be cheaper than building one yourself.
I managed to get this working. I was using .NET Web API.
I had to explicitly set the content-type header to octet-stream - It was defaulting to text/html.
The following code did the trick:
HttpResponseMessage httpResponseMessage = Request.CreateResponse(HttpStatusCode.OK);
httpResponseMessage.Content = new StringContent(studentModuleName.SuspendData);
httpResponseMessage.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");

Convert WebDAV to FTP

I am wondering if it is possible to convert WebDAV to FTP.
I have already found that the POST and GET methods can be parsed into an FTP url that sends or retrieves the files (in my case, using IBM DataPower). Although I managed to get both methods working, I seem to have problems getting a listing of the files in that FTP folder using WebDAV.
Could anyone give me a hint on what should travel on both request and response for the PROPFIND method? (DP v7 already supports non-standard HTTP methods)
From what I saw: http://msdn.microsoft.com/en-us/library/aa142960(v=exchg.65).aspx it seems like XML is travelling to and from, so I might be able to do something with it, am I right?
Thanks in advance :)
Regards!
Yes indeed it's XML.
The format is defined in RFC 4918.
You have some help in this SO question, here.

How to view the raw XML or Json response using LinqToTwitter?

How can I view the raw XML or Json response when doing a search for users using the LinqToTwitter library? I'm using the SingleUserAuthorizer for oAuth.
If you have any ideas using other libraries or even a simple oAuth framework, I'm open to suggestions.
Thanks.
TwitterContext has a RawResults property you can use.
If this is just for debugging purposes, I'd use Wireshark or Fiddler - that way you get to see the complete HTTP requests/responses.

Resources