Skip to content

Instantly share code, notes, and snippets.

@smd686s
smd686s / server.go
Last active August 29, 2015 14:17 — forked from elithrar/server.go
package main
import (
"fmt"
"log"
"net/http"
"html/template"
"github.com/gorilla/sessions"
package main
import (
"fmt"
"github.com/codegangsta/negroni"
"github.com/julienschmidt/httprouter"
"net/http"
)
func main() {
@smd686s
smd686s / auth.rb
Created December 2, 2012 15:34
Attempt at authorization with goliath
#!/usr/bin/env ruby
require 'rubygems'
require 'goliath'
require 'warden'
require 'digest/sha1'
require 'pp'
Warden::Strategies.add(:password) do
def valid?
body = MultipartBody.new(:field1 => 'test', :field2 => 'test2')
http = EventMachine::HttpRequest.new('http://example.com').post(
:head => {'content-type' => "multipart/form-data; boundary=#{body.boundary}"},
:body => body.to_s
)
# Or with a file part included
part1 = Part.new('name', 'content', 'file.txt')